[xchat-gnome/xchat-0-26-3] Bug 588400 - Migrate from libglade to GtkBuilder



commit 3c20b0a774d4c6afc0fdcc9ed20ec453e0205284
Author: Ritesh Khadgaray <khadgaray gmail com>
Date:   Mon Feb 14 20:13:29 2011 +0530

    Bug 588400 - Migrate from libglade to GtkBuilder
    
    move from glade_* to gtk_builder_*

 configure.ac                       |    2 -
 src/fe-gnome/channel-list-window.c |   40 ++++++++++++++-----------
 src/fe-gnome/channel-list-window.h |    3 +-
 src/fe-gnome/connect-dialog.c      |    6 ++--
 src/fe-gnome/dcc-window.c          |    6 ++--
 src/fe-gnome/dcc-window.h          |    1 -
 src/fe-gnome/gui.c                 |    7 ++--
 src/fe-gnome/gui.h                 |    4 +--
 src/fe-gnome/irc-network-editor.c  |    6 ++--
 src/fe-gnome/irc-network-editor.h  |    1 -
 src/fe-gnome/main-window.c         |   57 +++++++++++++++++-------------------
 src/fe-gnome/preferences-dialog.c  |    2 +-
 src/fe-gnome/setup-dialog.c        |   16 +++++-----
 src/fe-gnome/topic-label.c         |    9 ++---
 src/fe-gnome/userlist-gui.c        |    4 +-
 15 files changed, 78 insertions(+), 86 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b64d254..1c35c57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,6 @@ AM_MAINTAINER_MODE([enable])
 
 GLIB_REQUIRED=2.18.0
 GTK_REQUIRED=2.14.0
-LIBGLADE_REQUIRED=2.3.2
 GCONF_REQUIRED=2.8.0
 DBUS_REQUIRED=0.60
 DBUS_GLIB_REQUIRED=0.60
@@ -66,7 +65,6 @@ PKG_CHECK_MODULES([DEPENDENCIES], [\
                   glib-2.0 >= $GLIB_REQUIRED \
 		  gio-2.0 >= $GLIB_REQUIRED \
                   gtk+-2.0 >= $GTK_REQUIRED \
-                  libglade-2.0 >= $LIBGLADE_REQUIRED \
                   gconf-2.0 >= $GCONF_REQUIRED \
 		  libsexy >= $LIBSEXY_REQUIRED \
                   ])
diff --git a/src/fe-gnome/channel-list-window.c b/src/fe-gnome/channel-list-window.c
index 652f549..112311a 100644
--- a/src/fe-gnome/channel-list-window.c
+++ b/src/fe-gnome/channel-list-window.c
@@ -140,7 +140,7 @@ channel_list_window_refresh (ChannelListWindow *win)
 	GtkWidget *treeview;
 	GtkTreeModel *model, *store, *filter;
 
-	treeview = glade_xml_get_widget (win->xml, "channel list");
+	treeview = GTK_WIDGET (gtk_builder_get_object (win->xml, "channel list"));
 	model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
 	filter = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (model));
 	store = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (filter));
@@ -235,7 +235,7 @@ channel_list_window_join (ChannelListWindow *win)
 	GtkWidget *widget;
 	gchar *channel;
 
-	widget = glade_xml_get_widget (win->xml, "channel_entry");
+	widget = GTK_WIDGET (gtk_builder_get_object (win->xml, "channel_entry"));
 	channel = (gchar *) gtk_entry_get_text (GTK_ENTRY (widget));
 
 	win->server->p_join (win->server, channel, "");
@@ -259,7 +259,7 @@ channel_list_sensitive_join_button (ChannelListWindow *win, gboolean sensitive)
 {
 	GtkWidget *button;
 
-	button = glade_xml_get_widget (win->xml, "join button");
+	button = GTK_WIDGET (gtk_builder_get_object (win->xml, "join button"));
 	gtk_widget_set_sensitive (button, sensitive);
 }
 
@@ -301,7 +301,7 @@ channel_list_window_selected (GtkTreeSelection *selection, ChannelListWindow *wi
 	GtkTreeIter iter;
 	char *channel;
 
-	entry = glade_xml_get_widget (win->xml, "channel_entry");
+	entry = GTK_WIDGET (gtk_builder_get_object (win->xml, "channel_entry"));
 	if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
 		gtk_tree_model_get (model, &iter, 0, &channel, -1);
 		g_signal_handlers_block_by_func (G_OBJECT (entry), G_CALLBACK (channel_entry_changed), win);
@@ -402,30 +402,34 @@ channel_list_window_new (session *sess, gboolean show_list)
 	gchar *path = locate_data_file ("channel-list.glade");
 	g_assert(path != NULL);
 
-	win->xml = glade_xml_new (path, NULL, NULL);
+	win->xml = gtk_builder_new ();
+	g_assert (gtk_builder_add_from_file ( win->xml, path, NULL) != 0);
+
 	g_free (path);
 	g_assert(win->xml != NULL);
 
-	win->window = glade_xml_get_widget (win->xml, "channel_list_window");
+	win->window = GTK_WIDGET (gtk_builder_get_object (win->xml, "channel_list_window"));
+
 	gchar *title = g_strdup_printf (_("%s Channel List"), server_get_network (sess->server, FALSE));
 	gtk_window_set_title (GTK_WINDOW (win->window), title);
 	g_free (title);
 	g_signal_connect (G_OBJECT (win->window), "delete-event", G_CALLBACK (channel_list_window_delete_event), win);
 	g_signal_connect (G_OBJECT (win->window), "key-press-event", G_CALLBACK (channel_list_window_key_press), win);
 
-	widget = glade_xml_get_widget (win->xml, "channel_entry");
+	widget = GTK_WIDGET (gtk_builder_get_object (win->xml, "channel_entry"));
+
 	g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (channel_entry_changed), win);
 	g_signal_connect (G_OBJECT (widget), "activate", G_CALLBACK (channel_entry_activated), win);
 	gtk_widget_grab_focus (widget);
 	/* We simulate a change in the entry to set it at "#" */
 	channel_entry_changed (widget, win);
 
-	treeview = glade_xml_get_widget (win->xml, "channel list");
+	treeview = GTK_WIDGET (gtk_builder_get_object (win->xml, "channel list"));
 	gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview), 1);
 
-	win->refresh_button = glade_xml_get_widget (win->xml, "refresh button");
+	win->refresh_button = GTK_WIDGET (gtk_builder_get_object (win->xml, "refresh button"));
 	g_signal_connect (G_OBJECT (win->refresh_button), "clicked", G_CALLBACK (on_refresh_button_clicked), win);
-	widget = glade_xml_get_widget (win->xml, "join button");
+	widget = GTK_WIDGET (gtk_builder_get_object (win->xml, "join button"));
 	gtk_widget_set_sensitive (widget, FALSE);
 	g_signal_connect (G_OBJECT (widget), "clicked", G_CALLBACK (join_button_clicked), win);
 	g_signal_connect (G_OBJECT (treeview), "row-activated", G_CALLBACK (row_activated), win);
@@ -459,21 +463,21 @@ channel_list_window_new (session *sess, gboolean show_list)
 	gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
 	g_signal_connect (G_OBJECT (select), "changed", G_CALLBACK (channel_list_window_selected), win);
 
-	widget = glade_xml_get_widget (win->xml, "minimum users");
+	widget = GTK_WIDGET (gtk_builder_get_object (win->xml, "minimum users"));
 	g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (minusers_changed), win);
-	widget = glade_xml_get_widget (win->xml, "maximum users");
+	widget = GTK_WIDGET (gtk_builder_get_object (win->xml, "maximum users"));
 	g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (maxusers_changed), win);
-	widget = glade_xml_get_widget (win->xml, "text filter");
+	widget = GTK_WIDGET (gtk_builder_get_object (win->xml, "text filter"));
 	g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (filter_changed), win);
-	widget = glade_xml_get_widget (win->xml, "apply to topic");
+	widget = GTK_WIDGET (gtk_builder_get_object (win->xml, "apply to topic"));
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), win->filter_topic);
 	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (apply_to_topic_changed), win);
-	widget = glade_xml_get_widget (win->xml, "apply to name");
+	widget = GTK_WIDGET (gtk_builder_get_object (win->xml, "apply to name"));
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), win->filter_name);
 	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (apply_to_name_changed), win);
-	widget = glade_xml_get_widget (win->xml, "close button");
+	widget = GTK_WIDGET (gtk_builder_get_object (win->xml, "close button"));
 	g_signal_connect (G_OBJECT (widget), "clicked", G_CALLBACK (close_button_clicked), win);
-	widget = glade_xml_get_widget (win->xml, "expander");
+	widget = GTK_WIDGET (gtk_builder_get_object (win->xml, "expander"));
 	gtk_expander_set_expanded (GTK_EXPANDER (widget), show_list);
 	g_signal_connect (G_OBJECT (widget), "notify::expanded", G_CALLBACK (expander_activated), win);
 
@@ -546,7 +550,7 @@ channel_list_append (server *serv, char *channel, char *users, char *topic)
 	}
 
 	win = element->data;
-	treeview = glade_xml_get_widget (win->xml, "channel list");
+	treeview = GTK_WIDGET (gtk_builder_get_object (win->xml, "channel list"));
 	sort = GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)));
 	filter = GTK_TREE_MODEL_FILTER (gtk_tree_model_sort_get_model (sort));
 	store = GTK_LIST_STORE (gtk_tree_model_filter_get_model (filter));
diff --git a/src/fe-gnome/channel-list-window.h b/src/fe-gnome/channel-list-window.h
index 95b5e83..6ff4d2d 100644
--- a/src/fe-gnome/channel-list-window.h
+++ b/src/fe-gnome/channel-list-window.h
@@ -19,7 +19,6 @@
  *
  */
 
-#include <glade/glade.h>
 #include "../common/xchat.h"
 
 #ifndef XCHAT_GNOME_CHANNEL_LIST_WINDOW_H
@@ -42,7 +41,7 @@ struct _ChannelListWindow
 	GtkListStore *store;
 	GtkTreeModel *filter;
 	GtkTreeModelSort *sort;
-	GladeXML *xml;
+	GtkBuilder *xml;
 	struct server *server;
 	GtkWidget *window;
 	GtkWidget *refresh_button;
diff --git a/src/fe-gnome/connect-dialog.c b/src/fe-gnome/connect-dialog.c
index 22895e8..1c9c9da 100644
--- a/src/fe-gnome/connect-dialog.c
+++ b/src/fe-gnome/connect-dialog.c
@@ -135,12 +135,12 @@ connect_dialog_init (ConnectDialog *dialog)
 	gchar *path = locate_data_file ("connect-dialog.glade");
 	g_assert(path != NULL);
 
-	GladeXML *xml = glade_xml_new (path, "toplevel", NULL);
-	g_assert(xml != NULL);
+	GtkBuilder *xml =  gtk_builder_new ();
+	g_assert (gtk_builder_add_from_file ( xml, path, NULL) != 0);
 
 	g_free (path);
 
-#define GW(name) ((dialog->name) = glade_xml_get_widget (xml, #name))
+#define GW(name) ((dialog->name) = GTK_WIDGET (gtk_builder_get_object (xml, #name)))
 	GW(toplevel);
 	GW(server_list);
 #undef GW
diff --git a/src/fe-gnome/dcc-window.c b/src/fe-gnome/dcc-window.c
index 92f2026..3a8d0cc 100644
--- a/src/fe-gnome/dcc-window.c
+++ b/src/fe-gnome/dcc-window.c
@@ -82,12 +82,12 @@ dcc_window_init (DccWindow *window)
 	gchar *path = locate_data_file ("dcc-window.glade");
 	g_assert(path != NULL);
 
-	GladeXML *xml = glade_xml_new (path, "toplevel", NULL);
-	g_assert (xml != NULL);
+	GtkBuilder *xml = gtk_builder_new ();
+	g_assert (gtk_builder_add_from_file ( xml, path, NULL) != 0);
 
 	g_free (path);
 
-#define GW(name) ((window->name) = glade_xml_get_widget (xml, #name))
+#define GW(name) ((window->name) = GTK_WIDGET (gtk_builder_get_object (xml, #name)))
 	GW(transfer_list);
 	GW(stop_button);
 	GW(toplevel);
diff --git a/src/fe-gnome/dcc-window.h b/src/fe-gnome/dcc-window.h
index 9cec1db..8817b0a 100644
--- a/src/fe-gnome/dcc-window.h
+++ b/src/fe-gnome/dcc-window.h
@@ -20,7 +20,6 @@
  */
 
 #include <gtk/gtk.h>
-#include <glade/glade.h>
 #include "../common/xchat.h"
 #include "../common/dcc.h"
 #include "../common/userlist.h"
diff --git a/src/fe-gnome/gui.c b/src/fe-gnome/gui.c
index 3088c2c..f0762d9 100644
--- a/src/fe-gnome/gui.c
+++ b/src/fe-gnome/gui.c
@@ -47,8 +47,8 @@ initialize_gui_1 (void)
 	gchar *path = locate_data_file ("xchat-gnome.glade");
 	g_assert (path != NULL);
 
-	gui.xml = glade_xml_new (path, NULL, NULL);
-	g_assert(gui.xml != NULL);
+	gui.xml = gtk_builder_new ();
+	g_assert (gtk_builder_add_from_file ( gui.xml, path, NULL) != 0); 
 
 	g_free (path);
 
@@ -68,8 +68,7 @@ initialize_gui_2 (void)
 	initialize_main_window ();
 
 	gtk_container_add (
-		GTK_CONTAINER (glade_xml_get_widget (gui.xml,
-		                                     "server channel list")),
+		GTK_CONTAINER ( GTK_WIDGET (gtk_builder_get_object (gui.xml, "server channel list"))),
 		GTK_WIDGET (gui.server_tree));
 
 	gui.dcc = dcc_window_new ();
diff --git a/src/fe-gnome/gui.h b/src/fe-gnome/gui.h
index b27d8ff..38f363c 100644
--- a/src/fe-gnome/gui.h
+++ b/src/fe-gnome/gui.h
@@ -22,7 +22,6 @@
 #ifndef XCHAT_GNOME_GUI_H
 #define XCHAT_GNOME_GUI_H
 
-#include <glade/glade.h>
 #include <gtk/gtk.h>
 #include "userlist.h"
 #include "navigation-tree.h"
@@ -34,8 +33,7 @@
 
 typedef struct
 {
-	GladeXML *xml;
-	GladeXML *setup_xml;
+	GtkBuilder *xml;
 	GtkActionGroup *action_group;
 	GtkUIManager *manager;
 	PreferencesDialog *prefs_dialog;
diff --git a/src/fe-gnome/irc-network-editor.c b/src/fe-gnome/irc-network-editor.c
index 4fa132b..0bf89ba 100644
--- a/src/fe-gnome/irc-network-editor.c
+++ b/src/fe-gnome/irc-network-editor.c
@@ -264,12 +264,12 @@ irc_network_editor_init (IrcNetworkEditor *dialog)
 	gchar *path = locate_data_file ("irc-network-editor.glade");
 	g_assert (path != NULL);
 
-	GladeXML *xml = glade_xml_new (path, "toplevel", NULL);
-	g_assert (xml != NULL);
+	GtkBuilder *xml = gtk_builder_new ();
+	g_assert (gtk_builder_add_from_file ( xml, path, NULL) != 0); 
 
 	g_free (path);
 
-#define GW(name) ((dialog->name) = glade_xml_get_widget (xml, #name))
+#define GW(name) ((dialog->name) = GTK_WIDGET (gtk_builder_get_object (xml, #name)))
 	GW(network_settings_table);
 
 	GW(network_name);
diff --git a/src/fe-gnome/irc-network-editor.h b/src/fe-gnome/irc-network-editor.h
index 919b483..b04f337 100644
--- a/src/fe-gnome/irc-network-editor.h
+++ b/src/fe-gnome/irc-network-editor.h
@@ -20,7 +20,6 @@
  */
 
 #include <gtk/gtk.h>
-#include <glade/glade.h>
 #include <gconf/gconf-client.h>
 #include "irc-network.h"
 
diff --git a/src/fe-gnome/main-window.c b/src/fe-gnome/main-window.c
index 3ec7b56..1a4a6fd 100644
--- a/src/fe-gnome/main-window.c
+++ b/src/fe-gnome/main-window.c
@@ -153,7 +153,7 @@ initialize_main_window (void)
 	GConfClient *client;
 	GdkColormap *colormap;
 
-	gui.main_window = glade_xml_get_widget (gui.xml, "xchat-gnome");
+	gui.main_window = GTK_WIDGET (gtk_builder_get_object (gui.xml, "xchat-gnome"));
 
 	colormap = gdk_screen_get_rgba_colormap (gtk_widget_get_screen (gui.main_window));
 	if (colormap != NULL)
@@ -174,7 +174,7 @@ initialize_main_window (void)
 
 	gtk_ui_manager_insert_action_group (gui.manager, gui.action_group, 0);
 
-	menu_vbox = glade_xml_get_widget (gui.xml, "menu_vbox");
+	menu_vbox = GTK_WIDGET (gtk_builder_get_object (gui.xml, "menu_vbox"));
 	g_signal_connect (gui.manager, "add-widget", G_CALLBACK (on_add_widget), menu_vbox);
 
 	/* load the menus */
@@ -186,7 +186,7 @@ initialize_main_window (void)
 	/* hook up accelerators */
 	gtk_window_add_accel_group (GTK_WINDOW (gui.main_window), gtk_ui_manager_get_accel_group (gui.manager));
 
-	close = glade_xml_get_widget (gui.xml, "close discussion");
+	close = GTK_WIDGET (gtk_builder_get_object (gui.xml, "close discussion"));
 	action = gtk_action_group_get_action (gui.action_group, "DiscussionClose");
 #if GTK_CHECK_VERSION (2, 16, 0)
     gtk_activatable_set_related_action (GTK_ACTIVATABLE (close), action);
@@ -194,7 +194,7 @@ initialize_main_window (void)
     gtk_action_connect_proxy (action, close);
 #endif
 
-#define GW(name) ((gui.name) = glade_xml_get_widget (gui.xml, #name))
+#define GW(name) ((gui.name) = GTK_WIDGET (gtk_builder_get_object (gui.xml, #name)))
 	GW(conversation_panel);
 	GW(find_bar);
 	GW(status_bar);
@@ -229,12 +229,12 @@ initialize_main_window (void)
 
 	/* Size group between users button and entry field */
 	group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
-	gui.userlist_toggle = glade_xml_get_widget (gui.xml, "userlist_toggle");
+	gui.userlist_toggle = GTK_WIDGET (gtk_builder_get_object (gui.xml, "userlist_toggle"));
 	g_signal_connect (G_OBJECT (gui.userlist_toggle), "toggled", G_CALLBACK (on_users_toggled), NULL);
 
 	gtk_button_set_image (GTK_BUTTON (gui.userlist_toggle), gtk_image_new_from_icon_name ("xchat-gnome-users", GTK_ICON_SIZE_MENU));
 	gtk_size_group_add_widget (group, gui.userlist_toggle);
-	widget = glade_xml_get_widget (gui.xml, "entry hbox");
+	widget = GTK_WIDGET (gtk_builder_get_object (gui.xml, "entry hbox"));
 	gtk_size_group_add_widget (group, widget);
 	g_object_unref (group);
 
@@ -280,13 +280,13 @@ run_main_window (gboolean fullscreen)
 	                             "/apps/xchat/main_window/hpane",
 	                             NULL);
 	if (h != 0) {
-		GtkWidget *hpane = glade_xml_get_widget(gui.xml, "HPane");
+		GtkWidget *hpane = GTK_WIDGET (gtk_builder_get_object (gui.xml, "HPane"));
 		gtk_paned_set_position(GTK_PANED(hpane), h);
 	}
 	g_signal_connect(G_OBJECT(gui.main_window), "configure-event",
 	                 G_CALLBACK(on_resize), NULL);
 
-	GtkWidget *pane = glade_xml_get_widget (gui.xml, "HPane");
+	GtkWidget *pane = GTK_WIDGET (gtk_builder_get_object (gui.xml, "HPane"));
 	g_signal_connect(G_OBJECT(pane), "notify::position",
 	                 G_CALLBACK(on_hpane_move), NULL);
 
@@ -560,7 +560,7 @@ on_sidebar_toggled (GtkToggleAction *action, gpointer data)
 	                      NULL);
 	g_object_unref(client);
 
-	paned = glade_xml_get_widget(gui.xml, "HPane");
+	paned = GTK_WIDGET (gtk_builder_get_object (gui.xml, "HPane"));
 	child = gtk_paned_get_child1(GTK_PANED(paned));
 
 	if (gtk_toggle_action_get_active(action)) {
@@ -612,9 +612,9 @@ on_nickname_clicked (GtkButton *widget, gpointer user_data)
 	}
 	current_sess = gui.current_session;
 
-	GtkWidget *dialog = glade_xml_get_widget (gui.xml, "nickname dialog");
-	GtkWidget *entry = glade_xml_get_widget (gui.xml, "nickname dialog entry");
-	GtkWidget *away_button = glade_xml_get_widget (gui.xml, "nickname dialog away");
+	GtkWidget *dialog = GTK_WIDGET (gtk_builder_get_object (gui.xml, "nickname dialog"));
+	GtkWidget *entry = GTK_WIDGET (gtk_builder_get_object (gui.xml, "nickname dialog entry"));
+	GtkWidget *away_button = GTK_WIDGET (gtk_builder_get_object (gui.xml, "nickname dialog away"));
 
 	gtk_entry_set_text(GTK_ENTRY(entry), current_sess->server->nick);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(away_button), current_sess->server->is_away);
@@ -626,7 +626,7 @@ on_nickname_clicked (GtkButton *widget, gpointer user_data)
 		gboolean all;
 		gchar *text, *buf;
 
-		check_all = glade_xml_get_widget(gui.xml, "nickname dialog all");
+		check_all = GTK_WIDGET (gtk_builder_get_object (gui.xml, "nickname dialog all"));
 		all = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (check_all));
 
 		/* Nick */
@@ -808,27 +808,24 @@ nickname_style_set (GtkWidget *button, GtkStyle *previous_style, gpointer data)
 static void
 main_window_userlist_location_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
 {
-    GConfValue *value = gconf_entry_get_value (entry);
-    main_window_set_show_userlist (gconf_value_get_bool (value));
+	GConfValue *value = gconf_entry_get_value (entry);
+	main_window_set_show_userlist (gconf_value_get_bool (value));
 }
 
 void
 main_window_set_show_userlist (gboolean show_in_main_window)
 {
-    GtkAction *discussion_users = gtk_ui_manager_get_action (gui.manager, "/menubar/DiscussionMenu/DiscussionUsers");
+	GtkAction *discussion_users = gtk_ui_manager_get_action (gui.manager, "/menubar/DiscussionMenu/DiscussionUsers");
     
-    if (show_in_main_window)
-    {
-        gtk_widget_hide (gui.userlist_toggle);
-        gtk_widget_show (glade_xml_get_widget (gui.xml, "scrolledwindow_userlist_main"));
-        gtk_widget_reparent (GTK_WIDGET (gui.userlist), glade_xml_get_widget (gui.xml, "scrolledwindow_userlist_main"));      
-        gtk_action_set_visible (discussion_users, FALSE);                        
-    }
-    else
-    {
-        gtk_widget_show (gui.userlist_toggle);
-        gtk_widget_hide (glade_xml_get_widget (gui.xml, "scrolledwindow_userlist_main"));
-        gtk_widget_reparent (GTK_WIDGET (gui.userlist), glade_xml_get_widget (gui.xml, "scrolledwindow_userlist"));                              
-        gtk_action_set_visible (discussion_users, TRUE);                        
-    }
+	if (show_in_main_window) {
+		gtk_widget_hide (gui.userlist_toggle);
+		gtk_widget_show (GTK_WIDGET (gtk_builder_get_object  (gui.xml, "scrolledwindow_userlist_main")));
+		gtk_widget_reparent (GTK_WIDGET (gui.userlist), GTK_WIDGET (gtk_builder_get_object (gui.xml, "scrolledwindow_userlist_main")));
+		gtk_action_set_visible (discussion_users, FALSE);
+	} else {
+		gtk_widget_show (gui.userlist_toggle);
+		gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (gui.xml, "scrolledwindow_userlist_main") ));
+		gtk_widget_reparent (GTK_WIDGET (gui.userlist), GTK_WIDGET (gtk_builder_get_object (gui.xml, "scrolledwindow_userlist") ));
+		gtk_action_set_visible (discussion_users, TRUE);
+	}
 }
diff --git a/src/fe-gnome/preferences-dialog.c b/src/fe-gnome/preferences-dialog.c
index 06a1b11..b8afb57 100644
--- a/src/fe-gnome/preferences-dialog.c
+++ b/src/fe-gnome/preferences-dialog.c
@@ -140,7 +140,7 @@ preferences_dialog_add_page (PreferencesDialog *p, PreferencesPage *page)
 	gint pos;
 	GtkTreeIter iter;
 
-	/* If the page has is own vbox, widgets are not in the glade files and so have to be
+	/* If the page has is own vbox, widgets are not in the gtkbuilder files and so have to be
 	 * added into the notebook */
 	if (page->vbox) {
 		pos = gtk_notebook_append_page (GTK_NOTEBOOK (p->settings_notebook), page->vbox, NULL);
diff --git a/src/fe-gnome/setup-dialog.c b/src/fe-gnome/setup-dialog.c
index 3a3e7c3..3e8b3b8 100644
--- a/src/fe-gnome/setup-dialog.c
+++ b/src/fe-gnome/setup-dialog.c
@@ -22,7 +22,6 @@
 #include <config.h>
 #include <glib/gi18n.h>
 #include <gconf/gconf-client.h>
-#include <glade/glade-xml.h>
 #include <gtk/gtk.h>
 #include <string.h>
 #include "setup-dialog.h"
@@ -42,14 +41,16 @@ void run_setup_dialog (void)
 	gchar *path = locate_data_file ("setup-dialog.glade");
 	g_assert (path != NULL);
 
-	GladeXML *xml = glade_xml_new (path, NULL, NULL);
-	g_assert (xml != NULL);
+	GtkBuilder *xml = gtk_builder_new ();
+	g_assert (gtk_builder_add_from_file ( xml, path, NULL) != 0); 
 
-	GtkWidget *window = glade_xml_get_widget (xml, "setup window");
+	g_free (path);
+
+	GtkWidget *window = GTK_WIDGET (gtk_builder_get_object (xml,"setup window"));
 
 	GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-	nick_entry = glade_xml_get_widget (xml, "nick name entry");
-	real_entry = glade_xml_get_widget (xml, "real name entry");
+	nick_entry = GTK_WIDGET (gtk_builder_get_object (xml, "nick name entry"));
+	real_entry = GTK_WIDGET (gtk_builder_get_object (xml, "real name entry"));
 	gtk_size_group_add_widget (group, nick_entry);
 	gtk_size_group_add_widget (group, real_entry);
 	g_signal_connect (G_OBJECT (nick_entry), "changed", G_CALLBACK (entry_changed), NULL);
@@ -60,7 +61,7 @@ void run_setup_dialog (void)
 	gtk_entry_set_text (GTK_ENTRY (real_entry), g_get_real_name ());
 	gtk_widget_grab_focus (nick_entry);
 
-	ok_button = glade_xml_get_widget (xml, "ok button");
+	ok_button = GTK_WIDGET (gtk_builder_get_object (xml, "ok button"));
 	g_signal_connect (G_OBJECT (ok_button), "clicked", G_CALLBACK (ok_clicked), NULL);
 
 	gtk_widget_show_all (window);
@@ -70,7 +71,6 @@ void run_setup_dialog (void)
 	}
 
 	g_object_unref (xml);
-	g_free (path);
 	gtk_widget_destroy (window);
 }
 
diff --git a/src/fe-gnome/topic-label.c b/src/fe-gnome/topic-label.c
index 03b811c..4d6e448 100644
--- a/src/fe-gnome/topic-label.c
+++ b/src/fe-gnome/topic-label.c
@@ -21,7 +21,6 @@
 #include <config.h>
 #include <string.h>
 #include <gtk/gtk.h>
-#include <glade/glade.h>
 #if !GTK_CHECK_VERSION(2,17,1)
 #include <libsexy/sexy-url-label.h>
 #endif
@@ -270,13 +269,13 @@ topic_label_change_current (TopicLabel *label)
 	gchar *path = locate_data_file ("topic-change.glade");
 	g_assert (path != NULL);
 
-	GladeXML *xml = glade_xml_new (path, NULL, NULL);
-	g_assert (xml != NULL);
+	GtkBuilder *xml = gtk_builder_new ();
+	g_assert (gtk_builder_add_from_file ( xml, path, NULL) != 0); 
 
 	g_free (path);
 
-	GtkWidget *dialog = glade_xml_get_widget (xml, "topic change");
-        GtkWidget *entry  = glade_xml_get_widget (xml, "topic entry box");
+	GtkWidget *dialog = GTK_WIDGET (gtk_builder_get_object (xml, "topic change"));
+        GtkWidget *entry  = GTK_WIDGET (gtk_builder_get_object (xml, "topic entry box"));
 
 	gchar *title = g_strdup_printf (_("Changing topic for %s"), priv->current->channel);
 	gtk_window_set_title (GTK_WINDOW (dialog), title);
diff --git a/src/fe-gnome/userlist-gui.c b/src/fe-gnome/userlist-gui.c
index 3e1dd66..f062e6b 100644
--- a/src/fe-gnome/userlist-gui.c
+++ b/src/fe-gnome/userlist-gui.c
@@ -81,9 +81,9 @@ initialize_userlist (void)
 
 	gui.userlist = gtk_tree_view_new ();
 	gtk_widget_show (gui.userlist);
-	gui.userlist_window = glade_xml_get_widget (gui.xml, "userlist_window");
+	gui.userlist_window = GTK_WIDGET (gtk_builder_get_object (gui.xml, "userlist_window"));
 
-	swin = glade_xml_get_widget (gui.xml, "scrolledwindow_userlist");
+	swin = GTK_WIDGET (gtk_builder_get_object (gui.xml, "scrolledwindow_userlist"));
 	gtk_container_add (GTK_CONTAINER (swin), gui.userlist);
 
 	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (gui.userlist), FALSE);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]