diff options
author | Davyd Madeley <davyd@madeley.id.au> | 2009-04-23 19:47:52 +0800 |
---|---|---|
committer | Davyd Madeley <davyd@madeley.id.au> | 2009-04-23 19:47:52 +0800 |
commit | 5b4b6de8f4bc1484184ee469e1c976e1e7d96034 (patch) | |
tree | 5a4d5fc6ce4a76565a684e0aeec0e4dc342a3287 | |
parent | e1a592f9b27d98b4bf6c8f05fb2c524a177f185e (diff) | |
download | gsoc2013-empathy-5b4b6de8f4bc1484184ee469e1c976e1e7d96034.tar gsoc2013-empathy-5b4b6de8f4bc1484184ee469e1c976e1e7d96034.tar.gz gsoc2013-empathy-5b4b6de8f4bc1484184ee469e1c976e1e7d96034.tar.bz2 gsoc2013-empathy-5b4b6de8f4bc1484184ee469e1c976e1e7d96034.tar.lz gsoc2013-empathy-5b4b6de8f4bc1484184ee469e1c976e1e7d96034.tar.xz gsoc2013-empathy-5b4b6de8f4bc1484184ee469e1c976e1e7d96034.tar.zst gsoc2013-empathy-5b4b6de8f4bc1484184ee469e1c976e1e7d96034.zip |
Preserve the status message across combo box changes
-rw-r--r-- | libempathy-gtk/empathy-status-preset-dialog.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c index 0fe577d97..f7171e4ef 100644 --- a/libempathy-gtk/empathy-status-preset-dialog.c +++ b/libempathy-gtk/empathy-status-preset-dialog.c @@ -63,6 +63,7 @@ struct _EmpathyStatusPresetDialogPriv GtkTreeIter selected_iter; gboolean add_combo_changed; + char *saved_status; }; enum @@ -83,11 +84,22 @@ enum }; static void +empathy_status_preset_dialog_finalize (GObject *self) +{ + EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self); + + g_free (priv->saved_status); + + G_OBJECT_CLASS (empathy_status_preset_dialog_parent_class)->finalize (self); +} + +static void empathy_status_preset_dialog_class_init (EmpathyStatusPresetDialogClass *class) { GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (class); + gobject_class->finalize = empathy_status_preset_dialog_finalize; g_type_class_add_private (gobject_class, sizeof (EmpathyStatusPresetDialogPriv)); @@ -371,12 +383,17 @@ status_preset_dialog_add_combo_changed (GtkComboBox *combo, g_free (icon_name); status_preset_dialog_set_add_combo_changed (self, FALSE, TRUE); + if (priv->saved_status && strlen (priv->saved_status) > 0) { + gtk_entry_set_text (GTK_ENTRY (entry), + priv->saved_status); + } } else { - const char *status; + g_free (priv->saved_status); + priv->saved_status = g_strdup ( + gtk_entry_get_text (GTK_ENTRY (entry))); - status = gtk_entry_get_text (GTK_ENTRY (entry)); status_preset_dialog_set_add_combo_changed (self, - strlen (status) > 0, FALSE); + strlen (priv->saved_status) > 0, FALSE); } } |