Commit 5fc0907e authored by Sean Davis's avatar Sean Davis 🕶

Make systray and statusnotifiers match size and almost match multi-line positioning

parent 98b25bb0
Pipeline #1243 passed with stages
in 4 minutes and 37 seconds
......@@ -573,6 +573,63 @@ sn_config_get_icon_size (SnConfig *config)
void
sn_config_get_dimensions (SnConfig *config,
gint *ret_icon_size,
gint *ret_n_rows,
gint *ret_row_size,
gint *ret_padding)
{
gint panel_size, config_nrows, icon_size, hx_size, hy_size, nrows, row_size, padding;
gboolean single_row, square_icons;
panel_size = sn_config_get_panel_size(config);
panel_size -= 2; // Add border padding
config_nrows = sn_config_get_nrows(config);
icon_size = sn_config_get_icon_size(config);
single_row = sn_config_get_single_row(config);
square_icons = sn_config_get_square_icons(config);
if (square_icons)
{
single_row = TRUE;
nrows = single_row ? 1 : MAX(1, config_nrows);
hx_size = hy_size = panel_size / nrows;
}
else
{
hx_size = MIN(icon_size, panel_size);
nrows = single_row ? 1 : MAX(1, panel_size / hx_size);
hy_size = panel_size / nrows;
}
icon_size = MIN(icon_size, MIN(hx_size, hy_size));
if (icon_size % 2 != 0)
{
icon_size--;
}
row_size = hy_size;
padding = (hy_size - icon_size) / 2;
padding += 1;
if (square_icons)
padding = 0;
if (ret_icon_size != NULL)
*ret_icon_size = icon_size;
if (ret_n_rows != NULL)
*ret_n_rows = nrows;
if (ret_row_size != NULL)
*ret_row_size = row_size;
if (ret_padding != NULL)
*ret_padding = padding;
}
gboolean
sn_config_get_single_row (SnConfig *config)
{
......
......@@ -63,6 +63,11 @@ gboolean sn_config_get_symbolic_icons (SnConfig
gboolean sn_config_get_menu_is_primary (SnConfig *config);
gint sn_config_get_icon_size (SnConfig *config);
void sn_config_get_dimensions (SnConfig *config,
gint *ret_icon_size,
gint *ret_n_rows,
gint *ret_row_size,
gint *ret_padding);
gboolean sn_config_is_hidden (SnConfig *config,
const gchar *name);
......
......@@ -391,7 +391,9 @@ sn_icon_box_icon_changed (GtkWidget *widget)
box = XFCE_SN_ICON_BOX (widget);
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (widget)));
icon_size = sn_config_get_icon_size (box->config);
sn_config_get_dimensions (box->config, &icon_size, NULL, NULL, NULL);
symbolic_icons = sn_config_get_symbolic_icons (box->config);
sn_item_get_icon (box->item, &theme_path,
......
......@@ -67,7 +67,7 @@ class XfceStatusIcon():
def check_menu_item_cb(self, widget, data=None):
if widget.get_active():
icon_name = "xfwm4"
icon_name = "parole"
else:
icon_name = "xfce4-logo"
self.update_icon(icon_name)
......
This diff is collapsed.
......@@ -43,14 +43,14 @@ GtkWidget *systray_box_new (void) G_GNUC_MALLOC;
void systray_box_set_orientation (SystrayBox *box,
GtkOrientation orientation);
void systray_box_set_size_max (SystrayBox *box,
gint size_max);
gint systray_box_get_size_max (SystrayBox *box);
void systray_box_set_dimensions (SystrayBox *box,
gint icon_size,
gint n_rows,
gint row_size,
gint padding);
void systray_box_set_size_alloc (SystrayBox *box,
gint size_alloc,
gint nrows);
gint size_alloc);
void systray_box_set_show_hidden (SystrayBox *box,
gboolean show_hidden);
......
......@@ -57,7 +57,7 @@ static void systray_plugin_lost_selection (SystrayManager
void systray_plugin_configuration_changed (SnConfig *config,
SnPlugin *plugin)
{
gint icon_size;
gint icon_size, n_rows, row_size, padding;
gboolean square_icons;
gboolean single_row;
GList *list;
......@@ -65,9 +65,9 @@ void systray_plugin_configuration_changed (SnConfig *config,
gchar *name;
/* icon-size */
icon_size = sn_config_get_icon_size (config);
systray_box_set_size_max (XFCE_SYSTRAY_BOX (plugin->systray_box),
icon_size);
sn_config_get_dimensions (config, &icon_size, &n_rows, &row_size, &padding);
systray_box_set_dimensions (XFCE_SYSTRAY_BOX (plugin->systray_box),
icon_size, n_rows, row_size, padding);
/* square-icons */
square_icons = sn_config_get_square_icons (config);
......@@ -250,8 +250,7 @@ systray_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gtk_style_context_get_padding (context, gtk_widget_get_state_flags (plugin->box), &padding);
border += MAX (padding.left + padding.right, padding.top + padding.bottom);
systray_box_set_size_alloc (XFCE_SYSTRAY_BOX (plugin->systray_box), size - 2 * border,
xfce_panel_plugin_get_nrows (panel_plugin));
systray_box_set_size_alloc (XFCE_SYSTRAY_BOX (plugin->systray_box), size - 2 * border);
return TRUE;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment