--- a/pidgin/gtkprefs.c Mon Aug 05 04:19:43 2019 -0400
+++ b/pidgin/gtkprefs.c Mon Aug 05 19:05:09 2019 -0400
@@ -246,6 +246,14 @@
GtkWidget *startup_label;
@@ -1467,37 +1475,25 @@
/* builds a theme combo box from a list store with colums: icon preview, markup, theme name */
-prefs_build_theme_combo_box(GtkListStore *store, const char *current_theme, const char *type)
+prefs_build_theme_combo_box(GtkWidget *combo_box, GtkListStore *store, + const char *current_theme, const char *type) - GtkCellRenderer *cell_rend;
- g_return_val_if_fail(store != NULL && current_theme != NULL, NULL);
- combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
- cell_rend = gtk_cell_renderer_pixbuf_new();
- gtk_cell_renderer_set_fixed_size(cell_rend, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE);
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combo_box), cell_rend, FALSE);
- gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_box), cell_rend, "pixbuf", 0, NULL);
- cell_rend = gtk_cell_renderer_text_new();
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combo_box), cell_rend, TRUE);
- gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_box), cell_rend, "markup", 1, NULL);
- g_object_set(cell_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ g_return_if_fail(store != NULL && current_theme != NULL); + gtk_combo_box_set_model(GTK_COMBO_BOX(combo_box), + GTK_TREE_MODEL(store)); gtk_drag_dest_set(combo_box, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, te,
sizeof(te) / sizeof(GtkTargetEntry) , GDK_ACTION_COPY | GDK_ACTION_MOVE);
g_signal_connect(G_OBJECT(combo_box), "drag_data_received", G_CALLBACK(theme_dnd_recv), (gpointer) type);
/* sets the current sound theme */
@@ -1629,95 +1625,36 @@
-add_theme_prefs_combo(GtkWidget *vbox,
- GtkSizeGroup *combo_sg, GtkSizeGroup *label_sg,
- GtkListStore *theme_store,
- GCallback combo_box_cb, gpointer combo_box_cb_user_data,
- const char *label_str, const char *prefs_path,
- const char *theme_type)
+bind_theme_page(PidginPrefsWindow *win)
- GtkWidget *combo_box = NULL;
- GtkWidget *themesel_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE);
- label = gtk_label_new(label_str);
- gtk_label_set_xalign(GTK_LABEL(label), 0.0);
- gtk_label_set_yalign(GTK_LABEL(label), 0.5);
- gtk_size_group_add_widget(label_sg, label);
- gtk_box_pack_start(GTK_BOX(themesel_hbox), label, FALSE, FALSE, 0);
- combo_box = prefs_build_theme_combo_box(theme_store,
- purple_prefs_get_string(prefs_path),
- g_signal_connect(G_OBJECT(combo_box), "changed",
- (GCallback)combo_box_cb, combo_box_cb_user_data);
- gtk_size_group_add_widget(combo_sg, combo_box);
- gtk_box_pack_start(GTK_BOX(themesel_hbox), combo_box, TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), themesel_hbox, FALSE, FALSE, 0);
-theme_page(PidginPrefsWindow *win)
- GtkSizeGroup *label_sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
- GtkSizeGroup *combo_sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
- ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, PIDGIN_HIG_CAT_SPACE);
- gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER);
- vbox = pidgin_make_frame(ret, _("Theme Selections"));
- label = gtk_label_new(_("Select a theme that you would like to use from "
- "the lists below.\nNew themes can be installed by "
- "dragging and dropping them onto the theme list."));
- gtk_label_set_xalign(GTK_LABEL(label), 0.0);
- gtk_label_set_yalign(GTK_LABEL(label), 0.5);
- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
- gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, FALSE, 0);
- gtk_widget_show(label);
- prefs_blist_themes_combo_box = add_theme_prefs_combo(
- vbox, combo_sg, label_sg, prefs_blist_themes,
- (GCallback)prefs_set_blist_theme_cb, NULL,
- _("Buddy List Theme:"), PIDGIN_PREFS_ROOT "/blist/theme", "blist");
+ prefs_build_theme_combo_box(win->theme.blist, prefs_blist_themes, + PIDGIN_PREFS_ROOT "/blist/theme", "blist"); + prefs_blist_themes_combo_box = win->theme.blist; - prefs_status_themes_combo_box = add_theme_prefs_combo(
- vbox, combo_sg, label_sg, prefs_status_icon_themes,
- (GCallback)prefs_set_status_icon_theme_cb, NULL,
- _("Status Icon Theme:"), PIDGIN_PREFS_ROOT "/status/icon-theme", "icon");
+ prefs_build_theme_combo_box(win->theme.status, prefs_status_icon_themes, + PIDGIN_PREFS_ROOT "/status/icon-theme", + prefs_status_themes_combo_box = win->theme.status; - prefs_sound_themes_combo_box = add_theme_prefs_combo(
- vbox, combo_sg, label_sg, prefs_sound_themes,
- (GCallback)prefs_set_sound_theme_cb, win,
- _("Sound Theme:"), PIDGIN_PREFS_ROOT "/sound/theme", "sound");
+ prefs_build_theme_combo_box(win->theme.sound, prefs_sound_themes, + PIDGIN_PREFS_ROOT "/sound/theme", "sound"); + prefs_sound_themes_combo_box = win->theme.sound; - prefs_smiley_themes_combo_box = add_theme_prefs_combo(
- vbox, combo_sg, label_sg, prefs_smiley_themes,
- (GCallback)prefs_set_smiley_theme_cb, NULL,
- _("Smiley Theme:"), PIDGIN_PREFS_ROOT "/smileys/theme", "smiley");
+ prefs_build_theme_combo_box(win->theme.smiley, prefs_smiley_themes, + PIDGIN_PREFS_ROOT "/smileys/theme", + prefs_smiley_themes_combo_box = win->theme.smiley; /* Custom sort so "none" theme is at top of list */
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(prefs_smiley_themes),
2, pidgin_sort_smileys, NULL, NULL);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(prefs_smiley_themes),
- gtk_widget_show_all(ret);
@@ -3547,7 +3484,8 @@
- prefs_notebook_add_page(notebook, _("Themes"), theme_page(win), notebook_page++);
prefs_notebook_add_page(notebook, _("Voice/Video"), vv_page(win), notebook_page++);
@@ -3820,6 +3758,24 @@
widget_class, PidginPrefsWindow, away.startup_hbox);
gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow, away.startup_label);
+ gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, theme.blist); + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, theme.status); + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, theme.sound); + gtk_widget_class_bind_template_child( + widget_class, PidginPrefsWindow, theme.smiley); + gtk_widget_class_bind_template_callback(widget_class, + prefs_set_blist_theme_cb); + gtk_widget_class_bind_template_callback(widget_class, + prefs_set_status_icon_theme_cb); + gtk_widget_class_bind_template_callback(widget_class, + prefs_set_sound_theme_cb); + gtk_widget_class_bind_template_callback(widget_class, + prefs_set_smiley_theme_cb); --- a/pidgin/resources/Prefs/prefs.ui Mon Aug 05 04:19:43 2019 -0400
+++ b/pidgin/resources/Prefs/prefs.ui Mon Aug 05 19:05:09 2019 -0400
@@ -3391,6 +3391,301 @@
<property name="tab_fill">False</property>
+ <object class="GtkBox" id="theme.page"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">12</property> + <property name="margin_right">12</property> + <property name="margin_top">12</property> + <property name="margin_bottom">12</property> + <property name="orientation">vertical</property> + <property name="spacing">18</property> + <object class="GtkFrame"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <object class="GtkAlignment"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Select a theme that you would like to use from the lists below. +New themes can be installed by dragging and dropping them onto the theme list.</property> + <property name="xalign">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <object class="GtkLabel" id="label19"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Buddy List Theme:</property> + <property name="xalign">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + <object class="GtkComboBox" id="theme.blist"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <signal name="changed" handler="prefs_set_blist_theme_cb" swapped="no"/> + <object class="GtkCellRendererPixbuf"> + <property name="width">32</property> + <property name="height">32</property> + <attribute name="pixbuf">0</attribute> + <object class="GtkCellRendererText"> + <property name="ellipsize">end</property> + <attribute name="markup">1</attribute> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <object class="GtkLabel" id="label20"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Status Icon Theme:</property> + <property name="xalign">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + <object class="GtkComboBox" id="theme.status"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <signal name="changed" handler="prefs_set_status_icon_theme_cb" swapped="no"/> + <object class="GtkCellRendererPixbuf"> + <property name="width">32</property> + <property name="height">32</property> + <attribute name="pixbuf">0</attribute> + <object class="GtkCellRendererText"> + <property name="ellipsize">end</property> + <attribute name="markup">1</attribute> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <object class="GtkLabel" id="label21"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Sound Theme:</property> + <property name="xalign">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + <object class="GtkComboBox" id="theme.sound"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <signal name="changed" handler="prefs_set_sound_theme_cb" object="PidginPrefsWindow" swapped="no"/> + <object class="GtkCellRendererPixbuf"> + <property name="width">32</property> + <property name="height">32</property> + <attribute name="pixbuf">0</attribute> + <object class="GtkCellRendererText"> + <property name="ellipsize">end</property> + <attribute name="markup">1</attribute> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">3</property> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <object class="GtkLabel" id="label18"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Smiley Theme:</property> + <property name="xalign">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + <object class="GtkComboBox" id="theme.smiley"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <signal name="changed" handler="prefs_set_smiley_theme_cb" swapped="no"/> + <object class="GtkCellRendererPixbuf"> + <property name="width">32</property> + <property name="height">32</property> + <attribute name="pixbuf">0</attribute> + <object class="GtkCellRendererText"> + <property name="ellipsize">end</property> + <attribute name="markup">1</attribute> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_bottom">6</property> + <property name="label" translatable="yes">Theme Selections</property> + <attribute name="weight" value="bold"/> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + <property name="position">9</property> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Themes</property> + <property name="position">9</property> + <property name="tab_fill">False</property> <property name="expand">False</property>
@@ -3441,4 +3736,20 @@
+ <object class="GtkSizeGroup" id="theme.combo_sg"> + <widget name="theme.blist"/> + <widget name="theme.status"/> + <widget name="theme.sound"/> + <widget name="theme.smiley"/> + <object class="GtkSizeGroup" id="theme.label_sg"> + <widget name="label18"/> + <widget name="label19"/> + <widget name="label20"/> + <widget name="label21"/>