GTK file dialog
Piero
piero at poprostu.pl
Wed Sep 3 06:17:48 PDT 2003
HI,
I don't know whether this wasn't discussed in the past. Well, we are all
waiting for the promised new file dialog in GTK+ and it is pretty
delayed. I remember how it was supposed to go with GNOME 2.4.
Meanwhile I found a patch that slightly moderates the dialog look and
functionality. Maybe it would be good to integrate it into the ports?
Giving a user an option to enable it with a knob or so (is it possible
at all to turn off/on a patch with a knob?)
I just put it into /usr/ports/x11-toolkits/gtk20/files as one more
patch, and after two port updaes and cannot see any obstacles. If you
wanna see the modified dialog, here is a screenshot:
http://www.smyrak.com/~smyru/screenshots/patched-gtk-file-dialog.png
Here it comes itself - inline for Mezz :-)
---- patch-file-selector starts ----
diff -bur gtk/gtkfilesel.c gtk/gtkfilesel.c
--- gtk/gtkfilesel.c 2002-12-15 02:51:22.000000000 +0100
+++ gtk/gtkfilesel.c 2003-01-01 17:59:49.000000000 +0100
@@ -410,6 +410,7 @@
static void gtk_file_selection_create_dir (GtkWidget *widget, gpointer
data);
static void gtk_file_selection_delete_file (GtkWidget *widget, gpointer
data);
static void gtk_file_selection_rename_file (GtkWidget *widget, gpointer
data);
+static void gtk_file_selection_up_dir (GtkWidget *widget, gpointer data);
static void free_selected_names (GPtrArray *names);
@@ -623,6 +624,8 @@
dialog = GTK_DIALOG (filesel);
+ gtk_window_set_default_size (GTK_WINDOW(dialog), 450, 400);
+
filesel->cmpl_state = cmpl_init_state ();
/* The dialog-sized vertical box */
@@ -640,14 +643,32 @@
gtk_file_selection_show_fileop_buttons (filesel);
/* hbox for pulldown menu */
- pulldown_hbox = gtk_hbox_new (TRUE, 5);
+ pulldown_hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), pulldown_hbox,
FALSE, FALSE, 0);
gtk_widget_show (pulldown_hbox);
+ /* folder up button */
+ filesel->folder_up_button =
gtk_button_new_from_stock(GTK_STOCK_GO_UP);
+ g_signal_connect (filesel->folder_up_button, "clicked",
+ G_CALLBACK (gtk_file_selection_up_dir)
+ ,filesel);
+ gtk_widget_show (filesel->folder_up_button);
+ gtk_box_pack_start (GTK_BOX (pulldown_hbox),
filesel->folder_up_button, FALSE, FALSE, 0);
+
+
/* Pulldown menu */
filesel->history_pulldown = gtk_option_menu_new ();
gtk_widget_show (filesel->history_pulldown);
gtk_box_pack_start (GTK_BOX (pulldown_hbox),
filesel->history_pulldown,
+ TRUE, TRUE, 0);
+
+ /* New folder button */
+ filesel->folder_new_button = gtk_button_new_with_mnemonic (_("_New
Folder"));
+ g_signal_connect (filesel->folder_new_button, "clicked",
+ G_CALLBACK (gtk_file_selection_create_dir),
+ filesel);
+ gtk_widget_show (filesel->folder_new_button);
+ gtk_box_pack_start (GTK_BOX (pulldown_hbox),
filesel->folder_new_button,
FALSE, FALSE, 0);
/* The horizontal box containing the directory and file listboxes
*/
@@ -1063,7 +1084,7 @@
g_return_if_fail (GTK_IS_FILE_SELECTION (filesel));
/* delete, create directory, and rename */
- if (!filesel->fileop_c_dir)
+ /*if (!filesel->fileop_c_dir)
{
filesel->fileop_c_dir = gtk_button_new_with_mnemonic (_("_New
Folder"));
g_signal_connect (filesel->fileop_c_dir, "clicked",
@@ -1095,7 +1116,7 @@
filesel->fileop_ren_file, TRUE, TRUE, 0);
gtk_widget_show (filesel->fileop_ren_file);
}
-
+ */
gtk_file_selection_update_fileops (filesel);
g_object_notify (G_OBJECT (filesel), "show_fileops");
@@ -1487,6 +1508,13 @@
}
static void
+gtk_file_selection_up_dir (GtkWidget *widget, gpointer data)
+{
+ GtkFileSelection *fs = data;
+ gtk_file_selection_populate (fs, "../" , FALSE, FALSE);
+}
+
+static void
gtk_file_selection_delete_file_response (GtkDialog *dialog,
gint response_id,
gpointer data)
@@ -2089,10 +2117,11 @@
gtk_list_store_clear (file_model);
/* Set the dir list to include ./ and ../ */
- gtk_list_store_append (dir_model, &iter);
+ /*gtk_list_store_append (dir_model, &iter);
gtk_list_store_set (dir_model, &iter, DIR_COLUMN, "."
G_DIR_SEPARATOR_S, -1);
gtk_list_store_append (dir_model, &iter);
gtk_list_store_set (dir_model, &iter, DIR_COLUMN, ".."
G_DIR_SEPARATOR_S, -1);
+ */
while (poss)
{
diff -bur gtk/gtkfilesel.h gtk/gtkfilesel.h
--- gtk/gtkfilesel.h 2002-10-10 17:36:35.000000000 +0200
+++ gtk/gtkfilesel.h 2003-01-01 17:14:27.000000000 +0100
@@ -68,6 +68,9 @@
gchar *fileop_file;
gpointer cmpl_state;
+ GtkWidget *folder_up_button;
+ GtkWidget *folder_new_button;
+
GtkWidget *fileop_c_dir;
GtkWidget *fileop_del_file;
GtkWidget *fileop_ren_file;
---- patch-file-selector ends ----
--
Piero
piero at poprostu.pl
More information about the freebsd-gnome
mailing list