summaryrefslogtreecommitdiff
path: root/src/caja-connect-server-dialog.c
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-10-27 06:17:00 +0200
committerJasmine Hassan <[email protected]>2012-11-16 09:45:51 +0200
commitcd93992b95b9b16f0c41ad200da7cdfc05ded71b (patch)
tree2c47d09620ec06d14ddc40701f9aee8cdac7f0f3 /src/caja-connect-server-dialog.c
parent337155137426e1a07049f59f8a7ec63ec4b94c80 (diff)
downloadcaja-cd93992b95b9b16f0c41ad200da7cdfc05ded71b.tar.bz2
caja-cd93992b95b9b16f0c41ad200da7cdfc05ded71b.tar.xz
[connect-dialog] display a fatal error if GVfs doesn't have methods
I.e. when GVfs is not installed. http://git.gnome.org/browse/nautilus/commit/?id=1b79a8666fee56cdb704e8757f28acf486f7dc54
Diffstat (limited to 'src/caja-connect-server-dialog.c')
-rw-r--r--src/caja-connect-server-dialog.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/caja-connect-server-dialog.c b/src/caja-connect-server-dialog.c
index 1c759820..c9938e6e 100644
--- a/src/caja-connect-server-dialog.c
+++ b/src/caja-connect-server-dialog.c
@@ -48,6 +48,7 @@ struct _CajaConnectServerDialogDetails
{
CajaApplication *application;
+ GtkWidget *primary_table;
GtkWidget *user_details;
GtkWidget *port_spinbutton;
@@ -193,6 +194,33 @@ dialog_set_connecting (CajaConnectServerDialog *dialog)
gtk_widget_set_sensitive (dialog->details->connect_button, FALSE);
}
+static void
+connect_dialog_gvfs_error (CajaConnectServerDialog *dialog)
+{
+ GtkWidget *hbox, *image, *content_area, *label;
+
+ connect_dialog_restore_info_bar (dialog, GTK_MESSAGE_ERROR);
+
+ content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (dialog->details->info_bar));
+
+ hbox = gtk_hbox_new (FALSE, 6);
+ gtk_container_add (GTK_CONTAINER (content_area), hbox);
+ gtk_widget_show (hbox);
+
+ image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 6);
+ gtk_widget_show (image);
+
+ label = gtk_label_new (_("Can't load the supported server method list.\n"
+ "Please check your GVfs installation."));
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6);
+ gtk_widget_show (label);
+
+ gtk_widget_set_sensitive (dialog->details->connect_button, FALSE);
+ gtk_widget_set_sensitive (dialog->details->primary_table, FALSE);
+
+ gtk_widget_show (dialog->details->info_bar);
+}
static void
iconized_entry_restore (gpointer data,
@@ -740,7 +768,16 @@ setup_for_type (CajaConnectServerDialog *dialog)
dialog_cleanup (dialog);
/* get our method info */
- gtk_combo_box_get_active_iter (GTK_COMBO_BOX (dialog->details->type_combo), &iter);
+ if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (dialog->details->type_combo),
+ &iter)) {
+ /* there are no entries in the combo, something is wrong
+ * with our GVfs installation.
+ */
+ connect_dialog_gvfs_error (dialog);
+
+ return;
+ }
+
gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->details->type_combo)),
&iter, 0, &index, -1);
g_assert (index < G_N_ELEMENTS (methods) && index >= 0);
@@ -852,6 +889,8 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
gtk_container_add (GTK_CONTAINER (alignment), table);
gtk_widget_show (table);
+ dialog->details->primary_table = table;
+
/* first row: server entry + port spinbutton */
label = gtk_label_new_with_mnemonic (_("_Server:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);