Factor out show_gnome_contacts_error_dialog()
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 7 Feb 2012 14:45:36 +0000 (15:45 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 8 Feb 2012 13:30:43 +0000 (14:30 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=669578

libempathy-gtk/empathy-individual-menu.c

index b891854dadb66aaaf4f756aa49b592a211fcdbae..b877b55484b7dd8de6b7c6b9a4c90c6fa28d5a2e 100644 (file)
@@ -1291,6 +1291,24 @@ empathy_individual_favourite_menu_item_new (FolksIndividual *individual)
   return item;
 }
 
+static void
+show_gnome_contacts_error_dialog (void)
+{
+  GtkWidget *dialog;
+
+  dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+      GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+      _("gnome-contacts not installed"));
+
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+      _("Please install gnome-contacts to access contacts details."));
+
+  g_signal_connect_swapped (dialog, "response",
+          G_CALLBACK (gtk_widget_destroy), dialog);
+
+  gtk_widget_show (dialog);
+}
+
 static void
 individual_info_menu_item_activate_cb (FolksIndividual *individual)
 {
@@ -1308,22 +1326,9 @@ individual_info_menu_item_activate_cb (FolksIndividual *individual)
   desktop_info = g_desktop_app_info_new ("gnome-contacts.desktop");
   if (desktop_info == NULL)
     {
-      GtkWidget *dialog;
-
       DEBUG ("gnome-contacts not installed");
 
-      dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
-          GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
-          _("gnome-contacts not installed"));
-
-      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-          _("Please install gnome-contacts to access contacts details."));
-
-      g_signal_connect_swapped (dialog, "response",
-          G_CALLBACK (gtk_widget_destroy),
-          dialog);
-
-      gtk_widget_show (dialog);
+      show_gnome_contacts_error_dialog ();
       return;
     }