[gnome-commander] Use a gtk entry widget in the xfer dialog again
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Use a gtk entry widget in the xfer dialog again
- Date: Sat, 11 Apr 2020 16:13:15 +0000 (UTC)
commit 2231b7bedb2505eeb2fb04630f7e359b8b0e72eb
Author: Uwe Scholz <u scholz83 gmx de>
Date: Sun Apr 5 22:46:41 2020 +0200
Use a gtk entry widget in the xfer dialog again
src/dialogs/gnome-cmd-prepare-xfer-dialog.cc | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-prepare-xfer-dialog.cc b/src/dialogs/gnome-cmd-prepare-xfer-dialog.cc
index 555925e7..5d58b9c6 100644
--- a/src/dialogs/gnome-cmd-prepare-xfer-dialog.cc
+++ b/src/dialogs/gnome-cmd-prepare-xfer-dialog.cc
@@ -48,8 +48,7 @@ inline gboolean con_device_has_path (FileSelectorID fsID, GnomeCmdCon *&dev, con
static void on_ok (GtkButton *button, GnomeCmdPrepareXferDialog *dialog)
{
GnomeCmdCon *con = gnome_cmd_dir_get_connection (dialog->default_dest_dir);
- gchar *user_path = g_strstrip (g_strdup (gtk_label_get_text (GTK_LABEL (dialog->dest_dir_entry))));
- gchar *user_directory_path = g_strstrip (g_strdup (gtk_label_get_text (GTK_LABEL
(dialog->dest_dir_entry))));
+ gchar *user_path = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->dest_dir_entry))));
gchar *dest_path = NULL;
gchar *dest_fn = NULL;
@@ -257,6 +256,11 @@ static gboolean on_dest_dir_entry_keypressed (GtkEntry *entry, GdkEventKey *even
gtk_signal_emit_by_name (GTK_OBJECT (dialog->ok_button), "clicked", dialog, NULL);
return TRUE;
+ case GDK_F5:
+ case GDK_F6:
+ gnome_cmd_toggle_file_name_selection (dialog->dest_dir_entry);
+ return TRUE;
+
default:
return FALSE;
}
@@ -299,7 +303,7 @@ static void class_init (GnomeCmdPrepareXferDialogClass *klass)
static void init (GnomeCmdPrepareXferDialog *dialog)
{
- GtkWidget *dest_dir_vbox;
+ GtkWidget *dest_dir_vbox, *dir_entry, *label;
// dest dir
dest_dir_vbox = create_vbox (GTK_WIDGET (dialog), FALSE, 0);
@@ -307,9 +311,13 @@ static void init (GnomeCmdPrepareXferDialog *dialog)
dialog->dest_dir_frame = create_category (GTK_WIDGET (dialog), dest_dir_vbox, "");
gnome_cmd_dialog_add_category (GNOME_CMD_DIALOG (dialog), dialog->dest_dir_frame);
- GtkWidget *dest_dir_file_label = create_label (GTK_WIDGET (dialog), "");
- gtk_box_pack_start (GTK_BOX (dest_dir_vbox), dest_dir_file_label, FALSE, FALSE, 0);
- dialog->dest_dir_entry = dest_dir_file_label;
+ dir_entry = gtk_entry_new ();
+ gtk_box_pack_start (GTK_BOX (dest_dir_vbox), dir_entry, TRUE, TRUE, 0);
+ dialog->dest_dir_entry = dir_entry;
+
+ gtk_widget_show_all (dialog->dest_dir_entry);
+
+ g_signal_connect (dialog->dest_dir_entry, "key-press-event", G_CALLBACK (on_dest_dir_entry_keypressed),
dialog);
// options
GtkWidget *options_hbox = create_hbox (GTK_WIDGET (dialog), TRUE, 6);
@@ -324,7 +332,6 @@ static void init (GnomeCmdPrepareXferDialog *dialog)
dialog->right_vbox_frame = create_category (GTK_WIDGET (dialog), dialog->right_vbox, "");
gtk_container_add (GTK_CONTAINER (options_hbox), dialog->right_vbox_frame);
-
// buttons
dialog->cancel_button = gnome_cmd_dialog_add_button (GNOME_CMD_DIALOG (dialog), GTK_STOCK_CANCEL, NULL,
NULL);
dialog->ok_button = gnome_cmd_dialog_add_button (GNOME_CMD_DIALOG (dialog), GTK_STOCK_OK, NULL, NULL);
@@ -426,9 +433,11 @@ GtkWidget *gnome_cmd_prepare_xfer_dialog_new (GnomeCmdFileSelector *from, GnomeC
if (dest_str)
{
- gtk_label_set_text (GTK_LABEL (dialog->dest_dir_entry), dest_str);
+ gtk_entry_set_text (GTK_ENTRY (dialog->dest_dir_entry), dest_str);
g_free (dest_str);
}
+ gtk_widget_grab_focus (GTK_WIDGET (dialog->dest_dir_entry));
+
return GTK_WIDGET (dialog);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]