Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
xfce4-panel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Simon Steinbeiß
xfce4-panel
Commits
1f9e763f
Commit
1f9e763f
authored
Jul 11, 2020
by
Sean Davis
🕶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for panel icon-size settings
parent
552d2de9
Pipeline
#1247
passed with stages
in 4 minutes and 27 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
184 additions
and
59 deletions
+184
-59
plugins/systray/sn-config.c
plugins/systray/sn-config.c
+35
-3
plugins/systray/sn-config.h
plugins/systray/sn-config.h
+5
-1
plugins/systray/sn-dialog.c
plugins/systray/sn-dialog.c
+48
-0
plugins/systray/sn-dialog.glade
plugins/systray/sn-dialog.glade
+90
-54
plugins/systray/sn-icon-box.c
plugins/systray/sn-icon-box.c
+2
-0
plugins/systray/sn-plugin.c
plugins/systray/sn-plugin.c
+4
-1
No files found.
plugins/systray/sn-config.c
View file @
1f9e763f
...
...
@@ -90,6 +90,7 @@ struct _SnConfig
GtkOrientation
panel_orientation
;
gint
nrows
;
gint
panel_size
;
gint
panel_icon_size
;
};
G_DEFINE_TYPE
(
SnConfig
,
sn_config
,
G_TYPE_OBJECT
)
...
...
@@ -117,6 +118,7 @@ enum
ITEM_LIST_CHANGED
,
COLLECT_KNOWN_ITEMS
,
LEGACY_ITEM_LIST_CHANGED
,
ICONS_CHANGED
,
LAST_SIGNAL
};
...
...
@@ -163,7 +165,7 @@ sn_config_class_init (SnConfigClass *klass)
g_object_class_install_property
(
object_class
,
PROP_ICON_SIZE
,
g_param_spec_int
(
"icon-size"
,
NULL
,
NULL
,
12
,
64
,
DEFAULT_ICON_SIZE
,
0
,
64
,
DEFAULT_ICON_SIZE
,
G_PARAM_READWRITE
|
G_PARAM_STATIC_STRINGS
));
...
...
@@ -242,6 +244,14 @@ sn_config_class_init (SnConfigClass *klass)
g_cclosure_marshal_VOID__VOID
,
G_TYPE_NONE
,
0
);
sn_config_signals
[
ICONS_CHANGED
]
=
g_signal_new
(
g_intern_static_string
(
"icons-changed"
),
G_TYPE_FROM_CLASS
(
object_class
),
G_SIGNAL_RUN_LAST
,
0
,
NULL
,
NULL
,
g_cclosure_marshal_VOID__VOID
,
G_TYPE_NONE
,
0
);
sn_config_signals
[
ITEM_LIST_CHANGED
]
=
g_signal_new
(
g_intern_static_string
(
"items-list-changed"
),
G_TYPE_FROM_CLASS
(
object_class
),
...
...
@@ -439,6 +449,7 @@ sn_config_set_property (GObject *object,
if
(
config
->
icon_size
!=
val
)
{
config
->
icon_size
=
val
;
g_signal_emit
(
G_OBJECT
(
config
),
sn_config_signals
[
ICONS_CHANGED
],
0
);
g_signal_emit
(
G_OBJECT
(
config
),
sn_config_signals
[
CONFIGURATION_CHANGED
],
0
);
}
break
;
...
...
@@ -568,7 +579,20 @@ sn_config_get_icon_size (SnConfig *config)
{
g_return_val_if_fail
(
XFCE_IS_SN_CONFIG
(
config
),
DEFAULT_ICON_SIZE
);
return
config
->
icon_size
;
if
(
config
->
icon_size
>
0
)
return
config
->
icon_size
;
return
config
->
panel_icon_size
;
}
gboolean
sn_config_get_icon_size_is_automatic
(
SnConfig
*
config
)
{
g_return_val_if_fail
(
XFCE_IS_SN_CONFIG
(
config
),
FALSE
);
return
config
->
icon_size
==
0
;
}
...
...
@@ -720,7 +744,8 @@ sn_config_get_panel_orientation (SnConfig *config)
void
sn_config_set_size
(
SnConfig
*
config
,
gint
panel_size
,
gint
nrows
)
gint
nrows
,
gint
icon_size
)
{
gboolean
needs_update
=
FALSE
;
...
...
@@ -738,6 +763,13 @@ sn_config_set_size (SnConfig *config,
needs_update
=
TRUE
;
}
if
(
config
->
panel_icon_size
!=
icon_size
)
{
config
->
panel_icon_size
=
icon_size
;
needs_update
=
TRUE
;
g_signal_emit
(
G_OBJECT
(
config
),
sn_config_signals
[
ICONS_CHANGED
],
0
);
}
if
(
needs_update
)
g_signal_emit
(
G_OBJECT
(
config
),
sn_config_signals
[
CONFIGURATION_CHANGED
],
0
);
}
...
...
plugins/systray/sn-config.h
View file @
1f9e763f
...
...
@@ -48,7 +48,8 @@ GtkOrientation sn_config_get_panel_orientation (SnConfig
void
sn_config_set_size
(
SnConfig
*
config
,
gint
panel_size
,
gint
nrows
);
gint
nrows
,
gint
icon_size
);
gint
sn_config_get_nrows
(
SnConfig
*
config
);
...
...
@@ -63,6 +64,9 @@ gboolean sn_config_get_symbolic_icons (SnConfig
gboolean
sn_config_get_menu_is_primary
(
SnConfig
*
config
);
gint
sn_config_get_icon_size
(
SnConfig
*
config
);
gboolean
sn_config_get_icon_size_is_automatic
(
SnConfig
*
config
);
void
sn_config_get_dimensions
(
SnConfig
*
config
,
gint
*
ret_icon_size
,
gint
*
ret_n_rows
,
...
...
plugins/systray/sn-dialog.c
View file @
1f9e763f
...
...
@@ -35,6 +35,10 @@
#define DEFAULT_ICON_SIZE 22
static
gboolean
sn_dialog_build
(
SnDialog
*
dialog
);
static
void
sn_dialog_finalize
(
GObject
*
object
);
...
...
@@ -52,6 +56,9 @@ struct _SnDialog
GtkBuilder
*
builder
;
GtkWidget
*
dialog
;
GtkWidget
*
auto_size
;
GtkWidget
*
size_spinbutton
;
GtkWidget
*
size_revealer
;
GObject
*
store
;
GObject
*
legacy_store
;
SnConfig
*
config
;
...
...
@@ -656,6 +663,29 @@ sn_dialog_dialog_unref (SnDialog *dialog)
static
void
reveal_icon_size
(
GtkWidget
*
widget
,
GParamSpec
*
pspec
,
SnDialog
*
dialog
)
{
gboolean
active
;
gint
icon_size
;
g_return_if_fail
(
XFCE_IS_SN_DIALOG
(
dialog
));
active
=
gtk_switch_get_active
(
GTK_SWITCH
(
widget
));
if
(
active
)
icon_size
=
0
;
else
icon_size
=
DEFAULT_ICON_SIZE
;
gtk_revealer_set_reveal_child
(
GTK_REVEALER
(
dialog
->
size_revealer
),
!
active
);
gtk_spin_button_set_value
(
GTK_SPIN_BUTTON
(
dialog
->
size_spinbutton
),
icon_size
);
}
static
gboolean
sn_dialog_build
(
SnDialog
*
dialog
)
{
...
...
@@ -682,12 +712,30 @@ sn_dialog_build (SnDialog *dialog)
G_CALLBACK
(
gtk_widget_destroy
),
dialog
->
dialog
);
object
=
gtk_builder_get_object
(
dialog
->
builder
,
"switch-auto-size"
);
g_return_val_if_fail
(
GTK_IS_WIDGET
(
object
),
FALSE
);
dialog
->
auto_size
=
GTK_WIDGET
(
object
);
object
=
gtk_builder_get_object
(
dialog
->
builder
,
"spinbutton-icon-size"
);
g_return_val_if_fail
(
GTK_IS_WIDGET
(
object
),
FALSE
);
g_object_bind_property
(
G_OBJECT
(
dialog
->
config
),
"icon-size"
,
G_OBJECT
(
gtk_spin_button_get_adjustment
(
GTK_SPIN_BUTTON
(
object
))),
"value"
,
G_BINDING_SYNC_CREATE
|
G_BINDING_BIDIRECTIONAL
);
dialog
->
size_spinbutton
=
GTK_WIDGET
(
object
);
object
=
gtk_builder_get_object
(
dialog
->
builder
,
"revealer-icon-size"
);
g_return_val_if_fail
(
GTK_IS_WIDGET
(
object
),
FALSE
);
dialog
->
size_revealer
=
GTK_WIDGET
(
object
);
if
(
sn_config_get_icon_size_is_automatic
(
dialog
->
config
))
{
gtk_switch_set_active
(
GTK_SWITCH
(
dialog
->
auto_size
),
TRUE
);
gtk_revealer_set_reveal_child
(
GTK_REVEALER
(
dialog
->
size_revealer
),
FALSE
);
}
g_signal_connect
(
G_OBJECT
(
dialog
->
auto_size
),
"notify::active"
,
G_CALLBACK
(
reveal_icon_size
),
dialog
);
object
=
gtk_builder_get_object
(
dialog
->
builder
,
"checkbutton-single-row"
);
g_return_val_if_fail
(
GTK_IS_WIDGET
(
object
),
FALSE
);
...
...
plugins/systray/sn-dialog.glade
View file @
1f9e763f
...
...
@@ -38,7 +38,6 @@
</columns>
</object>
<object
class=
"GtkAdjustment"
id=
"size-adjustment"
>
<property
name=
"lower"
>
12
</property>
<property
name=
"upper"
>
64
</property>
<property
name=
"value"
>
22
</property>
<property
name=
"step_increment"
>
1
</property>
...
...
@@ -105,51 +104,9 @@
<property
name=
"top_padding"
>
6
</property>
<property
name=
"left_padding"
>
12
</property>
<child>
<object
class=
"Gtk
Box"
id=
"vbox2
"
>
<object
class=
"Gtk
Grid"
id=
"icon_grid
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"spacing"
>
6
</property>
<child>
<object
class=
"GtkBox"
id=
"hbox1"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"spacing"
>
12
</property>
<child>
<object
class=
"GtkLabel"
id=
"label2"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"label"
translatable=
"yes"
>
_Maximum icon size (px):
</property>
<property
name=
"use_underline"
>
True
</property>
<property
name=
"mnemonic_widget"
>
spinbutton-icon-size
</property>
<property
name=
"xalign"
>
0
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"GtkSpinButton"
id=
"spinbutton-icon-size"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"adjustment"
>
size-adjustment
</property>
<property
name=
"numeric"
>
True
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"GtkCheckButton"
id=
"checkbutton-single-row"
>
<property
name=
"label"
translatable=
"yes"
>
Arrange items in a single row
</property>
...
...
@@ -157,12 +114,13 @@
<property
name=
"can_focus"
>
True
</property>
<property
name=
"receives_default"
>
False
</property>
<property
name=
"tooltip_text"
translatable=
"yes"
>
If enabled, ensure that the items are laid out in a single row
</property>
<property
name=
"margin_top"
>
6
</property>
<property
name=
"draw_indicator"
>
True
</property>
</object>
<packing>
<property
name=
"
expand"
>
True
</property>
<property
name=
"
fill"
>
True
</property>
<property
name=
"
position"
>
1
</property>
<property
name=
"
left_attach"
>
0
</property>
<property
name=
"
top_attach"
>
2
</property>
<property
name=
"
width"
>
2
</property>
</packing>
</child>
<child>
...
...
@@ -172,12 +130,13 @@
<property
name=
"can_focus"
>
True
</property>
<property
name=
"receives_default"
>
False
</property>
<property
name=
"tooltip_text"
translatable=
"yes"
>
Item buttons will take a square when it's possible
</property>
<property
name=
"margin_top"
>
6
</property>
<property
name=
"draw_indicator"
>
True
</property>
</object>
<packing>
<property
name=
"
expand"
>
True
</property>
<property
name=
"
fill"
>
True
</property>
<property
name=
"
position
"
>
2
</property>
<property
name=
"
left_attach"
>
0
</property>
<property
name=
"
top_attach"
>
3
</property>
<property
name=
"
width
"
>
2
</property>
</packing>
</child>
<child>
...
...
@@ -187,12 +146,89 @@
<property
name=
"can_focus"
>
True
</property>
<property
name=
"receives_default"
>
False
</property>
<property
name=
"tooltip_text"
translatable=
"yes"
>
Load symbolic icons if available
</property>
<property
name=
"margin_top"
>
6
</property>
<property
name=
"draw_indicator"
>
True
</property>
</object>
<packing>
<property
name=
"expand"
>
True
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
3
</property>
<property
name=
"left_attach"
>
0
</property>
<property
name=
"top_attach"
>
4
</property>
<property
name=
"width"
>
2
</property>
</packing>
</child>
<child>
<object
class=
"GtkRevealer"
id=
"revealer-icon-size"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"margin_top"
>
6
</property>
<property
name=
"reveal_child"
>
True
</property>
<child>
<object
class=
"GtkBox"
id=
"hbox1"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"spacing"
>
12
</property>
<child>
<object
class=
"GtkLabel"
id=
"label2"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"hexpand"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
_Fixed icon size (pixels):
</property>
<property
name=
"use_underline"
>
True
</property>
<property
name=
"mnemonic_widget"
>
spinbutton-icon-size
</property>
<property
name=
"xalign"
>
0
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"GtkSpinButton"
id=
"spinbutton-icon-size"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"halign"
>
end
</property>
<property
name=
"valign"
>
center
</property>
<property
name=
"adjustment"
>
size-adjustment
</property>
<property
name=
"numeric"
>
True
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property
name=
"left_attach"
>
0
</property>
<property
name=
"top_attach"
>
1
</property>
<property
name=
"width"
>
2
</property>
</packing>
</child>
<child>
<object
class=
"GtkLabel"
id=
"auto_size_label"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"halign"
>
start
</property>
<property
name=
"hexpand"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Adjust size automatically
</property>
</object>
<packing>
<property
name=
"left_attach"
>
0
</property>
<property
name=
"top_attach"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"GtkSwitch"
id=
"switch-auto-size"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"halign"
>
end
</property>
<property
name=
"valign"
>
center
</property>
</object>
<packing>
<property
name=
"left_attach"
>
1
</property>
<property
name=
"top_attach"
>
0
</property>
</packing>
</child>
</object>
...
...
@@ -203,7 +239,7 @@
<object
class=
"GtkLabel"
id=
"label1"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"label"
translatable=
"yes"
>
Appearance
</property>
<property
name=
"label"
translatable=
"yes"
>
Icons
</property>
<attributes>
<attribute
name=
"weight"
value=
"bold"
/>
</attributes>
...
...
plugins/systray/sn-icon-box.c
View file @
1f9e763f
...
...
@@ -188,6 +188,8 @@ sn_icon_box_new (SnItem *item,
settings
=
gtk_settings_get_default
();
sn_signal_connect_weak_swapped
(
config
,
"icons-changed"
,
G_CALLBACK
(
sn_icon_box_icon_changed
),
box
);
sn_signal_connect_weak_swapped
(
config
,
"notify::icon-size"
,
G_CALLBACK
(
sn_icon_box_icon_changed
),
box
);
sn_signal_connect_weak_swapped
(
config
,
"notify::symbolic-icons"
,
...
...
plugins/systray/sn-plugin.c
View file @
1f9e763f
...
...
@@ -149,7 +149,10 @@ sn_plugin_size_changed (XfcePanelPlugin *panel_plugin,
{
SnPlugin
*
plugin
=
XFCE_SN_PLUGIN
(
panel_plugin
);
sn_config_set_size
(
plugin
->
config
,
size
,
xfce_panel_plugin_get_nrows
(
panel_plugin
));
sn_config_set_size
(
plugin
->
config
,
size
,
xfce_panel_plugin_get_nrows
(
panel_plugin
),
xfce_panel_plugin_get_icon_size
(
panel_plugin
));
systray_plugin_size_changed
(
panel_plugin
,
xfce_panel_plugin_get_size
(
panel_plugin
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment