From: Guillaume Desmottes Date: Tue, 23 Aug 2011 09:08:23 +0000 (+0200) Subject: make code displaying the 'no match found' page more generic X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=c1adae17180cc2b1a0215fadbbfe22c701379e94 make code displaying the 'no match found' page more generic https://bugzilla.gnome.org/show_bug.cgi?id=656097 --- diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c index 0e9768bf..8f5bcf2f 100644 --- a/src/empathy-roster-window.c +++ b/src/empathy-roster-window.c @@ -92,7 +92,7 @@ enum { PAGE_CONTACT_LIST = 0, - PAGE_NO_MATCH + PAGE_MESSAGE }; enum @@ -607,6 +607,23 @@ OUT: tp_clear_object (&individual); } +static void +display_page_message (EmpathyRosterWindow *self, + const gchar *msg) +{ + gchar *tmp; + + tmp = g_strdup_printf ("%s", msg); + + gtk_label_set_markup (GTK_LABEL (self->priv->no_entry_label), tmp); + g_free (tmp); + + gtk_label_set_line_wrap (GTK_LABEL (self->priv->no_entry_label), TRUE); + + gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv->notebook), + PAGE_MESSAGE); +} + static void roster_window_row_deleted_cb (GtkTreeModel *model, GtkTreePath *path, @@ -620,23 +637,18 @@ roster_window_row_deleted_cb (GtkTreeModel *model, if (empathy_individual_view_is_searching (self->priv->individual_view)) { - gchar *tmp; - - tmp = g_strdup_printf ("%s", - _("No match found")); - - gtk_label_set_markup (GTK_LABEL (self->priv->no_entry_label), tmp); - g_free (tmp); - - gtk_label_set_line_wrap (GTK_LABEL (self->priv->no_entry_label), - TRUE); - - gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv->notebook), - PAGE_NO_MATCH); + display_page_message (self, _("No match found")); } } } +static void +display_page_contact_list (EmpathyRosterWindow *self) +{ + gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv->notebook), + PAGE_CONTACT_LIST); +} + static void roster_window_row_inserted_cb (GtkTreeModel *model, GtkTreePath *path, @@ -646,8 +658,8 @@ roster_window_row_inserted_cb (GtkTreeModel *model, if (self->priv->empty) { self->priv->empty = FALSE; - gtk_notebook_set_current_page (GTK_NOTEBOOK (self->priv->notebook), - PAGE_CONTACT_LIST); + + display_page_contact_list (self); gtk_widget_grab_focus (GTK_WIDGET (self->priv->individual_view)); /* The store is being filled, it will be done after an idle cb.