summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);