diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/caja-connect-server-dialog.c | 141 |
1 files changed, 71 insertions, 70 deletions
diff --git a/src/caja-connect-server-dialog.c b/src/caja-connect-server-dialog.c index c9938e6e..c150e5fd 100644 --- a/src/caja-connect-server-dialog.c +++ b/src/caja-connect-server-dialog.c @@ -42,6 +42,7 @@ /* TODO: * - name entry + pre-fill + * - NetworkManager integration */ struct _CajaConnectServerDialogDetails @@ -101,7 +102,7 @@ enum { DEFAULT_METHOD = (1 << 0), - /* Widgets to display in setup_for_type */ + /* Widgets to display in connect_dialog_setup_for_type */ SHOW_SHARE = (1 << 1), SHOW_PORT = (1 << 2), SHOW_USER = (1 << 3), @@ -149,8 +150,8 @@ get_method_description (struct MethodInfo *meth) } static void -dialog_restore_info_bar (CajaConnectServerDialog *dialog, - GtkMessageType message_type) +connect_dialog_restore_info_bar (CajaConnectServerDialog *dialog, + GtkMessageType message_type) { if (dialog->details->info_bar_content != NULL) { gtk_widget_destroy (dialog->details->info_bar_content); @@ -162,14 +163,14 @@ dialog_restore_info_bar (CajaConnectServerDialog *dialog, } static void -dialog_set_connecting (CajaConnectServerDialog *dialog) +connect_dialog_set_connecting (CajaConnectServerDialog *dialog) { GtkWidget *hbox; GtkWidget *widget; GtkWidget *content_area; gint width, height; - dialog_restore_info_bar (dialog, GTK_MESSAGE_INFO); + connect_dialog_restore_info_bar (dialog, GTK_MESSAGE_INFO); gtk_widget_show (dialog->details->info_bar); content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (dialog->details->info_bar)); @@ -271,14 +272,14 @@ iconize_entry (CajaConnectServerDialog *dialog, } static void -set_info_bar_error (CajaConnectServerDialog *dialog, - GError *error) +connect_dialog_set_info_bar_error (CajaConnectServerDialog *dialog, + GError *error) { GtkWidget *content_area, *label, *entry, *hbox, *icon; gchar *str; const gchar *folder, *server; - dialog_restore_info_bar (dialog, GTK_MESSAGE_WARNING); + connect_dialog_restore_info_bar (dialog, GTK_MESSAGE_WARNING); content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (dialog->details->info_bar)); entry = NULL; @@ -339,7 +340,7 @@ set_info_bar_error (CajaConnectServerDialog *dialog, } static void -dialog_finish_fill (CajaConnectServerDialog *dialog) +connect_dialog_finish_fill (CajaConnectServerDialog *dialog) { GAskPasswordFlags flags; GMountOperation *op; @@ -364,7 +365,7 @@ dialog_finish_fill (CajaConnectServerDialog *dialog) g_mount_operation_set_password_save (op, G_PASSWORD_SAVE_PERMANENTLY); } - dialog_set_connecting (dialog); + connect_dialog_set_connecting (dialog); g_simple_async_result_set_op_res_gboolean (dialog->details->fill_details_res, TRUE); g_simple_async_result_complete (dialog->details->fill_details_res); @@ -377,16 +378,16 @@ dialog_finish_fill (CajaConnectServerDialog *dialog) } static void -dialog_request_additional_details (CajaConnectServerDialog *self, - GAskPasswordFlags flags, - const gchar *default_user, - const gchar *default_domain) +connect_dialog_request_additional_details (CajaConnectServerDialog *self, + GAskPasswordFlags flags, + const gchar *default_user, + const gchar *default_domain) { GtkWidget *content_area, *label, *entry, *hbox, *icon; self->details->fill_details_flags = flags; - dialog_restore_info_bar (self, GTK_MESSAGE_WARNING); + connect_dialog_restore_info_bar (self, GTK_MESSAGE_WARNING); content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (self->details->info_bar)); entry = NULL; @@ -458,7 +459,7 @@ display_location_async_cb (GObject *source, res, &error); if (error != NULL) { - set_info_bar_error (dialog, error); + connect_dialog_set_info_bar_error (dialog, error); g_error_free (error); } else { gtk_widget_destroy (GTK_WIDGET (dialog)); @@ -489,7 +490,7 @@ mount_enclosing_ready_cb (GObject *source, if (dialog->details->should_destroy) { gtk_widget_destroy (GTK_WIDGET (dialog)); } else { - set_info_bar_error (dialog, error); + connect_dialog_set_info_bar_error (dialog, error); } } @@ -499,9 +500,9 @@ mount_enclosing_ready_cb (GObject *source, } static void -dialog_present_uri_async (CajaConnectServerDialog *self, - CajaApplication *application, - GFile *location) +connect_dialog_present_uri_async (CajaConnectServerDialog *self, + CajaApplication *application, + GFile *location) { GMountOperation *op; @@ -513,7 +514,7 @@ dialog_present_uri_async (CajaConnectServerDialog *self, } static void -connect_to_server (CajaConnectServerDialog *dialog) +connect_dialog_connect_to_server (CajaConnectServerDialog *dialog) { struct MethodInfo *meth; GFile *location; @@ -615,10 +616,10 @@ connect_to_server (CajaConnectServerDialog *dialog) location = g_file_new_for_uri (uri); g_free (uri); - dialog_set_connecting (dialog); - dialog_present_uri_async (dialog, - dialog->details->application, - location); + connect_dialog_set_connecting (dialog); + connect_dialog_present_uri_async (dialog, + dialog->details->application, + location); g_object_unref (location); } @@ -627,14 +628,14 @@ static void connect_to_server_or_finish_fill (CajaConnectServerDialog *dialog) { if (dialog->details->fill_details_res != NULL) { - dialog_finish_fill (dialog); + connect_dialog_finish_fill (dialog); } else { - connect_to_server (dialog); + connect_dialog_connect_to_server (dialog); } } static gboolean -abort_mount_operation (CajaConnectServerDialog *dialog) +connect_dialog_abort_mount_operation (CajaConnectServerDialog *dialog) { if (dialog->details->fill_details_res != NULL) { g_simple_async_result_set_op_res_gboolean (dialog->details->fill_details_res, FALSE); @@ -655,9 +656,9 @@ abort_mount_operation (CajaConnectServerDialog *dialog) } static void -destroy_dialog (CajaConnectServerDialog *dialog) +connect_dialog_destroy (CajaConnectServerDialog *dialog) { - if (abort_mount_operation (dialog)) { + if (connect_dialog_abort_mount_operation (dialog)) { dialog->details->should_destroy = TRUE; } else { gtk_widget_destroy (GTK_WIDGET (dialog)); @@ -665,9 +666,9 @@ destroy_dialog (CajaConnectServerDialog *dialog) } static void -response_callback (CajaConnectServerDialog *dialog, - int response_id, - gpointer data) +connect_dialog_response_cb (CajaConnectServerDialog *dialog, + int response_id, + gpointer data) { GError *error; @@ -679,7 +680,7 @@ response_callback (CajaConnectServerDialog *dialog, case GTK_RESPONSE_NONE: case GTK_RESPONSE_DELETE_EVENT: case GTK_RESPONSE_CANCEL: - destroy_dialog (dialog); + connect_dialog_destroy (dialog); break; case GTK_RESPONSE_HELP : error = NULL; @@ -699,7 +700,7 @@ response_callback (CajaConnectServerDialog *dialog, } static void -dialog_cleanup (CajaConnectServerDialog *dialog) +connect_dialog_cleanup (CajaConnectServerDialog *dialog) { /* hide the infobar */ gtk_widget_hide (dialog->details->info_bar); @@ -709,7 +710,7 @@ dialog_cleanup (CajaConnectServerDialog *dialog) _("C_onnect")); /* if there was a pending mount operation, cancel it. */ - abort_mount_operation (dialog); + connect_dialog_abort_mount_operation (dialog); /* restore password checkbox sensitivity */ if (dialog->details->password_sensitive_id == 0) { @@ -731,41 +732,13 @@ dialog_cleanup (CajaConnectServerDialog *dialog) } static void -caja_connect_server_dialog_finalize (GObject *object) -{ - CajaConnectServerDialog *dialog; - - dialog = CAJA_CONNECT_SERVER_DIALOG (object); - - abort_mount_operation (dialog); - - if (dialog->details->iconized_entries != NULL) { - g_list_free (dialog->details->iconized_entries); - dialog->details->iconized_entries = NULL; - } - - G_OBJECT_CLASS (caja_connect_server_dialog_parent_class)->finalize (object); -} - -static void -caja_connect_server_dialog_class_init (CajaConnectServerDialogClass *class) -{ - GObjectClass *oclass; - - oclass = G_OBJECT_CLASS (class); - oclass->finalize = caja_connect_server_dialog_finalize; - - g_type_class_add_private (class, sizeof (CajaConnectServerDialogDetails)); -} - -static void -setup_for_type (CajaConnectServerDialog *dialog) +connect_dialog_setup_for_type (CajaConnectServerDialog *dialog) { struct MethodInfo *meth; int index; GtkTreeIter iter; - dialog_cleanup (dialog); + connect_dialog_cleanup (dialog); /* get our method info */ if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (dialog->details->type_combo), @@ -1005,7 +978,7 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND, 6, 3); g_signal_connect_swapped (combo, "changed", - G_CALLBACK (setup_for_type), + G_CALLBACK (connect_dialog_setup_for_type), dialog); /* third row: share entry */ @@ -1144,10 +1117,38 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) connect_button); g_signal_connect (dialog, "response", - G_CALLBACK (response_callback), + G_CALLBACK (connect_dialog_response_cb), dialog); - setup_for_type (dialog); + connect_dialog_setup_for_type (dialog); +} + +static void +caja_connect_server_dialog_finalize (GObject *object) +{ + CajaConnectServerDialog *dialog; + + dialog = CAJA_CONNECT_SERVER_DIALOG (object); + + connect_dialog_abort_mount_operation (dialog); + + if (dialog->details->iconized_entries != NULL) { + g_list_free (dialog->details->iconized_entries); + dialog->details->iconized_entries = NULL; + } + + G_OBJECT_CLASS (caja_connect_server_dialog_parent_class)->finalize (object); +} + +static void +caja_connect_server_dialog_class_init (CajaConnectServerDialogClass *class) +{ + GObjectClass *oclass; + + oclass = G_OBJECT_CLASS (class); + oclass->finalize = caja_connect_server_dialog_finalize; + + g_type_class_add_private (class, sizeof (CajaConnectServerDialogDetails)); } GtkWidget * @@ -1238,7 +1239,7 @@ caja_connect_server_dialog_fill_details_async (CajaConnectServerDialog *self, if (set_flags != 0) { set_flags |= (flags & G_ASK_PASSWORD_SAVING_SUPPORTED); self->details->fill_operation = g_object_ref (operation); - dialog_request_additional_details (self, set_flags, default_user, default_domain); + connect_dialog_request_additional_details (self, set_flags, default_user, default_domain); } else { g_simple_async_result_set_op_res_gboolean (fill_details_res, TRUE); g_simple_async_result_complete (fill_details_res); |