[Xfce4-commits] <xfce4-panel:andrzejr/deskbar-github> applicationsmenu: added max icon size limit of 2 rows.

Andrzej noreply at xfce.org
Mon Dec 12 11:40:14 CET 2011


Updating branch refs/heads/andrzejr/deskbar-github
         to c4e9210701bae4a99cbaca5e7525efd655d3ad02 (commit)
       from 81fa73881af4a4a54829f6530e85636411f623c5 (commit)

commit c4e9210701bae4a99cbaca5e7525efd655d3ad02
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Fri Nov 11 23:58:33 2011 +0900

    applicationsmenu: added max icon size limit of 2 rows.
    
    This is to prevent displaying icons that are much larger than other panel items.

 plugins/applicationsmenu/applicationsmenu.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/plugins/applicationsmenu/applicationsmenu.c b/plugins/applicationsmenu/applicationsmenu.c
index ebd328f..c82e948 100644
--- a/plugins/applicationsmenu/applicationsmenu.c
+++ b/plugins/applicationsmenu/applicationsmenu.c
@@ -105,6 +105,8 @@ static void      applications_menu_plugin_orientation_changed  (XfcePanelPlugin
                                                                 GtkOrientation          orientation);
 static void      applications_menu_plugin_deskbar_mode_changed (XfcePanelPlugin        *panel_plugin,
                                                                 gboolean                deskbar_mode);
+static void      applications_menu_plugin_nrows_changed        (XfcePanelPlugin        *panel_plugin,
+                                                                guint                   nrows);
 static void      applications_menu_plugin_configure_plugin     (XfcePanelPlugin        *panel_plugin);
 static gboolean  applications_menu_plugin_remote_event         (XfcePanelPlugin        *panel_plugin,
                                                                 const gchar            *name,
@@ -141,6 +143,7 @@ applications_menu_plugin_class_init (ApplicationsMenuPluginClass *klass)
   plugin_class->size_changed = applications_menu_plugin_size_changed;
   plugin_class->orientation_changed = applications_menu_plugin_orientation_changed;
   plugin_class->deskbar_mode_changed = applications_menu_plugin_deskbar_mode_changed;
+  plugin_class->nrows_changed = applications_menu_plugin_nrows_changed;
   plugin_class->configure_plugin = applications_menu_plugin_configure_plugin;
   plugin_class->remote_event = applications_menu_plugin_remote_event;
 
@@ -425,6 +428,14 @@ applications_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin,
   ApplicationsMenuPlugin *plugin = XFCE_APPLICATIONS_MENU_PLUGIN (panel_plugin);
   gint                    icon_size;
   GtkStyle               *style;
+  gint                    plugin_size;
+  gint                    plugin_nrows;
+
+  plugin_size = xfce_panel_plugin_get_size (panel_plugin);
+  plugin_nrows = (gint) xfce_panel_plugin_get_nrows (panel_plugin);
+
+  if (size > 2 * plugin_size / plugin_nrows)
+    size = 2 * plugin_size / plugin_nrows;
 
   gtk_box_set_child_packing (GTK_BOX (plugin->box), plugin->icon,
                              !plugin->show_button_title, !plugin->show_button_title,
@@ -473,6 +484,15 @@ applications_menu_plugin_deskbar_mode_changed (XfcePanelPlugin        *panel_plu
 
 
 static void
+applications_menu_plugin_nrows_changed (XfcePanelPlugin        *panel_plugin,
+                                       guint                   nrows)
+{
+  applications_menu_plugin_size_changed (panel_plugin,
+                                         xfce_panel_plugin_get_size (panel_plugin));
+}
+
+
+static void
 applications_menu_plugin_configure_plugin_file_set (GtkFileChooserButton   *button,
                                                     ApplicationsMenuPlugin *plugin)
 {


More information about the Xfce4-commits mailing list