On Thu, 30 Nov 2000 [EMAIL PROTECTED] wrote:
>
> Hi,
>
> Well I found a way to to it.
>
> It could be usefull for someone else.
>
> Instead of declaring the GList *SelectMGW_items = NULL in the interface.c
> file (from glade I just remove the values I put in the combo property box)
> I declared it into the main.c file.
>
> Then I used the widget_lookup function to get the pointer of SelectMGW and
> the I use the gtk_combo_set_popdown_strings (GTK_COMBO (SelectMGW),
> SelectMGW_items) function.
>
> So in my main I have :
>
> GList *SelectMGW_items = NULL;
> GtkWidget *MyWidget;
>
> MainWindow =create_MainWindow();
>
> MyWidget= lookup_widget(Mainwindow,"SelectMGW")
>
> SelectMGW_items = g_list_append (SelectMGW_items, FirstValue);
> SelectMGW_items = g_list_append (SelectMGW_items, SecondValue);
> SelectMGW_items = g_list_append (SelectMGW_items, ThirdValue);
>
> gtk_combo_set_popdown_strings (GTK_COMBO (MyWidget), SelectMGW_items);
> g_list_free (SelectMGW_items);
I think it isn't necessary to modify main.c Glade makes. You can connect
"show" signal emitted by your MainWindow and in callbacks.c you fill
MyWidget just as you described here. You have this scheme:
void on_MainWindow_show (GtkWidget *widget,gpointer data)
{
GtkWidget *MyWidget;
GList *SelectMGW_items=NULL;
MyWidget=gtk_object_get_data(GTK_OBJECT(widget),"MyWidget"); /* widget
is MainWindow */
SelectMGW_items=..... /* Instructions that you wrote in main.c */
.......
}
I hope to be useful.
Rosa
>
>
>
>
>
> philippe.vivarelli@co
>
> nexant.com To: [EMAIL PROTECTED]
>
> Sent by: cc:
>
> glade-devel-admin@hel Subject: [Glade-devel] how to
>add list item to GtkCombo widget
> ixcode.com
>
>
>
>
>
> 11/30/00 05:20 PM
>
>
>
>
>
>
>
>
>
> Hi,
>
>
> I created a Window with combo box on.
>
> Glade build the interface.c file with these declarations :
>
> GtkWidget *SelectMGW;
> GList *SelectMGW_items = NULL;
>
> and initalizations :
>
> SelectMGW = gtk_combo_new ();
> gtk_widget_ref (SelectMGW);
> gtk_object_set_data_full (GTK_OBJECT (MainWindow), "SelectMGW",
> SelectMGW,
> (GtkDestroyNotify) gtk_widget_unref);
> gtk_widget_show (SelectMGW);
> gtk_table_attach (GTK_TABLE (table1), SelectMGW, 0, 1, 0, 1,
> (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
> (GtkAttachOptions) (0), 0, 0);
>
> SelectMGW_items = g_list_append (SelectMGW_items, "First");
> SelectMGW_items = g_list_append (SelectMGW_items, "Second");
>
> gtk_combo_set_popdown_strings (GTK_COMBO (SelectMGW), SelectMGW_items);
> g_list_free (SelectMGW_items);
>
> combo_entry2 = GTK_COMBO (SelectMGW)->entry;
> gtk_widget_ref (combo_entry2);
> gtk_object_set_data_full (GTK_OBJECT (MainWindow), "combo_entry2",
> combo_entry2,
> (GtkDestroyNotify) gtk_widget_unref);
> gtk_widget_show (combo_entry2);
> gtk_entry_set_text (GTK_ENTRY (combo_entry2), "First);
>
>
>
> Now in my main.c I would like to add items to my combo box before showing
> my Main Window (The items depends on a configuration file)
>
> For now I have :
>
> MainWindow =create_MainWindow();
>
> gtk_widget_show (MainWindow);
>
> I would like to do :
>
> MainWindow =create_MainWindow();
>
> ChangeItems(MainWindow);
>
> gtk_widget_show (MainWindow);
>
>
> I understand I have to add items to the SelectMGW_items list, may be just
> like SelectMGW_items = g_list_append (SelectMGW_items, "Third");
> But from main.c I need to know the pointer SelectMGW_items.
> I tried to get it by using the lookup_widget, but it doesn't work (I gues
> because it is a Glist not a GtkWidget).
>
> So is there anybody to help me.
>
>
>
> Thanks
>
> Philippe
>
>
>
>
> _______________________________________________
> Glade-devel maillist - [EMAIL PROTECTED]
> http://lists.helixcode.com/mailman/listinfo/glade-devel
>
>
>
>
> _______________________________________________
> Glade-devel maillist - [EMAIL PROTECTED]
> http://lists.helixcode.com/mailman/listinfo/glade-devel
>
_______________________________________________
Glade-devel maillist - [EMAIL PROTECTED]
http://lists.helixcode.com/mailman/listinfo/glade-devel