mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Added toolbar items for the filter separator and the filter item.
2003-12-10 Federico Mena Quintero <federico@ximian.com> * gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault): Added toolbar items for the filter separator and the filter item. (toolbar_create): Add the filter widgets here. (filter_create): Renamed from create_filter(). Don't store the alignment in the impl structure, just return it. (toolbar_show_filters): New function. (gtk_file_chooser_default_add_filter): Use toolbar_show_filters(). (gtk_file_chooser_default_remove_filter): Likewise. (gtk_file_chooser_default_constructor): Don't create the filter widget here. (struct _GtkFileChooserDefault): Added a field for a current folder label. (gtk_file_chooser_default_constructor): Create the folder label. (gtk_file_chooser_default_set_current_folder): Set the current folder label. * tests/testfilechooser.c (main): Dramatically improved the usability of the extra widget through careful word choice.
This commit is contained in:
parent
e09034088b
commit
c9c99b3f1b
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
||||
2003-12-10 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault):
|
||||
Added toolbar items for the filter separator and the filter item.
|
||||
(toolbar_create): Add the filter widgets here.
|
||||
(filter_create): Renamed from create_filter(). Don't store the
|
||||
alignment in the impl structure, just return it.
|
||||
(toolbar_show_filters): New function.
|
||||
(gtk_file_chooser_default_add_filter): Use toolbar_show_filters().
|
||||
(gtk_file_chooser_default_remove_filter): Likewise.
|
||||
(gtk_file_chooser_default_constructor): Don't create the filter
|
||||
widget here.
|
||||
(struct _GtkFileChooserDefault): Added a field for a current
|
||||
folder label.
|
||||
(gtk_file_chooser_default_constructor): Create the folder label.
|
||||
(gtk_file_chooser_default_set_current_folder): Set the current
|
||||
folder label.
|
||||
|
||||
* tests/testfilechooser.c (main): Dramatically improved the
|
||||
usability of the extra widget through careful word choice.
|
||||
|
||||
2003-12-10 Mark McLoughlin <mark@skynet.ie>
|
||||
|
||||
* gdk/gdk.h: include gdkspawn.h.
|
||||
|
@ -1,3 +1,24 @@
|
||||
2003-12-10 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault):
|
||||
Added toolbar items for the filter separator and the filter item.
|
||||
(toolbar_create): Add the filter widgets here.
|
||||
(filter_create): Renamed from create_filter(). Don't store the
|
||||
alignment in the impl structure, just return it.
|
||||
(toolbar_show_filters): New function.
|
||||
(gtk_file_chooser_default_add_filter): Use toolbar_show_filters().
|
||||
(gtk_file_chooser_default_remove_filter): Likewise.
|
||||
(gtk_file_chooser_default_constructor): Don't create the filter
|
||||
widget here.
|
||||
(struct _GtkFileChooserDefault): Added a field for a current
|
||||
folder label.
|
||||
(gtk_file_chooser_default_constructor): Create the folder label.
|
||||
(gtk_file_chooser_default_set_current_folder): Set the current
|
||||
folder label.
|
||||
|
||||
* tests/testfilechooser.c (main): Dramatically improved the
|
||||
usability of the extra widget through careful word choice.
|
||||
|
||||
2003-12-10 Mark McLoughlin <mark@skynet.ie>
|
||||
|
||||
* gdk/gdk.h: include gdkspawn.h.
|
||||
|
@ -1,3 +1,24 @@
|
||||
2003-12-10 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault):
|
||||
Added toolbar items for the filter separator and the filter item.
|
||||
(toolbar_create): Add the filter widgets here.
|
||||
(filter_create): Renamed from create_filter(). Don't store the
|
||||
alignment in the impl structure, just return it.
|
||||
(toolbar_show_filters): New function.
|
||||
(gtk_file_chooser_default_add_filter): Use toolbar_show_filters().
|
||||
(gtk_file_chooser_default_remove_filter): Likewise.
|
||||
(gtk_file_chooser_default_constructor): Don't create the filter
|
||||
widget here.
|
||||
(struct _GtkFileChooserDefault): Added a field for a current
|
||||
folder label.
|
||||
(gtk_file_chooser_default_constructor): Create the folder label.
|
||||
(gtk_file_chooser_default_set_current_folder): Set the current
|
||||
folder label.
|
||||
|
||||
* tests/testfilechooser.c (main): Dramatically improved the
|
||||
usability of the extra widget through careful word choice.
|
||||
|
||||
2003-12-10 Mark McLoughlin <mark@skynet.ie>
|
||||
|
||||
* gdk/gdk.h: include gdkspawn.h.
|
||||
|
@ -1,3 +1,24 @@
|
||||
2003-12-10 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault):
|
||||
Added toolbar items for the filter separator and the filter item.
|
||||
(toolbar_create): Add the filter widgets here.
|
||||
(filter_create): Renamed from create_filter(). Don't store the
|
||||
alignment in the impl structure, just return it.
|
||||
(toolbar_show_filters): New function.
|
||||
(gtk_file_chooser_default_add_filter): Use toolbar_show_filters().
|
||||
(gtk_file_chooser_default_remove_filter): Likewise.
|
||||
(gtk_file_chooser_default_constructor): Don't create the filter
|
||||
widget here.
|
||||
(struct _GtkFileChooserDefault): Added a field for a current
|
||||
folder label.
|
||||
(gtk_file_chooser_default_constructor): Create the folder label.
|
||||
(gtk_file_chooser_default_set_current_folder): Set the current
|
||||
folder label.
|
||||
|
||||
* tests/testfilechooser.c (main): Dramatically improved the
|
||||
usability of the extra widget through careful word choice.
|
||||
|
||||
2003-12-10 Mark McLoughlin <mark@skynet.ie>
|
||||
|
||||
* gdk/gdk.h: include gdkspawn.h.
|
||||
|
@ -1,3 +1,24 @@
|
||||
2003-12-10 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault):
|
||||
Added toolbar items for the filter separator and the filter item.
|
||||
(toolbar_create): Add the filter widgets here.
|
||||
(filter_create): Renamed from create_filter(). Don't store the
|
||||
alignment in the impl structure, just return it.
|
||||
(toolbar_show_filters): New function.
|
||||
(gtk_file_chooser_default_add_filter): Use toolbar_show_filters().
|
||||
(gtk_file_chooser_default_remove_filter): Likewise.
|
||||
(gtk_file_chooser_default_constructor): Don't create the filter
|
||||
widget here.
|
||||
(struct _GtkFileChooserDefault): Added a field for a current
|
||||
folder label.
|
||||
(gtk_file_chooser_default_constructor): Create the folder label.
|
||||
(gtk_file_chooser_default_set_current_folder): Set the current
|
||||
folder label.
|
||||
|
||||
* tests/testfilechooser.c (main): Dramatically improved the
|
||||
usability of the extra widget through careful word choice.
|
||||
|
||||
2003-12-10 Mark McLoughlin <mark@skynet.ie>
|
||||
|
||||
* gdk/gdk.h: include gdkspawn.h.
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "gtkmessagedialog.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkscrolledwindow.h"
|
||||
#include "gtkseparatortoolitem.h"
|
||||
#include "gtksizegroup.h"
|
||||
#include "gtkstock.h"
|
||||
#include "gtktable.h"
|
||||
@ -95,12 +96,14 @@ struct _GtkFileChooserDefault
|
||||
GtkFilePath *preview_path;
|
||||
|
||||
GtkToolItem *up_button;
|
||||
GtkToolItem *filter_separator;
|
||||
GtkToolItem *filter_item;
|
||||
|
||||
GtkWidget *preview_frame;
|
||||
|
||||
GtkWidget *toolbar;
|
||||
GtkWidget *filter_alignment;
|
||||
GtkWidget *filter_combo;
|
||||
GtkWidget *folder_label;
|
||||
GtkWidget *tree_scrollwin;
|
||||
GtkWidget *tree;
|
||||
GtkWidget *shortcuts_scrollwin;
|
||||
@ -741,6 +744,38 @@ toolbar_add_item (GtkFileChooserDefault *impl,
|
||||
return item;
|
||||
}
|
||||
|
||||
/* Creates the widgets for the filter combo box */
|
||||
static GtkWidget *
|
||||
filter_create (GtkFileChooserDefault *impl)
|
||||
{
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
|
||||
alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
|
||||
gtk_widget_show (alignment);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 12);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("Files of _type:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
impl->filter_combo = gtk_combo_box_new_text ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), impl->filter_combo, FALSE, FALSE, 0);
|
||||
gtk_widget_show (impl->filter_combo);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), impl->filter_combo);
|
||||
|
||||
g_signal_connect (impl->filter_combo, "changed",
|
||||
G_CALLBACK (filter_combo_changed), impl);
|
||||
|
||||
return alignment;
|
||||
}
|
||||
|
||||
/* Creates the toolbar widget */
|
||||
static GtkWidget *
|
||||
toolbar_create (GtkFileChooserDefault *impl)
|
||||
@ -750,6 +785,13 @@ toolbar_create (GtkFileChooserDefault *impl)
|
||||
|
||||
impl->up_button = toolbar_add_item (impl, GTK_STOCK_GO_UP, G_CALLBACK (toolbar_up_cb));
|
||||
|
||||
impl->filter_separator = gtk_separator_tool_item_new ();
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (impl->toolbar), impl->filter_separator, -1);
|
||||
|
||||
impl->filter_item = gtk_tool_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (impl->filter_item), filter_create (impl));
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (impl->toolbar), impl->filter_item, -1);
|
||||
|
||||
return impl->toolbar;
|
||||
}
|
||||
|
||||
@ -775,36 +817,6 @@ toolbar_check_sensitivity (GtkFileChooserDefault *impl)
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (impl->up_button), has_parent);
|
||||
}
|
||||
|
||||
/* Creates the widgets for the filter combo box */
|
||||
static GtkWidget *
|
||||
create_filter (GtkFileChooserDefault *impl)
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
|
||||
impl->filter_alignment = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
|
||||
/* Don't show filter initially -- don't gtk_widget_show() the filter_alignment here */
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 12);
|
||||
gtk_container_add (GTK_CONTAINER (impl->filter_alignment), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("Files of _type:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
impl->filter_combo = gtk_combo_box_new_text ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), impl->filter_combo, FALSE, FALSE, 0);
|
||||
gtk_widget_show (impl->filter_combo);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), impl->filter_combo);
|
||||
|
||||
g_signal_connect (impl->filter_combo, "changed",
|
||||
G_CALLBACK (filter_combo_changed), impl);
|
||||
|
||||
return impl->filter_alignment;
|
||||
}
|
||||
|
||||
/* Creates the widgets for the folder tree */
|
||||
static GtkWidget *
|
||||
create_folder_tree (GtkFileChooserDefault *impl)
|
||||
@ -1291,7 +1303,6 @@ gtk_file_chooser_default_constructor (GType type,
|
||||
GtkWidget *table;
|
||||
GtkWidget *hpaned;
|
||||
GtkWidget *entry_widget;
|
||||
GtkWidget *filter_widget;
|
||||
GtkWidget *widget;
|
||||
GList *focus_chain;
|
||||
GtkWidget *hbox;
|
||||
@ -1320,13 +1331,15 @@ gtk_file_chooser_default_constructor (GType type,
|
||||
gtk_box_pack_start (GTK_BOX (impl), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* Filter */
|
||||
/* Current folder label */
|
||||
|
||||
filter_widget = create_filter (impl);
|
||||
gtk_table_attach (GTK_TABLE (table), filter_widget,
|
||||
impl->folder_label = gtk_label_new (NULL);
|
||||
gtk_misc_set_alignment (GTK_MISC (impl->folder_label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), impl->folder_label,
|
||||
0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, 0,
|
||||
0, 0);
|
||||
gtk_widget_show (impl->folder_label);
|
||||
|
||||
/* Paned widget */
|
||||
|
||||
@ -1393,7 +1406,6 @@ gtk_file_chooser_default_constructor (GType type,
|
||||
/* Make the entry the first widget in the focus chain
|
||||
*/
|
||||
focus_chain = g_list_append (NULL, entry_widget);
|
||||
focus_chain = g_list_append (focus_chain, filter_widget);
|
||||
focus_chain = g_list_append (focus_chain, hpaned);
|
||||
focus_chain = g_list_append (focus_chain, impl->preview_frame);
|
||||
gtk_container_set_focus_chain (GTK_CONTAINER (table), focus_chain);
|
||||
@ -1815,12 +1827,19 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser,
|
||||
const GtkFilePath *path)
|
||||
{
|
||||
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
|
||||
char *str;
|
||||
|
||||
if (impl->current_folder)
|
||||
gtk_file_path_free (impl->current_folder);
|
||||
|
||||
impl->current_folder = gtk_file_path_copy (path);
|
||||
|
||||
/* Change the current folder label */
|
||||
|
||||
str = g_strdup_printf (_("Current folder: %s"), gtk_file_path_get_string (path));
|
||||
gtk_label_set_text (GTK_LABEL (impl->folder_label), str);
|
||||
g_free (str);
|
||||
|
||||
/* Notify the folder tree */
|
||||
|
||||
if (!impl->changing_folder)
|
||||
@ -2057,6 +2076,23 @@ gtk_file_chooser_default_get_file_system (GtkFileChooser *chooser)
|
||||
return impl->file_system;
|
||||
}
|
||||
|
||||
/* Shows or hides the filter widgets */
|
||||
static void
|
||||
toolbar_show_filters (GtkFileChooserDefault *impl,
|
||||
gboolean show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
gtk_widget_show (GTK_WIDGET (impl->filter_separator));
|
||||
gtk_widget_show (GTK_WIDGET (impl->filter_item));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_hide (GTK_WIDGET (impl->filter_separator));
|
||||
gtk_widget_hide (GTK_WIDGET (impl->filter_item));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_default_add_filter (GtkFileChooser *chooser,
|
||||
GtkFileFilter *filter)
|
||||
@ -2083,7 +2119,7 @@ gtk_file_chooser_default_add_filter (GtkFileChooser *chooser,
|
||||
if (!g_slist_find (impl->filters, impl->current_filter))
|
||||
set_current_filter (impl, filter);
|
||||
|
||||
gtk_widget_show (impl->filter_alignment);
|
||||
toolbar_show_filters (impl, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2121,7 +2157,7 @@ gtk_file_chooser_default_remove_filter (GtkFileChooser *chooser,
|
||||
g_object_unref (filter);
|
||||
|
||||
if (!impl->filters)
|
||||
gtk_widget_hide (impl->filter_alignment);
|
||||
toolbar_show_filters (impl, FALSE);
|
||||
}
|
||||
|
||||
static GSList *
|
||||
|
@ -370,7 +370,8 @@ main (int argc, char **argv)
|
||||
G_CALLBACK (update_preview_cb), NULL);
|
||||
|
||||
/* Extra widget */
|
||||
extra = gtk_check_button_new_with_mnemonic ("_Frobnicate the file");
|
||||
extra = gtk_check_button_new_with_mnemonic ("Lar_t whoever asks about this button");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extra), TRUE);
|
||||
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), extra);
|
||||
|
||||
/* Shortcuts */
|
||||
|
Loading…
Reference in New Issue
Block a user