[gnome-commander] Removed password input dialog as it is already provided by gnome-vfs, bgo#653573
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Removed password input dialog as it is already provided by gnome-vfs, bgo#653573
- Date: Mon, 11 May 2015 20:53:10 +0000 (UTC)
commit 30b17b316e67542b9c1b0aeecb7bc8518211d719
Author: Uwe Scholz <uwescholz src gnome org>
Date: Mon May 11 22:35:45 2015 +0200
Removed password input dialog as it is already provided by gnome-vfs, bgo#653573
src/gnome-cmd-con.cc | 112 --------------------------------------------
src/gnome-cmd-con.h | 2 -
src/gnome-cmd-file-list.cc | 5 --
3 files changed, 0 insertions(+), 119 deletions(-)
---
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index 6e3e8f8..44a8df8 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -546,115 +546,3 @@ XML::xstream &operator << (XML::xstream &xml, GnomeCmdCon &con)
return xml << XML::endtag();
}
-
-
-/**
- * This callback function takes a const char* pointer and points it to a
- * newly created char array of the password the user has typed in the
- * associated dialog entry. The memory where @c password points to has
- * to be freed elsewhere.
- */
-void set_password_callback (GtkDialog *dialog, int response_id, const char **password)
-{
- switch (response_id)
- {
- case GTK_RESPONSE_OK:
- {
- const char *passwd = NULL; /* local pointer pointing to const-defined memory area */
-
- const gchar *entry = gtk_entry_get_text (GTK_ENTRY (lookup_widget (GTK_WIDGET (dialog),
"password")));
- int length = strlen(entry);
- if (( passwd = (const char *) malloc(length * sizeof(char) + 1)) == NULL)
- {
- DEBUG ('m', "Not enough memory for temporary storing the password!\n");
- break;
- }
-
- strcpy((char*) passwd, entry);
- *password = passwd;
- }
- break;
-
- case GTK_RESPONSE_NONE:
- case GTK_RESPONSE_DELETE_EVENT:
- case GTK_RESPONSE_CANCEL:
- break;
-
- default :
- g_assert_not_reached ();
- }
-}
-
-/**
- * A small dialog for setting the password. The const char pointer to
- * the password has to be freed outside of this function!
- */
-const char* GnomeCmdCon::gnome_cmd_con_set_password()
-{
- const char *password = NULL;
- GtkWidget *table;
- GtkWidget *entry;
- GtkWidget *label;
- GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Password for..."), GTK_WINDOW(window),
- GtkDialogFlags (GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
-#if GTK_CHECK_VERSION (2, 14, 0)
- GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
-#endif
-
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
-
- // HIG defaults
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
-#if GTK_CHECK_VERSION (2, 14, 0)
- gtk_box_set_spacing (GTK_BOX (content_area), 2);
- gtk_container_set_border_width (GTK_CONTAINER (content_area), 5);
- gtk_box_set_spacing (GTK_BOX (content_area),6);
-#else
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area),6);
-#endif
- table = gtk_table_new (3, 2, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (table), 5);
- gtk_table_set_row_spacings (GTK_TABLE (table), 6);
- gtk_table_set_col_spacings (GTK_TABLE (table), 12);
-#if GTK_CHECK_VERSION (2, 14, 0)
- gtk_container_add (GTK_CONTAINER (content_area), table);
-#else
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), table);
-#endif
-
- GnomeVFSURI *urivfs = gnome_vfs_uri_new (uri);
-
- label = gtk_label_new (gnome_vfs_uri_to_string (urivfs, GNOME_VFS_URI_HIDE_NONE));
- gnome_vfs_uri_unref (urivfs);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
-
- entry = gtk_entry_new ();
- g_object_set_data (G_OBJECT (dialog), "password", entry);
- gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
- gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
- gtk_table_attach_defaults (GTK_TABLE (table), entry, 0, 2, 1, 2);
-
-#if GTK_CHECK_VERSION (2, 14, 0)
- gtk_widget_show_all (content_area);
-#else
- gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
-#endif
-
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
-
- g_signal_connect (dialog, "response", G_CALLBACK (set_password_callback), (gpointer) &password);
-
- gtk_dialog_run (GTK_DIALOG (dialog));
-
- gtk_widget_destroy (dialog);
-
- return password;
-}
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index dfdc70b..553d10f 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -117,8 +117,6 @@ struct GnomeCmdCon
GnomeCmdConPrivate *priv;
friend XML::xstream &operator << (XML::xstream &xml, GnomeCmdCon &con);
- const char *password;
- const char *gnome_cmd_con_set_password();
};
struct GnomeCmdConClass
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 5af845d..d46ed16 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -2516,11 +2516,6 @@ void GnomeCmdFileList::set_connection (GnomeCmdCon *new_con, GnomeCmdDir *start_
g_signal_connect (new_con, "open-failed", G_CALLBACK (on_con_open_failed), this);
priv->con_opening = new_con;
- if (new_con->auth != GnomeCmdCon::NOT_REQUIRED)
- {
- new_con->password = new_con->gnome_cmd_con_set_password(); //TODO: password should be a private
member variable of GnomeCmdCon someday!
- g_return_if_fail (new_con->password);
- }
create_con_open_progress_dialog (this);
g_timeout_add (gnome_cmd_data.gui_update_rate, (GSourceFunc) update_con_open_progress, this);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]