--- a/pidgin/glade/pidgin3.xml.in Mon Feb 07 23:54:15 2022 -0600
+++ b/pidgin/glade/pidgin3.xml.in Thu Feb 10 20:17:10 2022 -0600
@@ -19,6 +19,8 @@
<glade-widget-class name="PidginProtocolStore" generic-name="protocol_store" title="ProtocolStore"/>
<glade-widget-class name="PidginScrollBook" generic-name="scroll_book" title="ScrollBook"/>
<glade-widget-class name="PidginStatusBox" generic-name="status_box" title="StatusBox"/>
+ <glade-widget-class name="PidginStatusPrimitiveChooser" generic-name="status_primitive_chooser" title="StatusPrimitiveChooser"/> + <glade-widget-class name="PidginStatusPrimitiveStore" generic-name="status_primitive_store" title="StatusPrimitiveStore"/> <glade-widget-group name="pidgin" title="Pidgin">
<glade-widget-class-ref name="PidginAccountChooser"/>
@@ -39,5 +41,7 @@
<glade-widget-class-ref name="PidginProtocolStore"/>
<glade-widget-class-ref name="PidginScrollBook"/>
<glade-widget-class-ref name="PidginStatusBox"/>
+ <glade-widget-class-ref name="PidginStatusPrimitiveChooser"/> + <glade-widget-class-ref name="PidginStatusPrimitiveStore"/> --- a/pidgin/gtksavedstatuses.c Mon Feb 07 23:54:15 2022 -0600
+++ b/pidgin/gtksavedstatuses.c Thu Feb 10 20:17:10 2022 -0600
@@ -32,6 +32,9 @@
#include "pidgindialog.h"
#include "pidginiconname.h"
+#include "pidginstatusprimitivechooser.h" +#include "pidginstatusprimitivestore.h" * TODO: Should attach to the account-deleted and account-added signals
* and update the GtkListStores in any StatusEditor windows that
@@ -128,7 +131,6 @@
GtkTextBuffer *message_buffer;
@@ -805,61 +807,6 @@
gtk_widget_set_sensitive(GTK_WIDGET(dialog->save_button), (*text != '\0'));
-create_status_type_menu(PurpleStatusPrimitive type)
- GtkCellRenderer *renderer;
- store = gtk_list_store_new(STATUS_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- for (i = PURPLE_STATUS_UNSET + 1; i < PURPLE_STATUS_NUM_PRIMITIVES; i++)
- /* Someone should fix this for 3.0.0. The independent boolean
- * should probably be set on the status type, not the status.
- * I guess that would prevent third party plugins from creating
- * independent statuses?
- if (i == PURPLE_STATUS_MOBILE ||
- i == PURPLE_STATUS_MOOD ||
- i == PURPLE_STATUS_TUNE)
- * Special-case these. They're intended to be independent
- * status types, so don't show them in the list.
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- STATUS_COLUMN_ICON, pidgin_icon_name_from_status_primitive(i, NULL),
- STATUS_COLUMN_STATUS_ID, purple_primitive_get_id_from_type(i),
- STATUS_COLUMN_STATUS_NAME, purple_primitive_get_name_from_type(i),
- dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
- renderer = gtk_cell_renderer_pixbuf_new();
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, FALSE);
- gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer,
- "icon-name", STATUS_COLUMN_ICON,
- renderer = gtk_cell_renderer_text_new();
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, TRUE);
- gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer,
- "text", STATUS_COLUMN_STATUS_NAME,
- gtk_combo_box_set_active(GTK_COMBO_BOX(dropdown),
- type - (PURPLE_STATUS_UNSET + 1));
static void edit_substatus(StatusEditor *status_editor, PurpleAccount *account);
@@ -1066,6 +1013,8 @@
+ PurpleStatusPrimitive primitive = PURPLE_STATUS_AWAY; @@ -1122,11 +1071,16 @@
pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Title:"), sg, entry, TRUE, NULL);
- if (saved_status != NULL)
- dropdown = create_status_type_menu(purple_savedstatus_get_primitive_type(saved_status));
- dropdown = create_status_type_menu(PURPLE_STATUS_AWAY);
+ if (saved_status != NULL) { + primitive = purple_savedstatus_get_primitive_type(saved_status); + store = pidgin_status_primitive_store_new(); + dropdown = pidgin_status_primitive_chooser_new(); dialog->type = GTK_COMBO_BOX(dropdown);
+ gtk_combo_box_set_model(GTK_COMBO_BOX(dropdown), GTK_TREE_MODEL(store)); + gtk_combo_box_set_active_id(GTK_COMBO_BOX(dropdown), + purple_primitive_get_id_from_type(primitive)); pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Status:"), sg, dropdown, TRUE, NULL);
@@ -1215,24 +1169,26 @@
substatus_selection_changed_cb(GtkComboBox *box, gpointer user_data)
SubStatusEditor *select = user_data;
+ PurpleStatusPrimitive primitive; - if (!gtk_combo_box_get_active_iter(box, &iter))
+ id = gtk_combo_box_get_active_id(box); - gtk_tree_model_get(GTK_TREE_MODEL(select->model), &iter,
- STATUS_COLUMN_STATUS_ID, &id,
- type = purple_account_get_status_type(select->account, id);
+ primitive = purple_primitive_get_type_from_id(id); + if(primitive == PURPLE_STATUS_UNSET) { - if (purple_status_type_get_attr(type, "message") == NULL)
+ type = purple_account_get_status_type_with_primitive(select->account, + if(purple_status_type_get_attr(type, "message") == NULL) { gtk_widget_set_sensitive(select->message_view, FALSE);
gtk_widget_set_sensitive(select->message_view, TRUE);
@@ -1298,25 +1254,30 @@
StatusEditor *status_editor;
+ PurpleStatusPrimitive primitive; const gchar *name = NULL, *icon_name = NULL;
- if (!gtk_combo_box_get_active_iter(dialog->box, &iter))
+ id = gtk_combo_box_get_active_id(GTK_COMBO_BOX(dialog->box)); gtk_widget_destroy(dialog->window);
- gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), &iter,
- STATUS_COLUMN_STATUS_ID, &id,
- type = purple_account_get_status_type(dialog->account, id);
+ primitive = purple_primitive_get_type_from_id(id); + if(primitive == PURPLE_STATUS_UNSET) { + gtk_widget_destroy(dialog->window); + type = purple_account_get_status_type_with_primitive(dialog->account, if (purple_status_type_get_attr(type, "message") != NULL) {
message = talkatu_markup_get_html(dialog->message_buffer, NULL);
name = purple_status_type_get_name(type);
- icon_name = pidgin_icon_name_from_status_primitive(purple_status_type_get_primitive(type), NULL);
+ icon_name = pidgin_icon_name_from_status_primitive(primitive, NULL); status_editor = dialog->status_editor;
@@ -1333,7 +1294,6 @@
gtk_widget_destroy(dialog->window);
@@ -1368,12 +1328,11 @@
gboolean parent_dialog_has_substatus = FALSE;
- gboolean select = FALSE;
+ PurpleStatusPrimitive primitive = PURPLE_STATUS_AWAY; g_return_if_fail(status_editor != NULL);
g_return_if_fail(account != NULL);
@@ -1419,23 +1378,13 @@
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
gtk_size_group_add_widget(sg, label);
- dialog->model = gtk_list_store_new(STATUS_NUM_COLUMNS,
- combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(dialog->model));
+ store = pidgin_status_primitive_store_new(); + pidgin_status_primitive_store_set_account(PIDGIN_STATUS_PRIMITIVE_STORE(store), + combo = pidgin_status_primitive_chooser_new(); + gtk_combo_box_set_model(GTK_COMBO_BOX(combo), GTK_TREE_MODEL(store)); dialog->box = GTK_COMBO_BOX(combo);
- rend = GTK_CELL_RENDERER(gtk_cell_renderer_pixbuf_new());
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), rend, FALSE);
- gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), rend,
- "icon-name", STATUS_COLUMN_ICON, NULL);
- rend = GTK_CELL_RENDERER(gtk_cell_renderer_text_new());
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), rend, TRUE);
- gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), rend,
- "text", STATUS_COLUMN_STATUS_NAME, NULL);
g_signal_connect(G_OBJECT(combo), "changed",
G_CALLBACK(substatus_selection_changed_cb), dialog);
@@ -1484,46 +1433,20 @@
/* TODO: Else get the generic status type from our parent */
+ if(status_id != NULL) { + PurpleStatus *status = purple_account_get_status(account, status_id); + PurpleStatusType *type = purple_status_get_status_type(status); + primitive = purple_status_type_get_primitive(type); + gtk_combo_box_set_active_id(GTK_COMBO_BOX(combo), + purple_primitive_get_id_from_type(primitive)); talkatu_markup_set_html(TALKATU_BUFFER(dialog->message_buffer), message, -1);
- for (list = purple_account_get_status_types(account); list; list = list->next)
- PurpleStatusType *status_type;
- PurpleStatusPrimitive prim;
- status_type = list->data;
- * Only allow users to select statuses that are flagged as
- * "user settable" and that aren't independent.
- if (!purple_status_type_is_user_settable(status_type) ||
- purple_status_type_is_independent(status_type))
- id = purple_status_type_get_id(status_type);
- prim = purple_status_type_get_primitive(status_type);
- name = purple_status_type_get_name(status_type);
- gtk_list_store_append(dialog->model, &iter);
- gtk_list_store_set(dialog->model, &iter,
- STATUS_COLUMN_ICON, pidgin_icon_name_from_status_primitive(prim, NULL),
- STATUS_COLUMN_STATUS_ID, id,
- STATUS_COLUMN_STATUS_NAME, name,
- if ((status_id != NULL) && purple_strequal(status_id, id))
- gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo), &iter);
- gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
if (parent_dialog_has_substatus) {
/* These two were gotten from the parent tree model, so they need to be freed */
--- a/pidgin/resources/pidgin.gresource.xml Mon Feb 07 23:54:15 2022 -0600
+++ b/pidgin/resources/pidgin.gresource.xml Thu Feb 10 20:17:10 2022 -0600
@@ -34,6 +34,7 @@
<file compressed="true">Xfer/xfer.ui</file>
<file compressed="true">closebutton.ui</file>
<file compressed="true">gtk/menus.ui</file>
+ <file compressed="true">statusprimitivechooser.ui</file> <file>icons/16x16/status/pidgin-user-available.png</file>
<file>icons/16x16/status/pidgin-user-away.png</file>
<file>icons/16x16/status/pidgin-user-busy.png</file>
--- a/po/POTFILES.in Mon Feb 07 23:54:15 2022 -0600
+++ b/po/POTFILES.in Thu Feb 10 20:17:10 2022 -0600
@@ -365,6 +365,8 @@
pidgin/pidginprotocolchooser.c
pidgin/pidginprotocolstore.c
pidgin/pidginscrollbook.c
+pidgin/pidginstatusprimitivechooser.c +pidgin/pidginstatusprimitivestore.c pidgin/pidginstylecontext.c
pidgin/plugins/disco/gtkdisco.c