Changeset 541

Show
Ignore:
Timestamp:
07/18/08 17:19:49 (3 months ago)
Author:
Mike Wey
Message:

Change Exceptions in the APILookupFiles, and add missing glib/ConstructionException.d

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/gdk/RgbCmap.d

    r540 r541  
    182182        if(p is null) 
    183183        { 
    184             this = null; 
    185             version(Exceptions) throw new Exception("Construction failure."); 
    186             else return; 
     184            throw new ConstructionException("null returned by gdk_rgb_cmap_new(cast(uint*)(colors.ptr), colors.length)"); 
    187185        } 
    188186        this(cast(GdkRgbCmap*) p); 
  • trunk/src/gdkpixbuf/PixbufLoader.d

    r540 r541  
    175175     *  A newly-created pixbuf loader. 
    176176     */ 
    177     public this (string type, GError** error, bool isMimeType=false) 
    178     { 
     177    public this (string type, bool isMimeType=false) 
     178    { 
     179        GdkPixbufLoader* p; 
     180        GError* err = null; 
     181         
    179182        if ( isMimeType ) 
    180183        { 
    181184            // GdkPixbufLoader* gdk_pixbuf_loader_new_with_mime_type  (const char *mime_type,  GError **error); 
    182             this(cast(GdkPixbufLoader*)gdk_pixbuf_loader_new_with_mime_type(Str.toStringz(type), error) ); 
     185            p = cast(GdkPixbufLoader*)gdk_pixbuf_loader_new_with_mime_type(Str.toStringz(type), &err); 
    183186        } 
    184187        else 
    185188        { 
    186189            // GdkPixbufLoader* gdk_pixbuf_loader_new_with_type  (const char *image_type,  GError **error); 
    187             this(cast(GdkPixbufLoader*)gdk_pixbuf_loader_new_with_type(Str.toStringz(type), error) ); 
    188         } 
     190            p = cast(GdkPixbufLoader*)gdk_pixbuf_loader_new_with_type(Str.toStringz(type), &err); 
     191        } 
     192         
     193        if (err !is null) 
     194        { 
     195            throw new GException( new ErrorG(err) ); 
     196        } 
     197         
     198        if(p is null) 
     199        { 
     200            throw new ConstructionException("null returned by gtk_button_new()"); 
     201        } 
     202         
     203        this(p); 
    189204    } 
    190205     
  • trunk/src/gtk/Button.d

    r540 r541  
    166166     * Returns: 
    167167     *  a new GtkButton 
     168     * Throws: ConstructionException GTK+ fails to create the object. 
    168169     */ 
    169170    public this (string label, bool mnemonic=true) 
    170171    { 
     172        GtkButton* p; 
     173         
    171174        if ( mnemonic ) 
    172175        { 
    173176            // GtkWidget* gtk_button_new_with_mnemonic (const gchar *label); 
    174             this(cast(GtkButton*)gtk_button_new_with_mnemonic(Str.toStringz(label)) ); 
     177            p = cast(GtkButton*)gtk_button_new_with_mnemonic(Str.toStringz(label)); 
    175178        } 
    176179        else 
    177180        { 
    178181            // GtkWidget* gtk_button_new_with_label (const gchar *label); 
    179             this(cast(GtkButton*)gtk_button_new_with_label(Str.toStringz(label)) ); 
    180         } 
     182            p = cast(GtkButton*)gtk_button_new_with_label(Str.toStringz(label)); 
     183        } 
     184         
     185        if(p is null) 
     186        { 
     187            throw new ConstructionException("null returned by gtk_button_new_with_label"); 
     188        } 
     189         
     190        this(p); 
    181191    } 
    182192     
     
    189199     * Params: 
    190200     *  StockID = the name of the stock item 
     201     * Throws: ConstructionException GTK+ fails to create the object. 
    191202     */ 
    192203    public this (StockID stockID, bool hideLabel=false) 
     
    201212        else 
    202213        { 
    203             this(cast(GtkButton*)gtk_button_new_from_stock(Str.toStringz(StockDesc[stockID])) ); 
     214            auto p = gtk_button_new_from_stock(Str.toStringz(StockDesc[stockID])); 
     215             
     216            if(p is null) 
     217            { 
     218                throw new ConstructionException("null returned by gtk_button_new_from_stock"); 
     219            } 
     220             
     221            this(cast(GtkButton*) p); 
    204222        } 
    205223         
  • trunk/src/gtk/CellEditable.d

    r540 r541  
    4343 * omit signals: 
    4444 * imports: 
    45  *  - gobject.ObjectG; 
     45 *  - gobject.ObjectG 
    4646 *  - gdk.Event 
    4747 *  - gtk.CellEditableT 
     
    6262 
    6363 
    64 private import gobject.ObjectG;; 
     64private import gobject.ObjectG; 
    6565private import gdk.Event; 
    6666private import gtk.CellEditableT; 
     
    9393        { 
    9494            this = null; 
    95             version(Exceptions) throw new Exception("Null gtkCellEditable passed to constructor."); 
    96             else return; 
    97         } 
    98         //Check if there already is a D object for this gtk struct 
    99         void* ptr = getDObject(cast(GObject*)gtkCellEditable); 
    100         if( ptr !is null ) 
    101         { 
    102             this = cast(CellEditable)ptr; 
    10395            return; 
    10496        } 
     97         
    10598        super(cast(GObject*)gtkCellEditable); 
    10699        this.gtkCellEditable = gtkCellEditable; 
  • trunk/src/gtk/CellView.d

    r540 r541  
    149149     * Returns: 
    150150     *  A newly created GtkCellView widget. 
     151     * Throws: ConstructionException GTK+ fails to create the object. 
    151152     */ 
    152153    public this (string text, bool markup=true) 
    153154    { 
     155        GtkCellView* p; 
     156         
    154157        if ( markup ) 
    155158        { 
    156159            // GtkWidget* gtk_cell_view_new_with_markup (const gchar *markup); 
    157             this(cast(GtkCellView*)gtk_cell_view_new_with_markup(Str.toStringz(text)) ); 
     160            p = cast(GtkCellView*)gtk_cell_view_new_with_markup(Str.toStringz(text)); 
    158161        } 
    159162        else 
    160163        { 
    161164            // GtkWidget* gtk_cell_view_new_with_text (const gchar *text); 
    162             this(cast(GtkCellView*)gtk_cell_view_new_with_text(Str.toStringz(text)) ); 
    163         } 
     165            p = cast(GtkCellView*)gtk_cell_view_new_with_text(Str.toStringz(text)); 
     166        } 
     167         
     168        if(p is null) 
     169        { 
     170            throw new ConstructionException("null returned by gtk_cell_view_new_with_"); 
     171        } 
     172         
     173        this(p); 
    164174    } 
    165175     
  • trunk/src/gtk/CheckButton.d

    r540 r541  
    123123     *  mnemonic character 
    124124     *  mnemonic = true if the button has an mnemnonic 
     125     * Throws: ConstructionException GTK+ fails to create the object. 
    125126     */ 
    126127    public this (string label, bool mnemonic=true) 
    127128    { 
     129        GtkCheckButton* p; 
     130         
    128131        if ( mnemonic ) 
    129132        { 
    130133            // GtkWidget* gtk_check_button_new_with_mnemonic  (const gchar *label); 
    131             this(cast(GtkCheckButton*)gtk_check_button_new_with_mnemonic(Str.toStringz(label)) ); 
     134            p = cast(GtkCheckButton*)gtk_check_button_new_with_mnemonic(Str.toStringz(label)); 
    132135        } 
    133136        else 
    134137        { 
    135138            // GtkWidget* gtk_check_button_new_with_label (const gchar *label); 
    136             this(cast(GtkCheckButton*)gtk_check_button_new_with_label(Str.toStringz(label)) ); 
     139            p = cast(GtkCheckButton*)gtk_check_button_new_with_label(Str.toStringz(label)); 
    137140        } 
     141         
     142        if(p is null) 
     143        { 
     144            throw new ConstructionException("null returned by gtk_check_button_new_"); 
     145        } 
     146         
     147        this(p); 
    138148    } 
    139149     
  • trunk/src/gtk/CheckMenuItem.d

    r540 r541  
    125125     *  will be created using gtk_label_new_with_mnemonic(), so underscores 
    126126     *  in label indicate the mnemonic for the menu item. 
     127     * Throws: ConstructionException GTK+ fails to create the object. 
    127128     */ 
    128129    public this (string label, bool mnemonic=true) 
    129130    { 
     131        GtkCheckMenuItem* p; 
     132         
    130133        if ( mnemonic ) 
    131134        { 
    132135            // GtkWidget* gtk_check_menu_item_new_with_mnemonic  (const gchar *label); 
    133             this(cast(GtkCheckMenuItem*)gtk_check_menu_item_new_with_mnemonic(Str.toStringz(label)) ); 
     136            p = cast(GtkCheckMenuItem*)gtk_check_menu_item_new_with_mnemonic(Str.toStringz(label)); 
    134137        } 
    135138        else 
    136139        { 
    137140            // GtkWidget* gtk_check_menu_item_new_with_label  (const gchar *label); 
    138             this(cast(GtkCheckMenuItem*)gtk_check_menu_item_new_with_label(Str.toStringz(label)) ); 
    139         } 
     141            p = cast(GtkCheckMenuItem*)gtk_check_menu_item_new_with_label(Str.toStringz(label)); 
     142        } 
     143         
     144        if(p is null) 
     145        { 
     146            throw new ConstructionException("null returned by gtk_check_menu_item_new_with_"); 
     147        } 
     148         
     149        this(p); 
    140150    } 
    141151     
  • trunk/src/gtk/ComboBox.d

    r540 r541  
    183183     * Returns: 
    184184     *  A new GtkComboBox. 
     185     * Throws: ConstructionException GTK+ fails to create the object. 
    185186     */ 
    186187    public this (bool text=true) 
    187188    { 
     189        GtkComboBox* p; 
    188190        if ( text ) 
    189191        { 
    190192            // GtkWidget* gtk_combo_box_new_text (void); 
    191             this(cast(GtkComboBox*)gtk_combo_box_new_text() ); 
     193            p = cast(GtkComboBox*)gtk_combo_box_new_text(); 
    192194        } 
    193195        else 
    194196        { 
    195197            // GtkWidget* gtk_combo_box_new (void); 
    196             this(cast(GtkComboBox*)gtk_combo_box_new() ); 
    197         } 
     198            p = cast(GtkComboBox*)gtk_combo_box_new(); 
     199        } 
     200         
     201        if(p is null) 
     202        { 
     203            throw new ConstructionException("null returned by gtk_combo_box_new"); 
     204        } 
     205         
     206        this(p); 
    198207    } 
    199208     
  • trunk/src/gtk/ComboBoxEntry.d

    r540 r541  
    145145     * Returns: 
    146146     *  A new GtkComboBoxEntry. 
     147     * Throws: ConstructionException GTK+ fails to create the object. 
    147148     */ 
    148149    public this (bool text=true) 
    149150    { 
     151        GtkComboBoxEntry* p; 
     152         
    150153        if ( text ) 
    151154        { 
    152155            // GtkWidget* gtk_combo_box_entry_new_text (void); 
    153             this(cast(GtkComboBoxEntry*)gtk_combo_box_entry_new_text() ); 
     156            p = cast(GtkComboBoxEntry*)gtk_combo_box_entry_new_text(); 
    154157        } 
    155158        else 
    156159        { 
    157160            // GtkWidget* gtk_combo_box_entry_new (void); 
    158             this(cast(GtkComboBoxEntry*)gtk_combo_box_entry_new() ); 
     161            p = cast(GtkComboBoxEntry*)gtk_combo_box_entry_new(); 
    159162        } 
    160163         
     164        if(p is null) 
     165        { 
     166            throw new ConstructionException("null returned by gtk_combo_box_entry_new"); 
     167        } 
     168         
     169        this(p); 
    161170    } 
    162171     
  • trunk/src/gtk/Expander.d

    r540 r541  
    174174     *  underscores). The first underlined character represents a keyboard 
    175175     *  accelerator called a mnemonic. 
     176     * Throws: ConstructionException GTK+ fails to create the object. 
    176177     */ 
    177178    public this (string label, bool mnemonic=true) 
    178179    { 
     180        GtkExpander* p; 
     181         
    179182        if ( mnemonic ) 
    180183        { 
    181184            // GtkWidget* gtk_expander_new_with_mnemonic (const gchar *label); 
    182             this(cast(GtkExpander*)gtk_expander_new_with_mnemonic(Str.toStringz(label)) ); 
     185            p = cast(GtkExpander*)gtk_expander_new_with_mnemonic(Str.toStringz(label)); 
    183186        } 
    184187        else 
    185188        { 
    186189            // GtkWidget* gtk_expander_new (const gchar *label); 
    187             this(cast(GtkExpander*)gtk_expander_new(Str.toStringz(label)) ); 
    188         } 
     190            p = cast(GtkExpander*)gtk_expander_new(Str.toStringz(label)); 
     191        } 
     192         
     193        if(p is null) 
     194        { 
     195            throw new ConstructionException("null returned by gtk_expander_new"); 
     196        } 
     197         
     198        this(p); 
    189199    } 
    190200     
  • trunk/src/gtk/FileChooserDialog.d

    r540 r541  
    225225     *  buttonsText = text to go in the buttons 
    226226     *  responses = response ID's for the buttons 
    227      * Returns: 
    228      *  a new GtkFileChooserDialog 
     227     * Throws: ConstructionException GTK+ fails to create the object. 
    229228     */ 
    230229    this(string title, Window parent, FileChooserAction action,  string[] buttonsText=null, ResponseType[] responses=null) 
     
    241240        } 
    242241         
    243         this( 
    244         cast(GtkFileChooserDialog*)gtk_file_chooser_dialog_new( 
     242        auto p = gtk_file_chooser_dialog_new( 
    245243        Str.toStringz(title), 
    246244        parent.getWindowStruct(), 
    247245        action, 
    248246        null, 
    249         0)); 
     247        0); 
     248         
     249        if(p is null) 
     250        { 
     251            throw new ConstructionException("null returned by gtk_file_chooser_dialog_new"); 
     252        } 
     253         
     254        this(cast(GtkFileChooserDialog*) p); 
     255         
    250256        addButtons(buttonsText, responses); 
    251257    } 
     
    264270     *  buttonsText = text to go in the buttons 
    265271     *  responses = response ID's for the buttons 
    266      * Returns: 
    267      *  a new GtkFileChooserDialog 
    268272     * See_Also: 
    269273     *  GtkFileChooser, GtkDialog 
     274     * Throws: ConstructionException GTK+ fails to create the object. 
    270275     */ 
    271276    public this (string title, Window parent, GtkFileChooserAction action, string backend,  string[] buttonsText=null, ResponseType[] responses=null) 
    272277    { 
    273278        // GtkWidget* gtk_file_chooser_dialog_new_with_backend  (const gchar *title,  GtkWindow *parent,  GtkFileChooserAction action,  const gchar *backend,  const gchar *first_button_text,  ...); 
    274         this( 
    275         cast(GtkFileChooserDialog*)gtk_file_chooser_dialog_new_with_backend( 
     279        auto p = gtk_file_chooser_dialog_new_with_backend( 
    276280        Str.toStringz(title), 
    277281        parent.getWindowStruct(), 
     
    280284        null, 
    281285        0 
    282         )); 
     286        ); 
     287         
     288        if(p is null) 
     289        { 
     290            throw new ConstructionException("null returned by gtk_file_chooser_dialog_new_with_backend"); 
     291        } 
     292         
     293        this(cast(GtkFileChooserDialog*) p); 
     294         
    283295        if ( buttonsText  is  null ) 
    284296        { 
  • trunk/src/gtk/Image.d

    r540 r541  
    202202     * Returns: 
    203203     *  a new GtkImage displaying the stock icon 
     204     * Throws: ConstructionException GTK+ fails to create the object. 
    204205     */ 
    205206    public this (StockID stockID, GtkIconSize size) 
    206207    { 
    207208        // GtkWidget* gtk_image_new_from_stock (const gchar *stock_id,  GtkIconSize size); 
    208         this(cast(GtkImage*)gtk_image_new_from_stock(Str.toStringz(StockDesc[stockID]), size) ); 
     209        auto p = gtk_image_new_from_stock(Str.toStringz(StockDesc[stockID]), size); 
     210        if(p is null) 
     211        { 
     212            throw new ConstructionException("null returned by gtk_image_new_from_stock(Str.toStringz(StockDesc[stockID]), size)"); 
     213        } 
     214        this(cast(GtkImage*)p); 
    209215    } 
    210216     
     
    219225     * Returns: 
    220226     *  a new GtkImage displaying the themed icon 
     227     * Throws: ConstructionException GTK+ fails to create the object. 
    221228     */ 
    222229    public this (string iconName, GtkIconSize size) 
    223230    { 
    224231        // GtkWidget* gtk_image_new_from_icon_name (const gchar *icon_name,  GtkIconSize size); 
    225         this(cast(GtkImage*)gtk_image_new_from_icon_name(Str.toStringz(iconName), size) ); 
     232        auto p = gtk_image_new_from_icon_name(Str.toStringz(iconName), size); 
     233        if(p is null) 
     234        { 
     235            throw new ConstructionException("null returned by gtk_image_new_from_icon_name(Str.toStringz(iconName), size)"); 
     236        } 
     237        this(cast(GtkImage*)p); 
    226238    } 
    227239     
  • trunk/src/gtk/ImageMenuItem.d

    r540 r541  
    129129     * Returns: 
    130130     *  a new GtkImageMenuItem. 
     131     * Throws: ConstructionException GTK+ fails to create the object. 
    131132     */ 
    132133    public this (string label, bool mnemonic=true) 
    133134    { 
     135        GtkImageMenuItem* p; 
     136         
    134137        if ( mnemonic ) 
    135138        { 
    136139            // GtkWidget* gtk_image_menu_item_new_with_mnemonic  (const gchar *label); 
    137             this(cast(GtkImageMenuItem*)gtk_image_menu_item_new_with_mnemonic(Str.toStringz(label)) ); 
     140            p = cast(GtkImageMenuItem*)gtk_image_menu_item_new_with_mnemonic(Str.toStringz(label)); 
    138141        } 
    139142        else 
    140143        { 
    141144            // GtkWidget* gtk_image_menu_item_new_with_label  (const gchar *label); 
    142             this(cast(GtkImageMenuItem*)gtk_image_menu_item_new_with_label(Str.toStringz(label)) ); 
    143         } 
     145            p = cast(GtkImageMenuItem*)gtk_image_menu_item_new_with_label(Str.toStringz(label)); 
     146        } 
     147         
     148        if(p is null) 
     149        { 
     150            throw new ConstructionException("null returned by gtk_image_menu_item_new_with_"); 
     151        } 
     152         
     153        this(p); 
    144154    } 
    145155     
     
    157167     * accelGroup =  the GtkAccelGroup to add the menu items accelerator to, 
    158168     *  or NULL. 
     169     * Throws: ConstructionException GTK+ fails to create the object. 
    159170     */ 
    160171    public this (StockID stockID, AccelGroup accelGroup) 
     
    164175        if(p is null) 
    165176        { 
    166             throw new Exception("Construction failure."); 
     177            throw new ConstructionException("null returned by gtk_image_menu_item_new_from_stock"); 
    167178        } 
    168179        this(cast(GtkImageMenuItem*) p); 
  • trunk/src/gtk/Label.d

    r540 r541  
    202202     *  mnemonic character 
    203203     *  mnemonic = when false uses the literal text passed in without mnemonic 
     204     * Throws: ConstructionException GTK+ fails to create the object. 
    204205     */ 
    205206    public this (string str, bool mnemonic=true) 
    206207    { 
     208        GtkLabel* p; 
     209         
    207210        if ( mnemonic ) 
    208211        { 
    209212            // GtkWidget* gtk_label_new_with_mnemonic (const gchar *str); 
    210             this(cast(GtkLabel*)gtk_label_new_with_mnemonic(Str.toStringz(str)) ); 
     213            p = cast(GtkLabel*)gtk_label_new_with_mnemonic(Str.toStringz(str)); 
    211214        } 
    212215        else 
    213216        { 
    214217            // GtkWidget* gtk_label_new (const gchar *str); 
    215             this(cast(GtkLabel*)gtk_label_new(Str.toStringz(str)) ); 
    216         } 
     218            p = cast(GtkLabel*)gtk_label_new(Str.toStringz(str)); 
     219        } 
     220         
     221        if(p is null) 
     222        { 
     223            throw new ConstructionException("null returned by gtk_label_new"); 
     224        } 
     225         
     226        this(p); 
    217227    } 
    218228     
  • trunk/src/gtk/ListStore.d

    r540 r541  
    286286     * Returns: 
    287287     *  a new GtkListStore 
     288     * Throws: ConstructionException GTK+ fails to create the object. 
    288289     */ 
    289290    public this (GType[] types) 
    290291    { 
    291292        // GtkListStore* gtk_list_store_newv (gint n_columns,  GType *types); 
    292         this(cast(GtkListStore*)gtk_list_store_newv(types.length, cast(GType*)(types.ptr)) ); 
     293        auto p = gtk_list_store_newv(types.length, cast(GType*)(types.ptr)); 
     294        if(p is null) 
     295        { 
     296            throw new ConstructionException("null returned by gtk_list_store_newv"); 
     297        } 
     298        this(cast(GtkListStore*)p); 
    293299    } 
    294300     
  • trunk/src/gtk/MenuItem.d

    r540 r541  
    191191     *  will be created using gtk_label_new_with_mnemonic(), so underscores 
    192192     *  in label indicate the mnemonic for the menu item. 
     193     * Throws: ConstructionException GTK+ fails to create the object. 
    193194     */ 
    194195    public this (string label, bool mnemonic=true) 
    195196    { 
     197        GtkMenuItem* p; 
     198         
    196199        if ( mnemonic ) 
    197200        { 
    198201            // GtkWidget* gtk_menu_item_new_with_mnemonic (const gchar *label); 
    199             this(cast(GtkMenuItem*)gtk_menu_item_new_with_mnemonic(Str.toStringz(label)) ); 
     202            p = cast(GtkMenuItem*)gtk_menu_item_new_with_mnemonic(Str.toStringz(label)); 
    200203        } 
    201204        else 
    202205        { 
    203206            // GtkWidget* gtk_menu_item_new_with_label (const gchar *label); 
    204             this(cast(GtkMenuItem*)gtk_menu_item_new_with_label(Str.toStringz(label)) ); 
    205         } 
     207            p = cast(GtkMenuItem*)gtk_menu_item_new_with_label(Str.toStringz(label)); 
     208        } 
     209         
     210        if(p is null) 
     211        { 
     212            throw new ConstructionException("null returned by gtk_menu_item_new_with_"); 
     213        } 
     214         
     215        this(p); 
     216         
    206217        setName(label); 
    207218    } 
  • trunk/src/gtk/MenuToolButton.d

    r540 r541  
    137137     *  iconWidget = a widget that will be used as icon widget, or NULL 
    138138     *  label = a string that will be used as label, or NULL 
     139     * Throws: ConstructionException GTK+ fails to create the object. 
    139140     */ 
    140141    public this(Widget iconWidget, string label) 
    141142    { 
    142143        // GtkToolItem* gtk_menu_tool_button_new (GtkWidget *icon_widget,  const gchar *label); 
    143         this( cast(GtkMenuToolButton*)gtk_menu_tool_button_new( 
    144         (iconWidget is null) ? null : iconWidget.getWidgetStruct(), 
    145         Str.toStringz(label)) 
    146         ); 
     144        auto p = gtk_menu_tool_button_new((iconWidget is null) ? null : iconWidget.getWidgetStruct(), 
     145        Str.toStringz(label)); 
     146         
     147        if(p is null) 
     148        { 
     149            throw new ConstructionException("null returned by gtk_menu_tool_button_new"); 
     150        } 
     151         
     152        this(cast(GtkMenuToolButton*) p); 
    147153    } 
    148154     
     
    154160     * Params: 
    155161     * stockID = the name of a stock item 
     162     * Throws: ConstructionException GTK+ fails to create the object. 
    156163     */ 
    157164    public this(StockID stockId) 
    158165    { 
    159166        // GtkToolItem* gtk_menu_tool_button_new_from_stock  (const gchar *stock_id); 
    160         this( 
    161         cast(GtkMenuToolButton*)gtk_menu_tool_button_new_from_stock( 
    162         Str.toStringz(StockDesc[stockId])) 
    163         ); 
     167        auto p = gtk_menu_tool_button_new_from_stock( 
     168        Str.toStringz(StockDesc[stockId])); 
     169         
     170        if(p is null) 
     171        { 
     172            throw new ConstructionException("null returned by gtk_menu_tool_button_new_from_stock"); 
     173        } 
     174         
     175        this(cast(GtkMenuToolButton*) p); 
    164176    } 
    165177     
     
    178190        if(p is null) 
    179191        { 
    180             version(Exceptions) throw new Exception("Null GObject from GTK+."); 
    181             else return null; 
     192            return null; 
    182193        } 
    183194        return new Menu(cast(GtkMenu*)p); 
  • trunk/src/gtk/MessageDialog.d

    r540 r541  
    202202     *  messageFormat = printf()-style format string, or NULL 
    203203     *  message = the message - should be null, any formatting should be done prior to call this constructor 
     204     * Throws: ConstructionException GTK+ fails to create the object. 
    204205     */ 
    205206    public this (Window parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, bool markup, string messageFormat, string message=null ) 
    206207    { 
     208        GtkMessageDialog* p; 
     209         
    207210        if ( markup ) 
    208211        { 
    209212            // GtkWidget* gtk_message_dialog_new_with_markup  (GtkWindow *parent,  GtkDialogFlags flags,  GtkMessageType type,  GtkButtonsType buttons,  const gchar *message_format,  ...); 
    210             this( 
    211             cast(GtkMessageDialog*)gtk_message_dialog_new_with_markup( 
     213            p = cast(GtkMessageDialog*)gtk_message_dialog_new_with_markup( 
    212214            parent is null ? null : parent.getWindowStruct(), 
    213215            flags, 
     
    217219            Str.toStringz(message), // this should be null 
    218220            null 
    219             ) 
    220221            ); 
    221222        } 
     
    223224        { 
    224225            // GtkWidget* gtk_message_dialog_new (GtkWindow *parent,  GtkDialogFlags flags,  GtkMessageType type,  GtkButtonsType buttons,  const gchar *message_format,  ...); 
    225             this( 
    226             cast(GtkMessageDialog*)gtk_message_dialog_new( 
     226            p = cast(GtkMessageDialog*)gtk_message_dialog_new( 
    227227            parent is null ? null : parent.getWindowStruct(), 
    228228            flags, 
     
    232232            Str.toStringz(message), // this should be null 
    233233            null 
    234             ) 
    235234            ); 
    236235        } 
     236         
     237        if(p is null) 
     238        { 
     239            throw new ConstructionException("null returned by gtk_button_new()"); 
     240        } 
     241         
     242        this(p); 
    237243    } 
    238244     
  • trunk/src/gtk/RadioButton.d

    r540 r541  
    170170     *  gtk_label_new_with_mnemonic(), so underscores in label indicate the 
    171171     *  mnemonic for the button. 
     172     * Throws: ConstructionException GTK+ fails to create the object. 
    172173     */ 
    173174    public this (ListSG group, string label, bool mnemonic=true) 
    174175    { 
     176        GtkRadioButton* p; 
     177         
    175178        if ( mnemonic ) 
    176179        { 
    177180            // GtkWidget* gtk_radio_button_new_with_mnemonic  (GSList *group,  const gchar *label); 
    178             this(cast(GtkRadioButton*)gtk_radio_button_new_with_mnemonic( 
     181            p = cast(GtkRadioButton*)gtk_radio_button_new_with_mnemonic( 
    179182            group is null ? null : group.getListSGStruct(), 
    180             Str.toStringz(label)) 
    181             ); 
     183            Str.toStringz(label)); 
    182184        } 
    183185        else 
    184186        { 
    185187            // GtkWidget* gtk_radio_button_new_with_label (GSList *group,  const gchar *label); 
    186             this(cast(GtkRadioButton*)gtk_radio_button_new_with_label( 
     188            p = cast(GtkRadioButton*)gtk_radio_button_new_with_label( 
    187189            group is null ? null : group.getListSGStruct(), 
    188             Str.toStringz(label)) 
    189             ); 
    190         } 
     190            Str.toStringz(label)); 
     191        } 
     192         
     193        if(p is null) 
     194        { 
     195            throw new ConstructionException("null returned by gtk_radio_button_new_"); 
     196        } 
     197         
     198        this(p); 
    191199    } 
    192200     
     
    200208     *  will be created using gtk_label_new_with_mnemonic(), so underscores 
    201209     *  in label indicate the mnemonic for the button. 
     210     * Throws: ConstructionException GTK+ fails to create the object. 
    202211     */ 
    203212    public this (RadioButton radioButton, string label, bool mnemonic=true) 
    204213    { 
     214        GtkRadioButton* p; 
     215         
    205216        if ( mnemonic ) 
    206217        { 
    207218            // GtkWidget* gtk_radio_button_new_with_mnemonic_from_widget  (GtkRadioButton *group,  const gchar *label); 
    208             this(cast(GtkRadioButton*)gtk_radio_button_new_with_mnemonic_from_widget( 
     219            p = cast(GtkRadioButton*)gtk_radio_button_new_with_mnemonic_from_widget( 
    209220            radioButton.getRadioButtonStruct(), 
    210             Str.toStringz(label)) 
    211             ); 
     221            Str.toStringz(label)); 
    212222        } 
    213223        else 
    214224        { 
    215225            // GtkWidget* gtk_radio_button_new_with_label_from_widget  (GtkRadioButton *group,  const gchar *label); 
    216             this(cast(GtkRadioButton*)gtk_radio_button_new_with_label_from_widget( 
     226            p = cast(GtkRadioButton*)gtk_radio_button_new_with_label_from_widget( 
    217227            radioButton.getRadioButtonStruct(), 
    218             Str.toStringz(label)) 
    219             ); 
    220         } 
     228            Str.toStringz(label)); 
     229        } 
     230         
     231        if(p is null) 
     232        { 
     233            throw new ConstructionException("null returned by gtk_radio_button_new_"); 
     234        } 
     235         
     236        this(p); 
    221237    } 
    222238     
  • trunk/src/gtk/RadioMenuItem.d

    r540 r541  
    144144     *  group = an existing GtkRadioMenuItem 
    145145     *  label = the text for the label 
     146     * Throws: ConstructionException GTK+ fails to create the object. 
    146147     */ 
    147148    public this (RadioMenuItem radioMenuItem, string label, bool mnemonic=true) 
    148149    { 
     150        GtkRadioMenuItem* p; 
     151         
    149152        if ( mnemonic ) 
    150153        { 
    151154            // GtkWidget* gtk_radio_menu_item_new_with_mnemonic_from_widget  (GtkRadioMenuItem *group,  const gchar *label); 
    152             this(cast(GtkRadioMenuItem*)gtk_radio_menu_item_new_with_mnemonic_from_widget( 
    153             radioMenuItem.getRadioMenuItemStruct(), Str.toStringz(label)) )
     155            p = cast(GtkRadioMenuItem*)gtk_radio_menu_item_new_with_mnemonic_from_widget( 
     156            radioMenuItem.getRadioMenuItemStruct(), Str.toStringz(label))
    154157        } 
    155158        else 
    156159        { 
    157160            // GtkWidget* gtk_radio_menu_item_new_with_label_from_widget  (GtkRadioMenuItem *group,  const gchar *label); 
    158             this(cast(GtkRadioMenuItem*)gtk_radio_menu_item_new_with_label_from_widget( 
    159             radioMenuItem.getRadioMenuItemStruct(), Str.toStringz(label)) ); 
    160         } 
    161     } 
    162      
    163     /** 
    164      * Creates a new GtkRadioMenuItem containing a label. T 
    165      * The new GtkRadioMenuItem is added to the same group as group. 
    166      * Since 2.4 
    167      * Params: 
    168      *  group = An existing GtkRadioMenuItem 
    169      *  label = the text of the button, with an underscore in front of the 
    170      *  mnemonic character 
    171      */ 
    172     public this (string label) 
    173     { 
     161            p = cast(GtkRadioMenuItem*)gtk_radio_menu_item_new_with_label_from_widget( 
     162            radioMenuItem.getRadioMenuItemStruct(), Str.toStringz(label)); 
     163        } 
     164         
     165        if(p is null) 
     166        { 
     167            throw new ConstructionException("null returned by gtk_radio_menu_item_new_with_"); 
     168        } 
     169         
     170        this(p); 
    174171    } 
    175172     
     
    182179     *  will be created using gtk_label_new_with_mnemonic(), so underscores 
    183180     *  in label indicate the mnemonic for the menu item. 
     181     * Throws: ConstructionException GTK+ fails to create the object. 
    184182     */ 
    185183    public this (ListSG group, string label, bool mnemonic=true) 
    186184    { 
     185        GtkRadioMenuItem* p; 
     186         
    187187        if ( mnemonic ) 
    188188        { 
    189189            // GtkWidget* gtk_radio_menu_item_new_with_mnemonic  (GSList *group,  const gchar *