This is an automated email from the git hooks/post-receive script. o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r in repository panel-plugins/xfce4-clipman-plugin.
commit 2ecfb11378a5ca5572cc4c3869c9c679c50da70b Author: Simon Steinbeiss <simon.steinbe...@elfenbeinturm.at> Date: Sun Mar 29 22:44:39 2020 +0200 plugin: "Show full history..." menuitem Since we don't show the full history in the plugin anymore let's add a hint that we don't and make it a launcher for xfce4-clipman-history. We only check if the *maximum* number of items in the history is greater than the one displayed in the panel, not the *actual* number of items. --- panel-plugin/history.c | 14 ++++++++++++++ panel-plugin/history.h | 2 +- panel-plugin/menu.c | 27 +++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/panel-plugin/history.c b/panel-plugin/history.c index fc314cf..c7fb8ee 100644 --- a/panel-plugin/history.c +++ b/panel-plugin/history.c @@ -343,6 +343,20 @@ clipman_history_get_list (ClipmanHistory *history) } /** + * clipman_history_get_max_texts_in_history: + * @history: a #ClipmanHistory + * + * Returns the most recent item that has been added to #ClipmanHistory. + * + * Returns: a #const #ClipmanHistoryItem + */ +guint +clipman_history_get_max_texts_in_history (ClipmanHistory *history) +{ + return history->priv->max_texts_in_history; +} + +/** * clipman_history_get_item_to_restore: * @history: a #ClipmanHistory * diff --git a/panel-plugin/history.h b/panel-plugin/history.h index 4a1d90e..5f932ad 100644 --- a/panel-plugin/history.h +++ b/panel-plugin/history.h @@ -92,10 +92,10 @@ void clipman_history_add_text (ClipmanHisto void clipman_history_add_image (ClipmanHistory *history, const GdkPixbuf *image); GSList * clipman_history_get_list (ClipmanHistory *history); +guint clipman_history_get_max_texts_in_history (ClipmanHistory *history); const ClipmanHistoryItem * clipman_history_get_item_to_restore (ClipmanHistory *history); void clipman_history_set_item_to_restore (ClipmanHistory *history, const ClipmanHistoryItem *item); void clipman_history_clear (ClipmanHistory *history); #endif /* !__CLIPMAN_HISTORY_H__ */ - diff --git a/panel-plugin/menu.c b/panel-plugin/menu.c index 0aead1d..9853866 100644 --- a/panel-plugin/menu.c +++ b/panel-plugin/menu.c @@ -278,6 +278,24 @@ cb_clear_history (ClipmanMenu *menu) gtk_clipboard_clear (clipboard); } +static void +cb_launch_clipman_history (ClipmanMenu *menu) +{ + GError *error = NULL; + GtkWidget *error_dialog; + + g_spawn_command_line_async ("xfce4-clipman-history", &error); + if (error != NULL) + { + error_dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, + _("Unable to open the clipman history dialog")); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (error_dialog), "%s", error->message); + gtk_dialog_run (GTK_DIALOG (error_dialog)); + gtk_widget_destroy (error_dialog); + g_error_free (error); + } +} + /* * Private methods */ @@ -490,6 +508,7 @@ clipman_menu_init (ClipmanMenu *menu) { GtkWidget *mi; GtkWidget *image; + guint max_texts_in_history; menu->priv = clipman_menu_get_instance_private (menu); @@ -503,6 +522,14 @@ clipman_menu_init (ClipmanMenu *menu) mi = gtk_separator_menu_item_new (); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); + max_texts_in_history = clipman_history_get_max_texts_in_history (menu->priv->history); + if (max_texts_in_history > menu->priv->max_menu_items) + { + mi = gtk_menu_item_new_with_mnemonic (_("_Show full history...")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); + g_signal_connect_swapped (mi, "activate", G_CALLBACK (cb_launch_clipman_history), menu); + } + G_GNUC_BEGIN_IGNORE_DEPRECATIONS menu->priv->mi_clear_history = mi = gtk_image_menu_item_new_with_mnemonic (_("_Clear history")); image = gtk_image_new_from_icon_name ("edit-clear-symbolic", GTK_ICON_SIZE_MENU); -- To stop receiving notification emails like this one, please contact the administrator of this repository. _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits