From 96426f0ef6b07e98adc082b76a0176d921495297 Mon Sep 17 00:00:00 2001 From: Tony Houghton Date: Sun, 2 Sep 2007 21:40:36 +0100 Subject: [PATCH] Started changing panel configuration GUI: * Created new Panel Options dialog in Templates.glade (not in use yet) * Created new panel menu item with submenu for moving panel to a different edge (does nothing yet). Note change to icon_prepare_menu. --- ROX-Filer/Templates.glade | 600 ++++++++++++++++++++++++++++++---------------- ROX-Filer/src/icon.c | 26 +- ROX-Filer/src/icon.h | 2 +- ROX-Filer/src/panel.c | 29 ++- ROX-Filer/src/pinboard.c | 2 +- 5 files changed, 442 insertions(+), 217 deletions(-) rewrite ROX-Filer/Templates.glade (98%) diff --git a/ROX-Filer/Templates.glade b/ROX-Filer/Templates.glade dissimilarity index 98% index d3a170c3..73b6dda2 100644 --- a/ROX-Filer/Templates.glade +++ b/ROX-Filer/Templates.glade @@ -1,213 +1,387 @@ - - - - - - - True - ROX-Filer log viewer - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -7 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 4 - True - False - 4 - - - - True - Recently performed actions... - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 0 - True - True - - - - - - GTK_BUTTONBOX_START - 0 - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-open - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Open Directory - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - 0 - False - True - - - - - 0 - True - True - - - - - - - + + + + + + True + ROX-Filer log viewer + GDK_WINDOW_TYPE_HINT_DIALOG + False + + + True + + + True + 4 + 4 + + + True + 0 + Recently performed actions... + + + False + False + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + + + + + 1 + + + + + GTK_BUTTONBOX_START + + + True + True + True + 0 + + + True + 0 + 0 + + + True + 2 + + + True + gtk-open + + + False + False + + + + + True + Open Directory + True + + + False + False + 1 + + + + + + + + + + + False + 2 + + + + + 1 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-close + True + -7 + + + + + False + GTK_PACK_END + + + + + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + Panel Options + GTK_WIN_POS_CENTER_ON_PARENT + GDK_WINDOW_TYPE_HINT_DIALOG + False + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + GTK_SHADOW_NONE + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 12 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Every icon on this panel is shown with an image and some text. + Image and Text + 0 + True + True + + + + False + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Applications in this panel have just an image, everything else has both an image and text. + Image only for applications + 0 + True + True + panel_style_radio_0 + + + + False + False + 1 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Only the image is shown for icons in this panel. + Image only + 0 + True + True + panel_style_radio_0 + + + + False + False + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 6 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Panel width + + + False + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + The size of this panel. + 32 16 96 1 10 10 + + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + px + + + False + False + 2 + + + + + 3 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Ask the window manager not to cover this panel when maximising windows, otherwise leave just 2 pixels at the edge of the screen to allow auto-raising. Some window managers may not honour this setting. + Do not cover panel + 0 + True + + + + 4 + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <b>Panel style</b> + True + + + label_item + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + GTK_SHADOW_NONE + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 12 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + If you use multiple montors with Xinerama, use this option to confine the panel to one monitor. + Confine to Xinerama monitor + 0 + True + + + + False + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + The monitor this panel is confined to when using Xinerama. The numbering starts from zero. + 0 0 100 1 10 10 + + + + False + False + 1 + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <b>Xinerama</b> + True + + + label_item + + + + + 1 + + + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_BUTTONBOX_END + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-close + True + 0 + + + + + + False + GTK_PACK_END + + + + + + diff --git a/ROX-Filer/src/icon.c b/ROX-Filer/src/icon.c index e70465be..ad651dd3 100644 --- a/ROX-Filer/src/icon.c +++ b/ROX-Filer/src/icon.c @@ -31,6 +31,7 @@ #include "config.h" +#include #include #include #include @@ -61,6 +62,7 @@ static GtkWidget *icon_file_menu; /* The file submenu */ static GtkWidget *icon_file_item; /* 'File' label */ static GtkWidget *file_shift_item; /* 'Shift Open' label */ static GtkWidget *current_options_item; /* Pin/Pan Options */ +static GSList *current_trailing_items = NULL; /* A list of selected Icons. Every icon in the list is from the same group * (eg, you can't have icons from two different panels selected at the @@ -245,10 +247,13 @@ static gboolean any_selected_item_is_locked() * You should show icon_menu after calling this... * panel_name is NULL for the pinboard. */ -void icon_prepare_menu(Icon *icon, GtkWidget *options_item) +void icon_prepare_menu(Icon *icon, GtkWidget *options_item, ...) { GtkWidget *image; gboolean shaded; + GSList *link; + va_list ap; + GtkWidget *trailing; appmenu_remove(); @@ -257,6 +262,15 @@ void icon_prepare_menu(Icon *icon, GtkWidget *options_item) gtk_widget_destroy(current_options_item); current_options_item = NULL; } + for (link = current_trailing_items; link; link = g_slist_next(link)) + { + gtk_widget_destroy(link->data); + } + if (current_trailing_items) + { + g_slist_free(current_trailing_items); + current_trailing_items = NULL; + } menu_icon = icon; @@ -270,6 +284,16 @@ void icon_prepare_menu(Icon *icon, GtkWidget *options_item) gtk_menu_shell_append(GTK_MENU_SHELL(icon_menu), options_item); gtk_widget_show_all(options_item); + + va_start(ap, options_item); + while ((trailing = va_arg(ap, GtkWidget *)) != NULL) + { + current_trailing_items = g_slist_prepend(current_trailing_items, + trailing); + gtk_menu_shell_append(GTK_MENU_SHELL(icon_menu), trailing); + gtk_widget_show(trailing); + } + va_end(ap); /* Shade Remove Item(s) if any item is locked or nothing is selected */ if (icon_selection) diff --git a/ROX-Filer/src/icon.h b/ROX-Filer/src/icon.h index 7fec7a4f..52200b56 100644 --- a/ROX-Filer/src/icon.h +++ b/ROX-Filer/src/icon.h @@ -51,7 +51,7 @@ GType icon_get_type(void); gboolean icons_require(const gchar *path); void icon_may_update(Icon *icon); void icons_may_update(const gchar *path); -void icon_prepare_menu(Icon *icon, GtkWidget *options_item); +void icon_prepare_menu(Icon *icon, GtkWidget *options_item, ...); void icon_set_selected(Icon *icon, gboolean selected); void icon_select_only(Icon *select); void icon_set_path(Icon *icon, const char *pathname, const char *name); diff --git a/ROX-Filer/src/panel.c b/ROX-Filer/src/panel.c index cdec3f11..0b515844 100644 --- a/ROX-Filer/src/panel.c +++ b/ROX-Filer/src/panel.c @@ -2340,11 +2340,26 @@ static void panel_position_menu(GtkMenu *menu, gint *x, gint *y, *push_in = FALSE; } +static void append_pos_to_menu(GtkWidget *menu, const char *label, + PanelSide side, PanelSide current_side, GSList **pgroup, Panel *panel) +{ + GtkWidget *item = gtk_radio_menu_item_new_with_label(*pgroup, label); + + *pgroup = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item)); + if (side == current_side) + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); + gtk_widget_show(item); +} + static void panel_show_menu(GdkEventButton *event, PanelIcon *pi, Panel *panel) { GtkWidget *option_item; PanelSide side = panel->side; int pos[4]; + GtkWidget *pos_submenu; + GtkWidget *change_side_item; + GSList *pos_radio_group = NULL; pos[0] = event->x_root; pos[1] = event->y_root; @@ -2360,7 +2375,19 @@ static void panel_show_menu(GdkEventButton *event, PanelIcon *pi, Panel *panel) G_CALLBACK(panel_show_options), GINT_TO_POINTER(panel->side)); - icon_prepare_menu((Icon *) pi, option_item); + pos_submenu = gtk_menu_new(); + append_pos_to_menu(pos_submenu, _("Top Edge"), PANEL_TOP, side, + &pos_radio_group, panel); + append_pos_to_menu(pos_submenu, _("Bottom Edge"), PANEL_BOTTOM, side, + &pos_radio_group, panel); + append_pos_to_menu(pos_submenu, _("Left Edge"), PANEL_LEFT, side, + &pos_radio_group, panel); + append_pos_to_menu(pos_submenu, _("Right Edge"), PANEL_RIGHT, side, + &pos_radio_group, panel); + change_side_item = gtk_menu_item_new_with_label(_("Change panel side")); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(change_side_item), pos_submenu); + + icon_prepare_menu((Icon *) pi, option_item, change_side_item, NULL); if (side == PANEL_LEFT) pos[0] = -2; diff --git a/ROX-Filer/src/pinboard.c b/ROX-Filer/src/pinboard.c index dfbdc8ba..9a380761 100644 --- a/ROX-Filer/src/pinboard.c +++ b/ROX-Filer/src/pinboard.c @@ -2211,7 +2211,7 @@ static void pinboard_show_menu(GdkEventButton *event, PinIcon *pi) option_item = gtk_image_menu_item_new_with_label(_("Backdrop...")); g_signal_connect(option_item, "activate", G_CALLBACK(pinboard_set_backdrop_box), NULL); - icon_prepare_menu((Icon *) pi, option_item); + icon_prepare_menu((Icon *) pi, option_item, NULL); list = gtk_container_get_children(GTK_CONTAINER(icon_menu)); pos[2] = g_list_length(list) - 6; -- 2.11.4.GIT