diff options
-rw-r--r-- | data/org.mate.panel.menubar.gschema.xml.in | 6 | ||||
-rw-r--r-- | mate-panel/panel-menu-items.c | 11 | ||||
-rw-r--r-- | mate-panel/panel-recent.c | 6 | ||||
-rw-r--r-- | mate-panel/panel-recent.h | 3 | ||||
-rw-r--r-- | mate-panel/panel-schemas.h | 1 |
5 files changed, 24 insertions, 3 deletions
diff --git a/data/org.mate.panel.menubar.gschema.xml.in b/data/org.mate.panel.menubar.gschema.xml.in index efcd1d63..3bf1e8a6 100644 --- a/data/org.mate.panel.menubar.gschema.xml.in +++ b/data/org.mate.panel.menubar.gschema.xml.in @@ -50,5 +50,11 @@ <summary>Threshold of menu items before submenu is created</summary> <description>Maximum number of menu items (i.e. bookmarks) that are displayed without being put in a submenu.</description> </key> + <key name="max-recent-items" type="i"> + <range min="-1"/> + <default>10</default> + <summary>Maximum number of recent documents displayed in the Places menu</summary> + <description>Maximum number of recent documents that are displayed in the Places menu at a time. If this is set to -1, all known recent documents will be displayed.</description> + </key> </schema> </schemalist> diff --git a/mate-panel/panel-menu-items.c b/mate-panel/panel-menu-items.c index 025eb0e4..6247e5ad 100644 --- a/mate-panel/panel-menu-items.c +++ b/mate-panel/panel-menu-items.c @@ -1025,6 +1025,7 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item) char *name; char *uri; GFile *file; + int recent_items_limit; places_menu = panel_create_menu (); @@ -1120,8 +1121,12 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item) NULL, FALSE); + recent_items_limit = g_settings_get_int (place_item->priv->menubar_settings, + PANEL_MENU_BAR_MAX_RECENT_ITEMS); + panel_recent_append_documents_menu (places_menu, - place_item->priv->recent_manager); + place_item->priv->recent_manager, + recent_items_limit); /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */ GtkWidget *toplevel = gtk_widget_get_toplevel (places_menu); GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel)); @@ -1380,6 +1385,10 @@ panel_place_menu_item_init (PanelPlaceMenuItem *menuitem) "changed::" PANEL_MENU_BAR_MAX_ITEMS_OR_SUBMENU, G_CALLBACK (panel_place_menu_item_key_changed), G_OBJECT (menuitem)); + g_signal_connect (menuitem->priv->menubar_settings, + "changed::" PANEL_MENU_BAR_MAX_RECENT_ITEMS, + G_CALLBACK (panel_place_menu_item_key_changed), + G_OBJECT (menuitem)); menuitem->priv->recent_manager = gtk_recent_manager_get_default (); diff --git a/mate-panel/panel-recent.c b/mate-panel/panel-recent.c index 5f39584b..1caf570f 100644 --- a/mate-panel/panel-recent.c +++ b/mate-panel/panel-recent.c @@ -185,7 +185,8 @@ recent_documents_clear_cb (GtkMenuItem *menuitem, void panel_recent_append_documents_menu (GtkWidget *top_menu, - GtkRecentManager *manager) + GtkRecentManager *manager, + int recent_items_limit) { GtkWidget *recent_menu; GtkWidget *menu_item; @@ -199,6 +200,9 @@ panel_recent_append_documents_menu (GtkWidget *top_menu, _("Recent Documents")); recent_menu = gtk_recent_chooser_menu_new_for_manager (manager); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), recent_menu); + + gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (recent_menu), + recent_items_limit); g_signal_connect (G_OBJECT (recent_menu), "button_press_event", G_CALLBACK (menu_dummy_button_press_event), NULL); diff --git a/mate-panel/panel-recent.h b/mate-panel/panel-recent.h index 7605342c..84aece44 100644 --- a/mate-panel/panel-recent.h +++ b/mate-panel/panel-recent.h @@ -32,7 +32,8 @@ extern "C" { #endif void panel_recent_append_documents_menu (GtkWidget *menu, - GtkRecentManager *manager); + GtkRecentManager *manager, + int recent_items_limit); #ifdef __cplusplus } diff --git a/mate-panel/panel-schemas.h b/mate-panel/panel-schemas.h index abcb7cbb..1b787288 100644 --- a/mate-panel/panel-schemas.h +++ b/mate-panel/panel-schemas.h @@ -66,6 +66,7 @@ #define PANEL_MENU_BAR_SHOW_ICON_KEY "show-icon" #define PANEL_MENU_BAR_ICON_NAME_KEY "icon-name" #define PANEL_MENU_BAR_MAX_ITEMS_OR_SUBMENU "max-items-or-submenu" +#define PANEL_MENU_BAR_MAX_RECENT_ITEMS "max-recent-items" /* external schemas */ |