# HG changeset patch # User Elliott Sales de Andrade # Date 1529914809 14400 # Node ID 093a6314d4737240966ac4b4e94decdf9158881a # Parent ff095c074d32cce551519b98422e566a876e6b51 prefs: Convert Interface page to glade. diff -r ff095c074d32 -r 093a6314d473 pidgin/gtkprefs.c --- a/pidgin/gtkprefs.c Mon Jun 25 03:52:25 2018 -0400 +++ b/pidgin/gtkprefs.c Mon Jun 25 04:20:09 2018 -0400 @@ -106,6 +106,27 @@ /* Notebook */ GtkWidget *notebook; + /* Interface page */ + struct { + PidginPrefCombo docklet; + struct { + PidginPrefCombo hide_new; + } im; + struct { + GtkWidget *minimize_new_convs; + } win32; + struct { + GtkWidget *tabs; + GtkWidget *tabs_vbox; + GtkWidget *close_on_tabs; + PidginPrefCombo tab_side; + PidginPrefCombo placement; + } conversations; + struct { + GtkWidget *escape; + } keys; + } interface; + /* Browser page */ struct { GtkWidget *page; @@ -1975,10 +1996,8 @@ * standard Gtk accelerator-changing mechanism. */ static void -keyboard_shortcuts(GtkWidget *page) +keyboard_shortcuts(GtkWidget *checkbox) { - GtkWidget *vbox = pidgin_make_frame(page, _("Keyboard Shortcuts")); - GtkWidget *checkbox; GtkAccelKey current = { 0, 0, 0 }; GtkAccelMap *map = gtk_accel_map_get(); @@ -1996,8 +2015,6 @@ g_assert(escape.accel_key != 0); } - checkbox = gtk_check_button_new_with_mnemonic( - _("Cl_ose conversations with the Escape key")); gtk_accel_map_lookup_entry(CONVERSATION_CLOSE_ACCEL_PATH, ¤t); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), accel_is_escape(¤t)); @@ -2007,99 +2024,58 @@ g_signal_connect_object(map, "changed::" CONVERSATION_CLOSE_ACCEL_PATH, G_CALLBACK(conversation_close_accel_changed_cb), checkbox, (GConnectFlags)0); - - gtk_box_pack_start(GTK_BOX(vbox), checkbox, FALSE, FALSE, 0); } -static GtkWidget * -interface_page(void) +static void +bind_interface_page(PidginPrefsWindow *win) { - GtkWidget *ret; - GtkWidget *vbox; - GtkWidget *vbox2; - GtkWidget *label; - GtkWidget *button; - GtkSizeGroup *sg; GList *names = NULL; - ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, PIDGIN_HIG_CAT_SPACE); - gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER); - - sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - /* System Tray */ - vbox = pidgin_make_frame(ret, _("System Tray Icon")); - label = pidgin_prefs_dropdown(vbox, _("_Show system tray icon:"), PURPLE_PREF_STRING, - PIDGIN_PREFS_ROOT "/docklet/show", - _("Always"), "always", - _("On unread messages"), "pending", - _("Never"), "never", - NULL); - gtk_size_group_add_widget(sg, label); - gtk_label_set_xalign(GTK_LABEL(label), 0.0); - gtk_label_set_yalign(GTK_LABEL(label), 0.5); - - vbox = pidgin_make_frame(ret, _("Conversation Window")); - label = pidgin_prefs_dropdown(vbox, _("_Hide new IM conversations:"), - PURPLE_PREF_STRING, PIDGIN_PREFS_ROOT "/conversations/im/hide_new", - _("Never"), "never", - _("When away"), "away", - _("Always"), "always", - NULL); - gtk_size_group_add_widget(sg, label); - gtk_label_set_xalign(GTK_LABEL(label), 0.0); - gtk_label_set_yalign(GTK_LABEL(label), 0.5); + win->interface.docklet.type = PURPLE_PREF_STRING; + win->interface.docklet.key = PIDGIN_PREFS_ROOT "/docklet/show"; + pidgin_prefs_bind_dropdown(&win->interface.docklet); + + win->interface.im.hide_new.type = PURPLE_PREF_STRING; + win->interface.im.hide_new.key = PIDGIN_PREFS_ROOT "/conversations/im/hide_new"; + pidgin_prefs_bind_dropdown(&win->interface.im.hide_new); #ifdef _WIN32 - pidgin_prefs_checkbox(_("Minimi_ze new conversation windows"), PIDGIN_PREFS_ROOT "/win32/minimize_new_convs", vbox); + pidgin_prefs_bind_checkbox(PIDGIN_PREFS_ROOT "/win32/minimize_new_convs", + win->interface.win32.minimize_new_convs); +#else + gtk_widget_hide(win->interface.win32.minimize_new_convs); #endif /* All the tab options! */ - vbox = pidgin_make_frame(ret, _("Tabs")); - - button = pidgin_prefs_checkbox(_("Show IMs and chats in _tabbed windows"), - PIDGIN_PREFS_ROOT "/conversations/tabs", vbox); + pidgin_prefs_bind_checkbox(PIDGIN_PREFS_ROOT "/conversations/tabs", + win->interface.conversations.tabs); /* * Connect a signal to the above preference. When conversations are not * shown in a tabbed window then all tabbing options should be disabled. */ - vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 9); - gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0); - g_object_bind_property(button, "active", vbox2, "sensitive", + g_object_bind_property(win->interface.conversations.tabs, "active", + win->interface.conversations.tabs_vbox, "sensitive", G_BINDING_SYNC_CREATE); - pidgin_prefs_checkbox(_("Show close b_utton on tabs"), - PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", vbox2); - - label = pidgin_prefs_dropdown(vbox2, _("_Placement:"), PURPLE_PREF_INT, - PIDGIN_PREFS_ROOT "/conversations/tab_side", - _("Top"), GTK_POS_TOP, - _("Bottom"), GTK_POS_BOTTOM, - _("Left"), GTK_POS_LEFT, - _("Right"), GTK_POS_RIGHT, - _("Left Vertical"), GTK_POS_LEFT|8, - _("Right Vertical"), GTK_POS_RIGHT|8, - NULL); - gtk_size_group_add_widget(sg, label); - gtk_label_set_xalign(GTK_LABEL(label), 0.0); - gtk_label_set_yalign(GTK_LABEL(label), 0.5); - + pidgin_prefs_bind_checkbox( + PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", + win->interface.conversations.close_on_tabs); + + win->interface.conversations.tab_side.type = PURPLE_PREF_INT; + win->interface.conversations.tab_side.key = PIDGIN_PREFS_ROOT "/conversations/tab_side"; + pidgin_prefs_bind_dropdown(&win->interface.conversations.tab_side); + + win->interface.conversations.placement.type = PURPLE_PREF_STRING; + win->interface.conversations.placement.key = PIDGIN_PREFS_ROOT "/conversations/placement"; names = pidgin_conv_placement_get_options(); - label = pidgin_prefs_dropdown_from_list(vbox2, _("N_ew conversations:"), - PURPLE_PREF_STRING, PIDGIN_PREFS_ROOT "/conversations/placement", names); - gtk_label_set_xalign(GTK_LABEL(label), 0.0); - gtk_label_set_yalign(GTK_LABEL(label), 0.5); - - gtk_size_group_add_widget(sg, label); - + pidgin_prefs_bind_dropdown_from_list( + &win->interface.conversations.placement, + names); g_list_free(names); - keyboard_shortcuts(ret); - - gtk_widget_show_all(ret); - g_object_unref(sg); - return ret; + keyboard_shortcuts(win->interface.keys.escape); } /* This is also Win32-specific, but must be visible for Glade binding. */ @@ -4010,7 +3986,8 @@ GtkNotebook *notebook = GTK_NOTEBOOK(win->notebook); int notebook_page = 0; - prefs_notebook_add_page(notebook, _("Interface"), interface_page(), notebook_page++); + bind_interface_page(win); + notebook_page++; #ifdef _WIN32 /* We use the registered default browser in windows */ @@ -4058,6 +4035,35 @@ widget_class, PidginPrefsWindow, notebook); gtk_widget_class_bind_template_callback(widget_class, delete_prefs); + /* Interface page */ + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, + interface.docklet.combo); + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, + interface.im.hide_new.combo); + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, + interface.win32.minimize_new_convs); + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, + interface.conversations.tabs); + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, + interface.conversations.tabs_vbox); + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, + interface.conversations.close_on_tabs); + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, + interface.conversations.tab_side.combo); + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, + interface.conversations.placement.combo); + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, + interface.keys.escape); + /* Browser page */ gtk_widget_class_bind_template_child( widget_class, PidginPrefsWindow, browser.page); diff -r ff095c074d32 -r 093a6314d473 pidgin/resources/Prefs/prefs.ui --- a/pidgin/resources/Prefs/prefs.ui Mon Jun 25 03:52:25 2018 -0400 +++ b/pidgin/resources/Prefs/prefs.ui Mon Jun 25 04:20:09 2018 -0400 @@ -68,6 +68,92 @@ + + + + + + + + + + + + + + + + + + Top + 2 + + + Bottom + 3 + + + Left + 0 + + + Right + 1 + + + Left Vertical + 8 + + + Right Vertical + 9 + + + + + + + + + + + + + Always + always + + + On unread messages + pending + + + Never + never + + + + + + + + + + + + + Never + never + + + When away + away + + + Always + always + + + @@ -180,6 +266,410 @@ True left + + True + False + 12 + 12 + 12 + 12 + vertical + 18 + + + True + False + 0 + none + + + True + False + 12 + 12 + + + True + False + 6 + + + True + False + _Show system tray icon: + True + interface.docklet.combo + 0 + + + False + True + 0 + + + + + True + False + interface.docklet.store + + + + 0 + + + + + False + True + 1 + + + + + + + + + True + False + System Tray Icon + + + + + + + + False + True + 0 + + + + + True + False + 0 + none + + + True + False + 12 + 12 + + + True + False + vertical + 6 + + + True + False + 6 + + + True + False + _Hide new IM conversations: + True + 0 + + + False + True + 0 + + + + + True + False + interface.im.hide_new.store + + + + 0 + + + + + False + True + 1 + + + + + False + True + 0 + + + + + Minimi_ze new conversation windows + True + True + False + True + True + + + False + True + 1 + + + + + + + + + True + False + Conversation Window + + + + + + + + False + True + 1 + + + + + True + False + 0 + none + + + True + False + 12 + 12 + + + True + False + vertical + 6 + + + Show IMs and chats in _tabbed windows + True + True + False + True + True + + + False + True + 0 + + + + + True + False + vertical + 6 + + + Show closed b_utton on tabs + True + True + False + True + True + + + False + True + 0 + + + + + True + False + 6 + + + True + False + _Placement: + True + interface.conversations.tab_side.combo + 0 + + + False + True + 0 + + + + + True + False + interface.conversations.tab_side.store + + + + 0 + + + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + 6 + + + True + False + N_ew conversations: + True + interface.conversations.placement.combo + 0 + + + False + True + 0 + + + + + True + False + interface.conversations.placement.store + + + + 0 + + + + + False + True + 1 + + + + + False + True + 2 + + + + + False + True + 1 + + + + + + + + + True + False + Tabs + + + + + + + + False + True + 2 + + + + + True + False + 0 + none + + + True + False + 12 + 12 + + + Cl_ose conversations with the Escape key + True + True + False + True + True + + + + + + + True + False + Keyboard Shortcuts + + + + + + + + False + True + 3 + + + + + + + True + False + Interface + + + False + + + True False @@ -446,6 +936,9 @@ + + 1 + @@ -454,6 +947,7 @@ Browser + 1 False @@ -889,7 +1383,7 @@ - 1 + 2 @@ -899,7 +1393,7 @@ Conversations - 1 + 2 False @@ -1042,7 +1536,7 @@ - 2 + 3 @@ -1052,7 +1546,7 @@ Logging - 2 + 3 False @@ -1545,7 +2039,7 @@ - 3 + 4 @@ -1555,7 +2049,7 @@ Network - 3 + 4 False @@ -1873,7 +2367,7 @@ - 4 + 5 @@ -1883,7 +2377,7 @@ Proxy - 4 + 5 False @@ -1904,6 +2398,14 @@ + + + + + + + +