Re: toolbar issues
- From: Jorn Baayen <jorn nl linux org>
- To: Dave Bordoley <bordoley msu edu>
- Cc: nautilus-list gnome org, galeon-devel lists sourceforge net, usability gnome org
- Subject: Re: toolbar issues
- Date: 20 May 2002 01:22:49 +0200
Here is a patch that addresses all these things, will also attach it to
the relevant bugs. Do with it what you want :)
Cheers
Jorn
On Sun, 2002-05-19 at 22:03, Dave Bordoley wrote:
> 1) There is a feature request in nautilus bugzilla for right click pull
> down arrows like you have described, so yes please even though with our
> ui freeze, i'm not sure if alex will immediately apply it or not.
>
> see bug 45027
>
> Also doesn't galeon 1.2 have these pulldown menus already???
Yeah, but we're talking about galeon2 here - of which most of the code
is being rewritten.
>
> 2)Regarding themable toolbars, Seth Nickel, gnome ui person, also wanted
> to remove the themable toolbars as they create desktop inconsistencies.
>
> see bug 71148
>
>
> If you like i can assign both of these bugs to you, but as always alex
> has final say...
>
> dave
>
>
> On Sun, 2002-05-19 at 09:43, Jorn Baayen wrote:
> > Heya,
> >
> > At the moment the Galeon and Nautilus toolbars have a rightclick popup
> > menu on the back, up, and forward buttons. While this is very useful,
> > it's not very obvious that it's there. Also it has a lot of
> > implementation problems, like bonoboui not really supporting rightclick
> > stuff on toolbar buttons and stuff like that.
> > IMHO Gnumeric and AbiWord solved this much better by having an arrow
> > butotn next to their undo/redo buttons which drops down a list of
> > possible actions. See http://nl.linux.org/~jorn/Files/dropdown.png.
> > That way it's clear it's there, and there are no implementation
> > problems.
> >
> > Personally I would love to see that in both Nautilus and Galeon. I'm
> > writing the Galeon toolbar code, but I could also make a patch for
> > Nautilus if people are interested ...
> >
> > Another thing with the Nauti toolbar is that it uses it's own theming
> > stuff, i think we shouldn't do that in Gnome 2 since stock icons can now
> > be themed. (And we can register app-specific icons with the stock
> > system, so that they can be themed as well). Also it would be nice if
> > some of the buttons had priority. (ie text beside icons, if requested in
> > the toolbar capplet). I can do a patch for this stuff as well, if there
> > is interest.
> >
> > Let me know what you think,
> > Jorn
> >
> > --
> > nautilus-list mailing list
> > nautilus-list gnome org
> > http://mail.gnome.org/mailman/listinfo/nautilus-list
>
? stamp-h1
? src/diff
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5307
diff -u -r1.5307 ChangeLog
--- ChangeLog 17 May 2002 20:19:53 -0000 1.5307
+++ ChangeLog 19 May 2002 23:19:24 -0000
@@ -1,3 +1,11 @@
+2002-05-20 Jorn Baayen <jorn nl linux org>
+
+ * src/nautilus-shell-ui.xml:
+ * src/nautilus-window-private.h:
+ * src/nautilus-window-toolbars.c: always use the gtk stock
+ icons in toolbars, set the priority property for some buttons,
+ add history dropdown buttons, remove rightclick menu.
+
2002-05-17 Alex Larsson <alexl redhat com>
* configure.in:
Index: src/nautilus-shell-ui.xml
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-shell-ui.xml,v
retrieving revision 1.92
diff -u -r1.92 nautilus-shell-ui.xml
--- src/nautilus-shell-ui.xml 8 May 2002 16:34:33 -0000 1.92
+++ src/nautilus-shell-ui.xml 19 May 2002 23:19:25 -0000
@@ -291,24 +291,22 @@
<dockitem name="Toolbar" behavior="exclusive">
- <control name="BackWrapper"
- min_width="48"
- pixtype="stock" pixname="gtk-go-back"/>
- <control name="ForwardWrapper"
- min_width="48"
- pixtype="stock" pixname="gtk-go-forward"/>
- <toolitem name="Up"
- _label="Up"
- min_width="48"
- pixtype="stock" pixname="gtk-go-up"
- verb="Up"/>
+ <toolitem name="Back"
+ _label="Back"
+ priority="1"
+ pixtype="stock" pixname="gtk-go-back"
+ verb="Back"/>
+ <control name="BackMenu"/>
+ <toolitem name="Forward"
+ _label="Forward"
+ pixtype="stock" pixname="gtk-go-forward"
+ verb="Forward"/>
+ <control name="ForwardMenu"/>
<toolitem name="Stop" _label="Stop"
- min_width="48"
pixtype="stock" pixname="gtk-stop"
verb="Stop"/>
<toolitem name="Reload"
_label="Reload"
- min_width="48"
pixtype="stock" pixname="gtk-refresh"
verb="Reload"/>
@@ -316,11 +314,11 @@
<toolitem name="Home"
_label="Home"
- min_width="48"
+ priority="1"
pixtype="stock" pixname="gtk-home"
verb="Home"/>
<toolitem name="Toggle Find Mode"
- min_width="48"
+ priority="1"
type="toggle"
pixtype="stock" pixname="Search"
verb="Toggle Find Mode"/>
Index: src/nautilus-window-private.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-private.h,v
retrieving revision 1.88
diff -u -r1.88 nautilus-window-private.h
--- src/nautilus-window-private.h 13 May 2002 16:04:02 -0000 1.88
+++ src/nautilus-window-private.h 19 May 2002 23:19:26 -0000
@@ -62,8 +62,8 @@
/* Toolbar. */
GtkTooltips *tooltips;
- BonoboUIToolbarButtonItem *back_button_item;
- BonoboUIToolbarButtonItem *forward_button_item;
+ BonoboUIToolbarItem *back_button_item;
+ BonoboUIToolbarItem *forward_button_item;
/* Current location. */
char *location;
Index: src/nautilus-window-toolbars.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-toolbars.c,v
retrieving revision 1.102
diff -u -r1.102 nautilus-window-toolbars.c
--- src/nautilus-window-toolbars.c 13 May 2002 16:04:02 -0000 1.102
+++ src/nautilus-window-toolbars.c 19 May 2002 23:19:26 -0000
@@ -44,7 +44,9 @@
#include <eel/eel-string.h>
#include <gtk/gtkframe.h>
#include <gtk/gtktogglebutton.h>
+#include <gdk/gdkkeysyms.h>
#include <libgnome/gnome-i18n.h>
+#include <libgnomeui/gnome-popup-menu.h>
#include <libnautilus-private/nautilus-bonobo-extensions.h>
#include <libnautilus-private/nautilus-bookmark.h>
#include <libnautilus-private/nautilus-file-utilities.h>
@@ -124,186 +126,81 @@
static GtkWidget *
get_back_button (NautilusWindow *window)
{
- return GTK_WIDGET (bonobo_ui_toolbar_button_item_get_button_widget
- (window->details->back_button_item));
+ return GTK_WIDGET (GTK_BIN
+ (window->details->back_button_item)->child);
}
static GtkWidget *
get_forward_button (NautilusWindow *window)
{
- return GTK_WIDGET (bonobo_ui_toolbar_button_item_get_button_widget
- (window->details->forward_button_item));
+ return GTK_WIDGET (GTK_BIN
+ (window->details->forward_button_item)->child);
}
-static int
-back_or_forward_button_pressed_callback (GtkWidget *widget,
- GdkEventButton *event,
- gpointer *user_data)
+static void
+menu_position_under_widget (GtkMenu *menu, int *x, int *y,
+ gboolean *push_in, gpointer user_data)
{
- NautilusWindow *window;
- gboolean back;
-
- g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE);
- g_return_val_if_fail (NAUTILUS_IS_WINDOW (user_data), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- window = NAUTILUS_WINDOW (user_data);
+ GtkWidget *w = GTK_WIDGET (user_data);
+ int width, height;
+ int screen_width, screen_height;
+ GtkRequisition requisition;
- back = widget == get_back_button (window);
- g_assert (back || widget == get_forward_button (window));
+ gdk_drawable_get_size (w->window, &width, &height);
+ gdk_window_get_origin (w->window, x, y);
+ *y = *y + height;
- if (event->button == 3) {
- eel_pop_up_context_menu (
- create_back_or_forward_menu (NAUTILUS_WINDOW (user_data),
- back),
- EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
- EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
- event);
+ gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
- return TRUE;
- }
+ screen_width = gdk_screen_width ();
+ screen_height = gdk_screen_height ();
- return FALSE;
-
+ *x = CLAMP (*x, 0, MAX (0, screen_width - requisition.width));
+ *y = CLAMP (*y, 0, MAX (0, screen_height - requisition.height));
}
-static void
-back_or_forward_button_clicked_callback (GtkWidget *widget,
- gpointer *user_data)
+static gboolean
+back_or_forward_button_pressed_callback (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer *user_data)
{
NautilusWindow *window;
gboolean back;
- g_return_if_fail (GTK_IS_BUTTON (widget));
- g_return_if_fail (NAUTILUS_IS_WINDOW (user_data));
+ g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE);
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW (user_data), FALSE);
window = NAUTILUS_WINDOW (user_data);
back = widget == get_back_button (window);
g_assert (back || widget == get_forward_button (window));
- if (back) {
- nautilus_window_go_back (window);
- } else {
- nautilus_window_go_forward (window);
- }
-}
-
-static char *
-get_file_name_from_icon_name (const char *icon_name, gboolean is_custom)
-{
- char *full_path_name, *icon_theme, *theme_path_name;
-
- /* look in the theme to see if there's a redirection found; if so, prefer the
- * redirection to the ordinary theme look-up */
- icon_theme = nautilus_theme_get_theme_data ("toolbar", "icon_theme");
- if (icon_theme != NULL) {
- /* special case the "standard" theme which indicates using the stock gnome icons,
- * except for the custom ones, that are not present in stock
- */
- if (!is_custom && eel_strcmp (icon_theme, "standard") == 0) {
- g_free (icon_theme);
- return NULL;
- }
-
- theme_path_name = g_strdup_printf ("%s/%s.png", icon_theme, icon_name);
- full_path_name = nautilus_pixmap_file (theme_path_name);
- if (full_path_name == NULL) {
- full_path_name = nautilus_theme_get_image_path (icon_name);
- }
- g_free (theme_path_name);
- g_free (icon_theme);
- } else {
- full_path_name = nautilus_theme_get_image_path (icon_name);
- }
-
- return full_path_name;
-}
-
-static void
-set_up_standard_bonobo_button (NautilusWindow *window,
- const char *item_path,
- const char *icon_name,
- const char *stock_item_fallback)
-{
- char *file_name;
-
- file_name = get_file_name_from_icon_name (icon_name, (stock_item_fallback == NULL));
-
- /* set up the toolbar component with the new image */
- bonobo_ui_component_set_prop (window->details->shell_ui,
- item_path,
- "pixtype",
- file_name == NULL ? "stock" : "filename",
- NULL);
- bonobo_ui_component_set_prop (window->details->shell_ui,
- item_path,
- "pixname",
- file_name == NULL ? stock_item_fallback : file_name,
- NULL);
-
- g_free (file_name);
-}
-
-/* Use only for toolbar buttons that had to be explicitly created so they
- * could have behaviors not present in standard Bonobo toolbar buttons.
- */
-static void
-set_up_special_bonobo_button (NautilusWindow *window,
- BonoboUIToolbarButtonItem *item,
- const char *control_path,
- const char *icon_name,
- const char *stock_item_fallback)
-{
- char *icon_file_name;
- GtkWidget *image;
- GtkStockItem stock_item;
-
- image = NULL;
-
- icon_file_name = get_file_name_from_icon_name (icon_name, FALSE);
-
- if (icon_file_name == NULL) {
- if (gtk_stock_lookup (stock_item_fallback, &stock_item)) {
- image = gtk_image_new_from_stock (stock_item_fallback,
- GTK_ICON_SIZE_BUTTON);
- }
- } else {
- image = gtk_image_new_from_file (icon_file_name);
- g_free (icon_file_name);
- }
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- if (image == NULL) {
- return;
- }
+ gnome_popup_menu_do_popup_modal (GTK_WIDGET (create_back_or_forward_menu (NAUTILUS_WINDOW (user_data), back)),
+ menu_position_under_widget, widget, event, widget, widget);
- bonobo_ui_toolbar_button_item_set_image (item, image);
-}
-
-static void
-set_up_toolbar_images (NautilusWindow *window)
-{
- nautilus_window_ui_freeze (window);
-
- bonobo_ui_component_freeze (window->details->shell_ui, NULL);
-
- set_up_special_bonobo_button (window, window->details->back_button_item,
- "/Toolbar/BackWrapper", "Back", GTK_STOCK_GO_BACK);
- set_up_special_bonobo_button (window, window->details->forward_button_item,
- "/Toolbar/ForwardWrapper", "Forward", GTK_STOCK_GO_FORWARD);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- set_up_standard_bonobo_button (window, "/Toolbar/Up", "Up", GTK_STOCK_GO_UP);
- set_up_standard_bonobo_button (window, "/Toolbar/Home", "Home", GTK_STOCK_HOME);
- set_up_standard_bonobo_button (window, "/Toolbar/Reload", "Refresh", GTK_STOCK_REFRESH);
- set_up_standard_bonobo_button (window, "/Toolbar/Toggle Find Mode", "Search", GTK_STOCK_FIND);
- set_up_standard_bonobo_button (window, "/Toolbar/Stop", "Stop", GTK_STOCK_STOP);
+ return TRUE;
+}
- bonobo_ui_component_thaw (window->details->shell_ui, NULL);
+static gboolean
+back_or_forward_key_pressed_callback (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer *user_data)
+{
+ if (event->keyval == GDK_space ||
+ event->keyval == GDK_KP_Space ||
+ event->keyval == GDK_Return ||
+ event->keyval == GDK_KP_Enter)
+ {
+ back_or_forward_button_pressed_callback (widget, NULL, user_data);
+ }
- nautilus_window_ui_thaw (window);
+ return FALSE;
}
-
/* handle theme changes */
static void
theme_changed_callback (gpointer callback_data)
@@ -312,8 +209,6 @@
window = NAUTILUS_WINDOW (callback_data);
- set_up_toolbar_images (window);
-
/* if the toolbar is visible, toggle it's visibility to force a relayout */
if (nautilus_window_toolbar_showing (window)) {
nautilus_window_hide_toolbar (window);
@@ -352,31 +247,37 @@
}
}
-static BonoboUIToolbarButtonItem *
+static BonoboUIToolbarItem *
create_back_or_forward_toolbar_item (NautilusWindow *window,
- const char *label,
const char *tooltip,
const char *control_path)
{
- BonoboUIToolbarButtonItem *item;
+ BonoboUIToolbarItem *item;
BonoboPropertyBag *pb;
BonoboControl *wrapper;
- GtkButton *button;
+ GtkWidget *button;
+
+ item = BONOBO_UI_TOOLBAR_ITEM (bonobo_ui_toolbar_item_new ());
+
+ button = gtk_toggle_button_new ();
+ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+
+ gtk_container_add (GTK_CONTAINER (button),
+ gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT));
- item = BONOBO_UI_TOOLBAR_BUTTON_ITEM
- (bonobo_ui_toolbar_button_item_new (NULL, label)); /* Fill in image later */
- gtk_widget_show (GTK_WIDGET (item));
+ gtk_container_add (GTK_CONTAINER (item), button);
+
+ gtk_widget_show_all (GTK_WIDGET (item));
- button = bonobo_ui_toolbar_button_item_get_button_widget (item);
gtk_tooltips_set_tip (window->details->tooltips,
GTK_WIDGET (button),
tooltip, NULL);
+ g_signal_connect_object (button, "key_press_event",
+ G_CALLBACK (back_or_forward_key_pressed_callback),
+ window, 0);
g_signal_connect_object (button, "button_press_event",
G_CALLBACK (back_or_forward_button_pressed_callback),
window, 0);
- g_signal_connect_object (button, "clicked",
- G_CALLBACK (back_or_forward_button_clicked_callback),
- window, 0);
wrapper = bonobo_control_new (GTK_WIDGET (item));
pb = bonobo_property_bag_new
@@ -579,13 +480,11 @@
}
window->details->back_button_item = create_back_or_forward_toolbar_item
- (window, _("Back"), _("Go to the previous visited location"),
- "/Toolbar/BackWrapper");
+ (window, _("Go back a few pages"),
+ "/Toolbar/BackMenu");
window->details->forward_button_item = create_back_or_forward_toolbar_item
- (window, _("Forward"), _("Go to the next visited location"),
- "/Toolbar/ForwardWrapper");
-
- set_up_toolbar_images (window);
+ (window, _("Go forward a number of pages"),
+ "/Toolbar/ForwardMenu");
eel_preferences_add_callback (NAUTILUS_PREFERENCES_THEME,
theme_changed_callback,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]