From 5cf753b1020ce4860bdb1d8ed1319c49c4e696ee Mon Sep 17 00:00:00 2001 From: Felix Riemann Date: Wed, 15 Jul 2009 21:55:09 +0200 Subject: [network] Remove libglade dependency from gnome-network-properties --- capplets/network/Makefile.am | 6 +- capplets/network/gnome-network-properties.c | 301 +++-- capplets/network/gnome-network-properties.glade | 1472 ----------------------- capplets/network/gnome-network-properties.ui | 1023 ++++++++++++++++ po/POTFILES.in | 2 +- 5 files changed, 1210 insertions(+), 1594 deletions(-) delete mode 100644 capplets/network/gnome-network-properties.glade create mode 100644 capplets/network/gnome-network-properties.ui diff --git a/capplets/network/Makefile.am b/capplets/network/Makefile.am index f4f6cf927..1ec55715c 100644 --- a/capplets/network/Makefile.am +++ b/capplets/network/Makefile.am @@ -8,8 +8,8 @@ gnome_network_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS) @INTLTOOL_DESKTOP_RULE@ -gladedir = $(pkgdatadir)/glade -dist_glade_DATA = gnome-network-properties.glade +uidir = $(pkgdatadir)/ui +dist_ui_DATA = gnome-network-properties.ui icons16dir = $(datadir)/icons/hicolor/16x16/apps dist_icons16_DATA = icons/16x16/gnome-network-properties.png @@ -31,7 +31,7 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) INCLUDES = \ $(GNOMECC_CAPPLETS_CFLAGS) \ -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ - -DGNOMECC_GLADE_DIR="\"$(pkgdatadir)/glade\"" + -DGNOMECC_UI_DIR="\"$(uidir)\"" gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor uninstall-hook: update-icon-cache diff --git a/capplets/network/gnome-network-properties.c b/capplets/network/gnome-network-properties.c index f6ea0e642..d8741466f 100644 --- a/capplets/network/gnome-network-properties.c +++ b/capplets/network/gnome-network-properties.c @@ -24,9 +24,9 @@ # include #endif +#include #include #include -#include #include #include "capplet-util.h" @@ -77,6 +77,8 @@ enum { #define LOCATION_DIR "/apps/control-center/network" #define CURRENT_LOCATION "/apps/control-center/network/current_location" +#define GNOMECC_GNP_UI_FILE (GNOMECC_UI_DIR "/gnome-network-properties.ui") + static GtkWidget *details_dialog = NULL; static GSList *ignore_hosts = NULL; static GtkTreeModel *model = NULL; @@ -125,19 +127,27 @@ config_treeview(GtkTreeView *tree, GtkTreeModel *model) return GTK_WIDGET(tree); } +static GtkWidget* +_gtk_builder_get_widget (GtkBuilder *builder, const gchar *name) +{ + return GTK_WIDGET (gtk_builder_get_object (builder, name)); +} + + static void cb_add_url (GtkButton *button, gpointer data) { - GladeXML *dialog = (GladeXML *) data; + GtkBuilder *builder = GTK_BUILDER (data); gchar *new_url = NULL; GConfClient *client; - new_url = g_strdup(gtk_entry_get_text(GTK_ENTRY(WID("entry_url")))); + new_url = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (builder, "entry_url")))); if (strlen (new_url) == 0) return; ignore_hosts = g_slist_append(ignore_hosts, new_url); populate_listmodel(GTK_LIST_STORE(model), ignore_hosts); - gtk_entry_set_text(GTK_ENTRY(WID("entry_url")), ""); + gtk_entry_set_text(GTK_ENTRY (gtk_builder_get_object (builder, + "entry_url")), ""); client = gconf_client_get_default (); gconf_client_set_list (client, IGNORE_HOSTS_KEY, GCONF_VALUE_STRING, ignore_hosts, NULL); @@ -147,12 +157,12 @@ cb_add_url (GtkButton *button, gpointer data) static void cb_remove_url (GtkButton *button, gpointer data) { - GladeXML *dialog = (GladeXML *) data; + GtkBuilder *builder = GTK_BUILDER (data); GtkTreeSelection *selection; GtkTreeIter iter; GConfClient *client; - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(WID("treeview_ignore_host"))); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (builder, "treeview_ignore_host"))); if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gchar *url; @@ -221,7 +231,9 @@ static void cb_http_details_button_clicked (GtkWidget *button, GtkWidget *parent) { - GladeXML *dialog; + GtkBuilder *builder; + gchar *builder_widgets[] = { "details_dialog", NULL }; + GError *error = NULL; GtkWidget *widget; GConfPropertyEditor *peditor; @@ -231,28 +243,38 @@ cb_http_details_button_clicked (GtkWidget *button, return; } - dialog = glade_xml_new (GNOMECC_GLADE_DIR "/gnome-network-properties.glade", - "details_dialog", NULL); + builder = gtk_builder_new (); + if (gtk_builder_add_objects_from_file (builder, GNOMECC_GNP_UI_FILE, + builder_widgets, &error) == 0) { + g_warning ("Could not load details dialog: %s", error->message); + g_error_free (error); + g_object_unref (builder); + return; + } - details_dialog = widget = WID ("details_dialog"); + details_dialog = widget = _gtk_builder_get_widget (builder, + "details_dialog"); gtk_window_set_transient_for (GTK_WINDOW (widget), GTK_WINDOW (parent)); - gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (WID ("use_auth_checkbutton"))->child), TRUE); + gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (gtk_builder_get_object (builder, "use_auth_checkbutton"))->child), TRUE); - g_signal_connect (G_OBJECT (WID ("use_auth_checkbutton")), + g_signal_connect (gtk_builder_get_object (builder, "use_auth_checkbutton"), "toggled", G_CALLBACK (cb_use_auth_toggled), - WID ("auth_table")); + _gtk_builder_get_widget (builder, "auth_table")); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_boolean ( - NULL, HTTP_USE_AUTH_KEY, WID ("use_auth_checkbutton"), + NULL, HTTP_USE_AUTH_KEY, + _gtk_builder_get_widget (builder, "use_auth_checkbutton"), NULL)); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string ( - NULL, HTTP_AUTH_USER_KEY, WID ("username_entry"), + NULL, HTTP_AUTH_USER_KEY, + _gtk_builder_get_widget (builder, "username_entry"), NULL)); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string ( - NULL, HTTP_AUTH_PASSWD_KEY, WID ("password_entry"), + NULL, HTTP_AUTH_PASSWD_KEY, + _gtk_builder_get_widget (builder, "password_entry"), NULL)); g_signal_connect (widget, "response", @@ -583,17 +605,17 @@ location_combo_separator (GtkTreeModel *model, static void update_locations (GConfClient *client, - GladeXML *dialog); + GtkBuilder *builder); static void cb_location_changed (GtkWidget *location, - GladeXML *dialog); + GtkBuilder *builder); static void cb_current_location (GConfClient *client, guint cnxn_id, GConfEntry *entry, - GladeXML *dialog) + GtkBuilder *builder) { GConfValue *value; const gchar *newval; @@ -608,20 +630,20 @@ cb_current_location (GConfClient *client, /* prevent the current settings from being saved by blocking * the signal handler */ - g_signal_handlers_block_by_func (WID ("location_combobox"), - cb_location_changed, dialog); - update_locations (client, dialog); - g_signal_handlers_unblock_by_func (WID ("location_combobox"), - cb_location_changed, dialog); + g_signal_handlers_block_by_func (gtk_builder_get_object (builder, "location_combobox"), + cb_location_changed, builder); + update_locations (client, builder); + g_signal_handlers_unblock_by_func (gtk_builder_get_object (builder, "location_combobox"), + cb_location_changed, builder); } static void update_locations (GConfClient *client, - GladeXML *dialog) + GtkBuilder *builder) { int i, select; gchar *current; - GtkComboBox *location = GTK_COMBO_BOX (WID ("location_combobox")); + GtkComboBox *location = GTK_COMBO_BOX (gtk_builder_get_object (builder, "location_combobox")); GSList *list = gconf_client_all_dirs (client, LOCATION_DIR, NULL); GtkTreeIter titer; GtkListStore *store; @@ -665,7 +687,9 @@ update_locations (GConfClient *client, COL_STYLE, PANGO_STYLE_NORMAL, -1); select = i++; } - gtk_widget_set_sensitive (WID ("delete_button"), i > 1); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, + "delete_button"), + i > 1); gtk_list_store_append (store, &titer); gtk_list_store_set (store, &titer, @@ -685,7 +709,7 @@ update_locations (GConfClient *client, } static void -cb_location_new_text_changed (GtkEntry *entry, GladeXML *dialog) +cb_location_new_text_changed (GtkEntry *entry, GtkBuilder *builder) { gboolean exists; gchar *current, *esc, *key; @@ -712,17 +736,24 @@ cb_location_new_text_changed (GtkEntry *entry, GladeXML *dialog) g_object_unref (client); if (exists) - gtk_widget_show (WID ("error_label")); + gtk_widget_show (_gtk_builder_get_widget (builder, + "error_label")); else - gtk_widget_hide (WID ("error_label")); + gtk_widget_hide (_gtk_builder_get_widget (builder, + "error_label")); - gtk_widget_set_sensitive (WID ("new_location"), !exists); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, + "new_location"), + !exists); } static void -location_new (GladeXML *capplet, GtkWidget *parent) +location_new (GtkBuilder *capplet_builder, GtkWidget *parent) { - GladeXML *dialog; + GtkBuilder *builder; + GError *error = NULL; + gchar *builder_widgets[] = { "location_new_dialog", + "new_location_btn_img", NULL }; GtkWidget *askdialog; const gchar *name; int response; @@ -730,20 +761,25 @@ location_new (GladeXML *capplet, GtkWidget *parent) client = gconf_client_get_default (); - dialog = glade_xml_new (GNOMECC_GLADE_DIR "/gnome-network-properties.glade", - "location_new_dialog", NULL); + builder = gtk_builder_new (); + if (gtk_builder_add_objects_from_file (builder, GNOMECC_GNP_UI_FILE, + builder_widgets, &error) == 0) { + g_warning ("Could not load location dialog: %s", + error->message); + g_error_free (error); + g_object_unref (builder); + return; + } - gtk_button_set_image (GTK_BUTTON (WID ("new_location")), - gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON)); - askdialog = WID ("location_new_dialog"); + askdialog = _gtk_builder_get_widget (builder, "location_new_dialog"); gtk_window_set_transient_for (GTK_WINDOW (askdialog), GTK_WINDOW (parent)); g_signal_connect (askdialog, "response", G_CALLBACK (gtk_widget_hide), NULL); - g_signal_connect (WID ("text"), "changed", - G_CALLBACK (cb_location_new_text_changed), dialog); + g_signal_connect (gtk_builder_get_object (builder, "text"), "changed", + G_CALLBACK (cb_location_new_text_changed), builder); response = gtk_dialog_run (GTK_DIALOG (askdialog)); - name = gtk_entry_get_text (GTK_ENTRY (WID ("text"))); - g_object_unref (dialog); + name = gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (builder, "text"))); + g_object_unref (builder); if (response == GTK_RESPONSE_OK && name[0] != '\0') { @@ -771,7 +807,7 @@ location_new (GladeXML *capplet, GtkWidget *parent) g_free (key); gconf_client_set_string (client, CURRENT_LOCATION, name, NULL); - update_locations (client, capplet); + update_locations (client, capplet_builder); } else { @@ -798,7 +834,7 @@ location_new (GladeXML *capplet, GtkWidget *parent) static void cb_location_changed (GtkWidget *location, - GladeXML *dialog) + GtkBuilder *builder) { gchar *current; gchar *name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (location)); @@ -815,7 +851,7 @@ cb_location_changed (GtkWidget *location, { if (strcmp (name, _("New Location...")) == 0) { - location_new (dialog, WID ("network_dialog")); + location_new (builder, _gtk_builder_get_widget (builder, "network_dialog")); } else { @@ -850,19 +886,20 @@ cb_location_changed (GtkWidget *location, static void cb_delete_button_clicked (GtkWidget *button, - GladeXML *dialog) + GtkBuilder *builder) { GConfClient *client; - GtkComboBox *box = GTK_COMBO_BOX (WID ("location_combobox")); + GtkComboBox *box = GTK_COMBO_BOX (gtk_builder_get_object (builder, + "location_combobox")); int active = gtk_combo_box_get_active (box); gchar *current, *key, *esc; /* prevent the current settings from being saved by blocking * the signal handler */ - g_signal_handlers_block_by_func (box, cb_location_changed, dialog); + g_signal_handlers_block_by_func (box, cb_location_changed, builder); gtk_combo_box_set_active (box, (active == 0) ? 1 : 0); gtk_combo_box_remove_text (box, active); - g_signal_handlers_unblock_by_func (box, cb_location_changed, dialog); + g_signal_handlers_unblock_by_func (box, cb_location_changed, builder); /* set the new location */ client = gconf_client_get_default (); @@ -887,7 +924,7 @@ cb_delete_button_clicked (GtkWidget *button, static void cb_use_same_proxy_checkbutton_clicked (GtkWidget *checkbutton, - GladeXML *dialog) + GtkBuilder *builder) { GConfClient *client; gboolean same_proxy; @@ -954,12 +991,24 @@ cb_use_same_proxy_checkbutton_clicked (GtkWidget *checkbutton, } /* Set the proxy entries insensitive if we are using the same proxy for all */ - gtk_widget_set_sensitive (WID ("secure_host_entry"), !same_proxy); - gtk_widget_set_sensitive (WID ("secure_port_spinbutton"), !same_proxy); - gtk_widget_set_sensitive (WID ("ftp_host_entry"), !same_proxy); - gtk_widget_set_sensitive (WID ("ftp_port_spinbutton"), !same_proxy); - gtk_widget_set_sensitive (WID ("socks_host_entry"), !same_proxy); - gtk_widget_set_sensitive (WID ("socks_port_spinbutton"), !same_proxy); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, + "secure_host_entry"), + !same_proxy); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, + "secure_port_spinbutton"), + !same_proxy); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, + "ftp_host_entry"), + !same_proxy); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, + "ftp_port_spinbutton"), + !same_proxy); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, + "socks_host_entry"), + !same_proxy); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, + "socks_port_spinbutton"), + !same_proxy); g_object_unref (client); } @@ -1020,7 +1069,7 @@ extract_proxy_host (GConfPropertyEditor *peditor, const GConfValue *orig) static void proxy_mode_radiobutton_clicked_cb (GtkWidget *widget, - GladeXML *dialog) + GtkBuilder *builder) { GSList *mode_group; int mode; @@ -1030,16 +1079,16 @@ proxy_mode_radiobutton_clicked_cb (GtkWidget *widget, return; mode_group = g_slist_copy (gtk_radio_button_get_group - (GTK_RADIO_BUTTON (WID ("none_radiobutton")))); + (GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "none_radiobutton")))); mode_group = g_slist_reverse (mode_group); mode = g_slist_index (mode_group, widget); g_slist_free (mode_group); - gtk_widget_set_sensitive (WID ("manual_box"), + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, "manual_box"), mode == PROXYMODE_MANUAL); - gtk_widget_set_sensitive (WID ("same_proxy_checkbutton"), + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, "same_proxy_checkbutton"), mode == PROXYMODE_MANUAL); - gtk_widget_set_sensitive (WID ("auto_box"), + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, "auto_box"), mode == PROXYMODE_AUTO); client = gconf_client_get_default (); gconf_client_set_bool (client, USE_PROXY_KEY, @@ -1048,18 +1097,18 @@ proxy_mode_radiobutton_clicked_cb (GtkWidget *widget, } static void -connect_sensitivity_signals (GladeXML *dialog, GSList *mode_group) +connect_sensitivity_signals (GtkBuilder *builder, GSList *mode_group) { for (; mode_group != NULL; mode_group = mode_group->next) { g_signal_connect (G_OBJECT (mode_group->data), "clicked", G_CALLBACK(proxy_mode_radiobutton_clicked_cb), - dialog); + builder); } } static void -setup_dialog (GladeXML *dialog) +setup_dialog (GtkBuilder *builder) { GConfPropertyEditor *peditor; GSList *mode_group; @@ -1078,19 +1127,16 @@ setup_dialog (GladeXML *dialog) client = gconf_client_get_default (); /* Locations */ - location_box = WID ("location_combobox"); + location_box = _gtk_builder_get_widget (builder, "location_combobox"); store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT); gtk_combo_box_set_model (GTK_COMBO_BOX (location_box), GTK_TREE_MODEL (store)); - update_locations (client, dialog); + update_locations (client, builder); gconf_client_add_dir (client, LOCATION_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - gconf_client_notify_add (client, CURRENT_LOCATION, (GConfClientNotifyFunc) cb_current_location, dialog, NULL, NULL); + gconf_client_notify_add (client, CURRENT_LOCATION, (GConfClientNotifyFunc) cb_current_location, builder, NULL, NULL); - g_signal_connect (location_box, "changed", G_CALLBACK (cb_location_changed), dialog); - g_signal_connect (WID ("delete_button"), "clicked", G_CALLBACK (cb_delete_button_clicked), dialog); - - gtk_button_set_image (GTK_BUTTON (WID ("delete_button")), - gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON)); + g_signal_connect (location_box, "changed", G_CALLBACK (cb_location_changed), builder); + g_signal_connect (gtk_builder_get_object (builder, "delete_button"), "clicked", G_CALLBACK (cb_delete_button_clicked), builder); location_renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (location_box), location_renderer, TRUE); @@ -1100,13 +1146,13 @@ setup_dialog (GladeXML *dialog) "style", COL_STYLE, NULL); /* Hackety hack */ - gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (WID ("none_radiobutton"))->child), TRUE); - gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (WID ("manual_radiobutton"))->child), TRUE); - gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (WID ("auto_radiobutton"))->child), TRUE); + gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (gtk_builder_get_object (builder, "none_radiobutton"))->child), TRUE); + gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (gtk_builder_get_object (builder, "manual_radiobutton"))->child), TRUE); + gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (gtk_builder_get_object (builder, "auto_radiobutton"))->child), TRUE); /* Mode */ - mode_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("none_radiobutton"))); - connect_sensitivity_signals (dialog, mode_group); + mode_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "none_radiobutton"))); + connect_sensitivity_signals (builder, mode_group); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_select_radio_with_enum (NULL, PROXY_MODE_KEY, mode_group, mode_type, @@ -1114,101 +1160,112 @@ setup_dialog (GladeXML *dialog) /* Use same proxy for all protocols */ peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_boolean (NULL, - USE_SAME_PROXY_KEY, WID ("same_proxy_checkbutton"), NULL)); + USE_SAME_PROXY_KEY, _gtk_builder_get_widget (builder, "same_proxy_checkbutton"), NULL)); - g_signal_connect (G_OBJECT (WID ("same_proxy_checkbutton")), + g_signal_connect (gtk_builder_get_object (builder, "same_proxy_checkbutton"), "toggled", G_CALLBACK (cb_use_same_proxy_checkbutton_clicked), - dialog); + builder); /* Http */ port_value = gconf_client_get_int (client, HTTP_PROXY_PORT_KEY, NULL); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (WID ("http_port_spinbutton")), (gdouble) port_value); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "http_port_spinbutton")), (gdouble) port_value); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string ( - NULL, HTTP_PROXY_HOST_KEY, WID ("http_host_entry"), + NULL, HTTP_PROXY_HOST_KEY, _gtk_builder_get_widget (builder, "http_host_entry"), "conv-from-widget-cb", extract_proxy_host, NULL)); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_integer ( - NULL, HTTP_PROXY_PORT_KEY, WID ("http_port_spinbutton"), + NULL, HTTP_PROXY_PORT_KEY, + _gtk_builder_get_widget (builder, "http_port_spinbutton"), NULL)); - g_signal_connect (G_OBJECT (WID ("details_button")), + g_signal_connect (gtk_builder_get_object (builder, "details_button"), "clicked", G_CALLBACK (cb_http_details_button_clicked), - WID ("network_dialog")); + _gtk_builder_get_widget (builder, "network_dialog")); /* Secure */ port_value = gconf_client_get_int (client, SECURE_PROXY_PORT_KEY, NULL); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (WID ("secure_port_spinbutton")), (gdouble) port_value); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "secure_port_spinbutton")), (gdouble) port_value); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string ( - NULL, SECURE_PROXY_HOST_KEY, WID ("secure_host_entry"), + NULL, SECURE_PROXY_HOST_KEY, + _gtk_builder_get_widget (builder, "secure_host_entry"), "conv-from-widget-cb", extract_proxy_host, NULL)); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_integer ( - NULL, SECURE_PROXY_PORT_KEY, WID ("secure_port_spinbutton"), + NULL, SECURE_PROXY_PORT_KEY, + _gtk_builder_get_widget (builder, "secure_port_spinbutton"), NULL)); /* Ftp */ port_value = gconf_client_get_int (client, FTP_PROXY_PORT_KEY, NULL); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (WID ("ftp_port_spinbutton")), (gdouble) port_value); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "ftp_port_spinbutton")), (gdouble) port_value); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string ( - NULL, FTP_PROXY_HOST_KEY, WID ("ftp_host_entry"), + NULL, FTP_PROXY_HOST_KEY, + _gtk_builder_get_widget (builder, "ftp_host_entry"), "conv-from-widget-cb", extract_proxy_host, NULL)); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_integer ( - NULL, FTP_PROXY_PORT_KEY, WID ("ftp_port_spinbutton"), + NULL, FTP_PROXY_PORT_KEY, + _gtk_builder_get_widget (builder, "ftp_port_spinbutton"), NULL)); /* Socks */ port_value = gconf_client_get_int (client, SOCKS_PROXY_PORT_KEY, NULL); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (WID ("socks_port_spinbutton")), (gdouble) port_value); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "socks_port_spinbutton")), (gdouble) port_value); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string ( - NULL, SOCKS_PROXY_HOST_KEY, WID ("socks_host_entry"), + NULL, SOCKS_PROXY_HOST_KEY, + _gtk_builder_get_widget (builder, "socks_host_entry"), "conv-from-widget-cb", extract_proxy_host, NULL)); peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_integer ( - NULL, SOCKS_PROXY_PORT_KEY, WID ("socks_port_spinbutton"), + NULL, SOCKS_PROXY_PORT_KEY, + _gtk_builder_get_widget (builder, "socks_port_spinbutton"), NULL)); /* Set the proxy entries insensitive if we are using the same proxy for all */ if (gconf_client_get_bool (client, USE_SAME_PROXY_KEY, NULL)) { - gtk_widget_set_sensitive (WID ("secure_host_entry"), FALSE); - gtk_widget_set_sensitive (WID ("secure_port_spinbutton"), FALSE); - gtk_widget_set_sensitive (WID ("ftp_host_entry"), FALSE); - gtk_widget_set_sensitive (WID ("ftp_port_spinbutton"), FALSE); - gtk_widget_set_sensitive (WID ("socks_host_entry"), FALSE); - gtk_widget_set_sensitive (WID ("socks_port_spinbutton"), FALSE); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, "secure_host_entry"), FALSE); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, "secure_port_spinbutton"), FALSE); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, "ftp_host_entry"), FALSE); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, "ftp_port_spinbutton"), FALSE); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, "socks_host_entry"), FALSE); + gtk_widget_set_sensitive (_gtk_builder_get_widget (builder, "socks_port_spinbutton"), FALSE); } /* Autoconfiguration */ peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string ( - NULL, PROXY_AUTOCONFIG_URL_KEY, WID ("autoconfig_entry"), + NULL, PROXY_AUTOCONFIG_URL_KEY, + _gtk_builder_get_widget (builder, "autoconfig_entry"), NULL)); - g_signal_connect (WID ("network_dialog"), "response", - G_CALLBACK (cb_dialog_response), NULL); + g_signal_connect (gtk_builder_get_object (builder, "network_dialog"), + "response", G_CALLBACK (cb_dialog_response), NULL); - gtk_label_set_use_markup (GTK_LABEL (WID ("label_ignore_host")), TRUE); ignore_hosts = gconf_client_get_list(client, IGNORE_HOSTS_KEY, GCONF_VALUE_STRING, NULL); g_object_unref (client); model = create_listmodel(); populate_listmodel(GTK_LIST_STORE(model), ignore_hosts); - config_treeview(GTK_TREE_VIEW(WID("treeview_ignore_host")), model); - - g_signal_connect (WID ("button_add_url"), "clicked", - G_CALLBACK (cb_add_url), dialog); - g_signal_connect (WID ("entry_url"), "activate", - G_CALLBACK (cb_add_url), dialog); - g_signal_connect (WID ("button_remove_url"), "clicked", - G_CALLBACK (cb_remove_url), dialog); + config_treeview(GTK_TREE_VIEW(gtk_builder_get_object (builder, "treeview_ignore_host")), model); + + g_signal_connect (gtk_builder_get_object (builder, "button_add_url"), + "clicked", G_CALLBACK (cb_add_url), builder); + g_signal_connect (gtk_builder_get_object (builder, "entry_url"), + "activate", G_CALLBACK (cb_add_url), builder); + g_signal_connect (gtk_builder_get_object (builder, "button_remove_url"), + "clicked", G_CALLBACK (cb_remove_url), builder); } int main (int argc, char **argv) { - GladeXML *dialog; + GtkBuilder *builder; + GError *error = NULL; + gchar *builder_widgets[] = {"network_dialog", "adjustment1", + "adjustment2", "adjustment3", "adjustment4", + "delete_button_img", NULL}; GConfClient *client; GtkWidget *widget; @@ -1224,16 +1281,24 @@ main (int argc, char **argv) gconf_client_add_dir (client, "/system/proxy", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - dialog = glade_xml_new (GNOMECC_GLADE_DIR "/gnome-network-properties.glade", - "network_dialog", NULL); + builder = gtk_builder_new (); + if (gtk_builder_add_objects_from_file (builder, GNOMECC_GNP_UI_FILE, + builder_widgets, &error) == 0) { + g_warning ("Could not load main dialog: %s", + error->message); + g_error_free (error); + g_object_unref (builder); + g_object_unref (client); + return (EXIT_FAILURE); + } - setup_dialog (dialog); - widget = WID ("network_dialog"); + setup_dialog (builder); + widget = _gtk_builder_get_widget (builder, "network_dialog"); capplet_set_icon (widget, "gnome-network-properties"); gtk_widget_show_all (widget); gtk_main (); - g_object_unref (dialog); + g_object_unref (builder); g_object_unref (client); return 0; diff --git a/capplets/network/gnome-network-properties.glade b/capplets/network/gnome-network-properties.glade deleted file mode 100644 index 656acb5b6..000000000 --- a/capplets/network/gnome-network-properties.glade +++ /dev/null @@ -1,1472 +0,0 @@ - - - - - - - - 5 - Network Proxy Preferences - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 2 - - - 0.5 - 0 - - - True - 3 - - - True - Location: - 1 - - - True - True - - - - - True - - - 1 - True - True - - - - - - - False - False - 1 - - - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - True - True - False - _Delete Location - - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -7 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 5 - True - True - True - True - GTK_POS_TOP - False - False - - - - 12 - True - False - 18 - - - - True - True - <b>Di_rect internet connection</b> - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - False - 18 - - - - True - False - 6 - - - - True - True - <b>_Manual proxy configuration</b> - True - GTK_RELIEF_NORMAL - True - False - False - True - none_radiobutton - - - 0 - False - False - - - - - - True - False - True - _Use the same proxy for all protocols - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - False - False - 0 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 4 - 5 - False - 6 - 12 - - - - True - H_TTP proxy: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - http_host_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - _Secure HTTP proxy: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - secure_host_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - _FTP proxy: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - ftp_host_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - S_ocks host: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - socks_host_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 3 - 4 - fill - - - - - - - True - True - True - True - 0 - - True - False - - - 1 - 2 - 0 - 1 - - - - - - - True - True - True - True - 0 - - True - False - - - 1 - 2 - 1 - 2 - - - - - - - True - True - True - True - 0 - - True - False - - - 1 - 2 - 2 - 3 - - - - - - - True - True - True - True - 0 - - True - False - - - 1 - 2 - 3 - 4 - - - - - - - True - Port: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 2 - 3 - 0 - 1 - fill - - - - - - - True - Port: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 2 - 3 - 1 - 2 - fill - - - - - - - True - Port: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 2 - 3 - 2 - 3 - fill - - - - - - - True - Port: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 2 - 3 - 3 - 4 - fill - - - - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 0 0 65535 1 10 0 - - - - - - 3 - 4 - 0 - 1 - - - - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 0 0 65535 1 10 0 - - - - - - 3 - 4 - 1 - 2 - - - - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 0 0 65535 1 10 0 - - - - - - 3 - 4 - 2 - 3 - - - - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 0 0 65535 1 10 0 - - - - - - 3 - 4 - 3 - 4 - - - - - - - True - True - _Details - True - GTK_RELIEF_NORMAL - True - - - 4 - 5 - 0 - 1 - fill - - - - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - True - False - 6 - - - - True - True - <b>_Automatic proxy configuration</b> - True - GTK_RELIEF_NORMAL - True - False - False - True - none_radiobutton - - - 0 - False - False - - - - - - True - False - 0 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - False - 12 - - - - True - Autoconfiguration _URL: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - autoconfig_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - True - True - 0 - - True - False - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - False - False - - - - - 0 - True - True - - - - - False - True - - - - - - True - Proxy Configuration - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - 12 - True - False - 6 - - - - True - <b>Ignore Host List</b> - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 0 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 2 - 2 - False - 6 - 12 - - - - True - True - True - True - 0 - - True - False - - - 0 - 1 - 0 - 1 - - - - - - - True - True - gtk-add - True - GTK_RELIEF_NORMAL - True - - - 1 - 2 - 0 - 1 - fill - - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - False - True - False - False - False - - - - - 0 - 1 - 1 - 2 - fill - - - - - - True - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 0 - - - - True - True - gtk-remove - True - GTK_RELIEF_NORMAL - True - - - 0 - True - True - - - - - - - 1 - 2 - 1 - 2 - fill - fill - - - - - 0 - True - True - - - - - 0 - True - True - - - - - False - True - - - - - - True - Ignored Hosts - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - 0 - True - True - - - - - - - - 5 - HTTP Proxy Details - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 2 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -7 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 5 - True - False - 6 - - - - True - True - <b>_Use authentication</b> - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - False - 0 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 2 - 2 - False - 6 - 12 - - - - True - U_sername: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - username_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - _Password: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - password_entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - True - True - False - 0 - - True - False - - - 1 - 2 - 1 - 2 - - - - - - - True - True - True - True - 0 - - True - False - - - 1 - 2 - 0 - 1 - - - - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - 6 - Create New Location - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - False - True - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - True - 0 - True - - - True - - - True - _Location name: - True - False - text - GTK_JUSTIFY_LEFT - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - 1 - - - - - True - True - True - - - 6 - True - True - 2 - - - - - 1 - - - - - False - The location already exists. - - - 2 - - - - - - True - GTK_BUTTONBOX_END - - - True - True - True - C_reate - False - -5 - - - - - True - True - True - gtk-cancel - True - -6 - - - 1 - - - - - False - False - GTK_PACK_END - - - - - - - diff --git a/capplets/network/gnome-network-properties.ui b/capplets/network/gnome-network-properties.ui new file mode 100644 index 000000000..5976ce8f9 --- /dev/null +++ b/capplets/network/gnome-network-properties.ui @@ -0,0 +1,1023 @@ + + + + + + 5 + Network Proxy Preferences + False + dialog + False + + + True + 2 + + + 0 + + + True + 3 + + + True + 1 + Location: + + + 0 + + + + + True + + + 1 + + + + + + + False + False + 1 + + + + + True + True + 5 + + + True + 12 + 18 + + + <b>Di_rect internet connection</b> + True + True + False + True + True + + + False + False + 0 + + + + + True + 18 + + + True + 6 + + + <b>_Manual proxy configuration</b> + True + True + False + True + True + none_radiobutton + + + False + False + 0 + + + + + _Use the same proxy for all protocols + True + False + True + False + True + True + + + False + False + 1 + + + + + True + False + + + True + + + + False + False + 0 + + + + + True + 4 + 5 + 12 + 6 + + + True + 0 + H_TTP proxy: + True + http_host_entry + + + GTK_FILL + + + + + + True + 0 + _Secure HTTP proxy: + True + secure_host_entry + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + _FTP proxy: + True + ftp_host_entry + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + S_ocks host: + True + socks_host_entry + + + 3 + 4 + GTK_FILL + + + + + + True + True + + + 1 + 2 + + + + + + True + True + + + 1 + 2 + 1 + 2 + + + + + + True + True + + + 1 + 2 + 2 + 3 + + + + + + True + True + + + 1 + 2 + 3 + 4 + + + + + + True + 0 + Port: + + + + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Port: + + + + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + + True + 0 + Port: + + + + + + 2 + 3 + 2 + 3 + GTK_FILL + + + + + + True + 0 + Port: + + + + + + 2 + 3 + 3 + 4 + GTK_FILL + + + + + + True + True + adjustment4 + 1 + + + + + + 3 + 4 + + + + + + True + True + adjustment3 + 1 + + + + + + 3 + 4 + 1 + 2 + + + + + + True + True + adjustment2 + 1 + + + + + + 3 + 4 + 2 + 3 + + + + + + True + True + adjustment1 + 1 + + + + + + 3 + 4 + 3 + 4 + + + + + + _Details + True + True + False + True + + + 4 + 5 + GTK_FILL + + + + + + + + + + + + + + + 1 + + + + + 2 + + + + + 0 + + + + + True + 6 + + + <b>_Automatic proxy configuration</b> + True + True + False + True + True + none_radiobutton + + + False + False + 0 + + + + + True + + + True + + + + False + False + 0 + + + + + True + False + 12 + + + True + Autoconfiguration _URL: + True + autoconfig_entry + + + False + False + 0 + + + + + True + True + + + 1 + + + + + 1 + + + + + 1 + + + + + False + False + 1 + + + + + 1 + + + + + + + True + Proxy Configuration + + + False + + + + + True + 12 + 6 + + + True + 0 + <b>Ignore Host List</b> + True + + + False + False + 0 + + + + + True + + + True + + + + False + False + 0 + + + + + True + 2 + 2 + 12 + 6 + + + True + True + + + + + + + + gtk-add + True + True + False + True + + + 1 + 2 + GTK_FILL + + + + + + True + True + automatic + automatic + in + + + True + True + False + + + + + 1 + 2 + GTK_FILL + + + + + True + 0 + 0 + 0 + + + True + + + gtk-remove + True + True + False + True + + + 0 + + + + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + 1 + + + + + 1 + + + + + 1 + + + + + True + Ignored Hosts + + + 1 + False + + + + + 2 + + + + + True + end + + + gtk-help + True + True + True + False + True + + + False + False + 0 + + + + + _Delete Location + True + False + True + False + delete_button_img + + + False + False + 1 + + + + + gtk-close + True + True + True + False + True + + + False + False + 2 + + + + + False + end + 0 + + + + + + helpbutton1 + delete_button + closebutton1 + + + + 5 + HTTP Proxy Details + False + dialog + False + + + True + 2 + + + True + 5 + 6 + + + <b>_Use authentication</b> + True + True + False + True + True + + + False + False + 0 + + + + + True + + + True + + + + False + False + 0 + + + + + True + False + 2 + 2 + 12 + 6 + + + True + 0 + U_sername: + True + username_entry + + + GTK_FILL + + + + + + True + 0 + _Password: + True + password_entry + + + 1 + 2 + GTK_FILL + + + + + + True + True + False + + + 1 + 2 + 1 + 2 + + + + + + True + True + + + 1 + 2 + + + + + + 1 + + + + + 1 + + + + + 1 + + + + + True + end + + + gtk-help + True + True + True + False + True + + + False + False + 0 + + + + + gtk-close + True + True + True + False + True + + + False + False + 1 + + + + + False + end + 0 + + + + + + helpbutton2 + closebutton2 + + + + 6 + Create New Location + False + True + True + dialog + False + + + True + True + + + True + + + True + _Location name: + True + text + + + False + False + 1 + + + + + True + True + True + + + 6 + 2 + + + + + 1 + + + + + The location already exists. + + + 2 + + + + + True + end + + + C_reate + True + True + True + new_location_btn_img + + + False + False + 0 + + + + + gtk-cancel + True + True + True + True + + + False + False + 1 + + + + + False + False + end + 0 + + + + + + new_location + button2 + + + + 65535 + 1 + 10 + + + 65535 + 1 + 10 + + + 65535 + 1 + 10 + + + 65535 + 1 + 10 + + + True + gtk-add + + + True + gtk-delete + + diff --git a/po/POTFILES.in b/po/POTFILES.in index a4867119a..530090219 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -62,7 +62,7 @@ capplets/mouse/gnome-mouse-properties.glade capplets/mouse/gnome-settings-mouse.desktop.in.in capplets/network/gnome-network-properties.c capplets/network/gnome-network-properties.desktop.in.in -capplets/network/gnome-network-properties.glade +[type: gettext/glade]capplets/network/gnome-network-properties.ui capplets/windows/gnome-window-properties.c [type: gettext/glade]capplets/windows/gnome-window-properties.ui capplets/windows/window-properties.desktop.in.in -- cgit v1.2.1