From eaa632d9c522321484ccfb414cae17ecfe05a84d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Bonithon?= <gael@xfce.org> Date: Thu, 25 Apr 2024 06:02:24 +0200 Subject: [PATCH] Apply .clang-format file --- common/panel-dbus.h | 12 +- common/panel-debug.c | 21 +- common/panel-debug.h | 58 +- common/panel-private.h | 104 +- common/panel-utils.c | 46 +- common/panel-utils.h | 40 +- common/panel-xfconf.c | 22 +- common/panel-xfconf.h | 29 +- libxfce4panel/libxfce4panel-config.h.in | 17 +- libxfce4panel/libxfce4panel-enums.h | 82 +- libxfce4panel/xfce-arrow-button.c | 156 ++- libxfce4panel/xfce-arrow-button.h | 38 +- libxfce4panel/xfce-panel-convenience.c | 48 +- libxfce4panel/xfce-panel-convenience.h | 46 +- libxfce4panel/xfce-panel-image.c | 235 ++-- libxfce4panel/xfce-panel-image.h | 83 +- libxfce4panel/xfce-panel-macros.h | 124 +- libxfce4panel/xfce-panel-plugin-provider.c | 37 +- libxfce4panel/xfce-panel-plugin-provider.h | 192 +-- libxfce4panel/xfce-panel-plugin.c | 927 +++++++------ libxfce4panel/xfce-panel-plugin.h | 219 +-- migrate/main.c | 17 +- migrate/migrate-config.c | 30 +- migrate/migrate-config.h | 7 +- migrate/migrate-default.c | 79 +- migrate/migrate-default.h | 4 +- panel/main.c | 101 +- panel/panel-application.c | 450 +++--- panel/panel-application.h | 82 +- panel/panel-base-window.c | 231 ++-- panel/panel-base-window.h | 44 +- panel/panel-dbus-client.c | 51 +- panel/panel-dbus-client.h | 44 +- panel/panel-dbus-service.c | 179 +-- panel/panel-dbus-service.h | 9 +- panel/panel-dialogs.c | 50 +- panel/panel-dialogs.h | 9 +- panel/panel-item-dialog.c | 314 +++-- panel/panel-item-dialog.h | 9 +- panel/panel-itembar.c | 378 ++--- panel/panel-itembar.h | 49 +- panel/panel-module-factory.c | 91 +- panel/panel-module-factory.h | 40 +- panel/panel-module.c | 106 +- panel/panel-module.h | 56 +- panel/panel-plugin-external-wrapper-wayland.c | 87 +- panel/panel-plugin-external-wrapper-x11.c | 51 +- panel/panel-plugin-external-wrapper.c | 136 +- panel/panel-plugin-external-wrapper.h | 7 +- panel/panel-plugin-external.c | 260 ++-- panel/panel-plugin-external.h | 96 +- panel/panel-preferences-dialog.c | 557 ++++---- panel/panel-preferences-dialog.h | 11 +- panel/panel-tic-tac-toe.c | 111 +- panel/panel-tic-tac-toe.h | 3 +- panel/panel-window.c | 1009 +++++++------- panel/panel-window.h | 51 +- plugins/actions/actions.c | 560 ++++---- plugins/actions/actions.h | 3 +- plugins/applicationsmenu/applicationsmenu.c | 258 ++-- plugins/applicationsmenu/applicationsmenu.h | 3 +- plugins/clock/clock-analog.c | 124 +- plugins/clock/clock-analog.h | 8 +- plugins/clock/clock-binary.c | 141 +- plugins/clock/clock-binary.h | 8 +- plugins/clock/clock-digital.c | 90 +- plugins/clock/clock-digital.h | 15 +- plugins/clock/clock-fuzzy.c | 208 ++- plugins/clock/clock-fuzzy.h | 8 +- plugins/clock/clock-lcd.c | 157 ++- plugins/clock/clock-lcd.h | 8 +- plugins/clock/clock-sleep-monitor.c | 64 +- plugins/clock/clock-sleep-monitor.h | 3 +- plugins/clock/clock-time.c | 99 +- plugins/clock/clock-time.h | 41 +- plugins/clock/clock.c | 327 ++--- plugins/clock/clock.h | 3 +- plugins/directorymenu/directorymenu.c | 443 +++--- plugins/directorymenu/directorymenu.h | 3 +- plugins/launcher/launcher-dialog.c | 405 +++--- plugins/launcher/launcher-dialog.h | 3 +- plugins/launcher/launcher.c | 887 ++++++------ plugins/launcher/launcher.h | 22 +- plugins/pager/pager-buttons.c | 221 +-- plugins/pager/pager-buttons.h | 21 +- plugins/pager/pager.c | 342 ++--- plugins/pager/pager.h | 3 +- plugins/separator/separator.c | 123 +- plugins/separator/separator.h | 3 +- plugins/showdesktop/showdesktop.c | 121 +- plugins/showdesktop/showdesktop.h | 3 +- plugins/systray/sn-backend.c | 343 ++--- plugins/systray/sn-backend.h | 6 +- plugins/systray/sn-box.c | 212 +-- plugins/systray/sn-box.h | 18 +- plugins/systray/sn-button.c | 168 +-- plugins/systray/sn-button.h | 13 +- plugins/systray/sn-config.c | 355 +++-- plugins/systray/sn-config.h | 189 +-- plugins/systray/sn-dialog.c | 387 +++--- plugins/systray/sn-dialog.h | 5 +- plugins/systray/sn-icon-box.c | 136 +- plugins/systray/sn-icon-box.h | 5 +- plugins/systray/sn-item.c | 677 +++++---- plugins/systray/sn-item.h | 76 +- plugins/systray/sn-plugin.c | 85 +- plugins/systray/sn-plugin.h | 36 +- plugins/systray/sn-util.c | 47 +- plugins/systray/sn-util.h | 25 +- plugins/systray/systray-box.c | 285 ++-- plugins/systray/systray-box.h | 56 +- plugins/systray/systray-manager.c | 348 +++-- plugins/systray/systray-manager.h | 37 +- plugins/systray/systray-socket.c | 134 +- plugins/systray/systray-socket.h | 28 +- plugins/systray/systray.c | 127 +- plugins/systray/systray.h | 30 +- plugins/tasklist/tasklist-widget.c | 1225 +++++++++-------- plugins/tasklist/tasklist-widget.h | 18 +- plugins/tasklist/tasklist.c | 87 +- plugins/tasklist/tasklist.h | 3 +- plugins/windowmenu/windowmenu.c | 373 ++--- plugins/windowmenu/windowmenu.h | 3 +- wrapper/main.c | 85 +- wrapper/wrapper-module.c | 38 +- wrapper/wrapper-module.h | 20 +- wrapper/wrapper-plug-wayland.c | 67 +- wrapper/wrapper-plug-wayland.h | 7 +- wrapper/wrapper-plug-x11.c | 40 +- wrapper/wrapper-plug-x11.h | 5 +- wrapper/wrapper-plug.h | 113 +- 131 files changed, 9345 insertions(+), 8640 deletions(-) diff --git a/common/panel-dbus.h b/common/panel-dbus.h index 791eca2c9..69160a39a 100644 --- a/common/panel-dbus.h +++ b/common/panel-dbus.h @@ -20,12 +20,12 @@ #define __PANEL_DBUS_H__ /* panel dbus names */ -#define PANEL_DBUS_NAME "org.xfce.Panel" -#define PANEL_DBUS_PATH "/org/xfce/Panel" -#define PANEL_DBUS_WRAPPER_PATH PANEL_DBUS_PATH "/Wrapper/%d" -#define PANEL_DBUS_WRAPPER_INTERFACE PANEL_DBUS_NAME ".Wrapper" -#define PANEL_DBUS_PLUGIN_NAME PANEL_DBUS_NAME "Plugin%d" -#define PANEL_DBUS_PLUGIN_PATH PANEL_DBUS_PATH "Plugin%d" +#define PANEL_DBUS_NAME "org.xfce.Panel" +#define PANEL_DBUS_PATH "/org/xfce/Panel" +#define PANEL_DBUS_WRAPPER_PATH PANEL_DBUS_PATH "/Wrapper/%d" +#define PANEL_DBUS_WRAPPER_INTERFACE PANEL_DBUS_NAME ".Wrapper" +#define PANEL_DBUS_PLUGIN_NAME PANEL_DBUS_NAME "Plugin%d" +#define PANEL_DBUS_PLUGIN_PATH PANEL_DBUS_PATH "Plugin%d" #define PANEL_DBUS_EXTERNAL_INTERFACE PANEL_DBUS_NAME ".External" enum diff --git a/common/panel-debug.c b/common/panel-debug.c index 73e9b42ab..575ca913b 100644 --- a/common/panel-debug.c +++ b/common/panel-debug.c @@ -30,8 +30,7 @@ static PanelDebugFlag panel_debug_flags = 0; /* additional debug levels */ -static const GDebugKey panel_debug_keys[] = -{ +static const GDebugKey panel_debug_keys[] = { /* external plugin proxy modes */ { "gdb", PANEL_DEBUG_GDB }, { "valgrind", PANEL_DEBUG_VALGRIND }, @@ -87,13 +86,13 @@ panel_debug_init (void) static void -panel_debug_print (PanelDebugFlag domain, - const gchar *message, - va_list args) +panel_debug_print (PanelDebugFlag domain, + const gchar *message, + va_list args) { - gchar *string; + gchar *string; const gchar *domain_name = NULL; - guint i; + guint i; /* lookup domain name */ for (i = 0; i < G_N_ELEMENTS (panel_debug_keys); i++) @@ -123,8 +122,8 @@ panel_debug_has_domain (PanelDebugFlag domain) void -panel_debug (PanelDebugFlag domain, - const gchar *message, +panel_debug (PanelDebugFlag domain, + const gchar *message, ...) { va_list args; @@ -144,8 +143,8 @@ panel_debug (PanelDebugFlag domain, void -panel_debug_filtered (PanelDebugFlag domain, - const gchar *message, +panel_debug_filtered (PanelDebugFlag domain, + const gchar *message, ...) { va_list args; diff --git a/common/panel-debug.h b/common/panel-debug.h index f14340839..60d4c139c 100644 --- a/common/panel-debug.h +++ b/common/panel-debug.h @@ -27,41 +27,45 @@ G_BEGIN_DECLS typedef enum { - PANEL_DEBUG_YES = 1 << 0, /* always enabled if PANEL_DEBUG is not %NULL */ + PANEL_DEBUG_YES = 1 << 0, /* always enabled if PANEL_DEBUG is not %NULL */ /* external plugin proxy modes */ - PANEL_DEBUG_GDB = 1 << 1, /* run external plugins in gdb */ - PANEL_DEBUG_VALGRIND = 1 << 2, /* run external plugins in valgrind */ + PANEL_DEBUG_GDB = 1 << 1, /* run external plugins in gdb */ + PANEL_DEBUG_VALGRIND = 1 << 2, /* run external plugins in valgrind */ /* filter domains */ - PANEL_DEBUG_APPLICATION = 1 << 3, + PANEL_DEBUG_APPLICATION = 1 << 3, PANEL_DEBUG_APPLICATIONSMENU = 1 << 4, - PANEL_DEBUG_BASE_WINDOW = 1 << 5, - PANEL_DEBUG_DISPLAY_LAYOUT = 1 << 6, - PANEL_DEBUG_EXTERNAL = 1 << 7, - PANEL_DEBUG_MAIN = 1 << 8, - PANEL_DEBUG_MODULE = 1 << 9, - PANEL_DEBUG_MODULE_FACTORY = 1 << 10, - PANEL_DEBUG_POSITIONING = 1 << 11, - PANEL_DEBUG_STRUTS = 1 << 12, - PANEL_DEBUG_SYSTRAY = 1 << 13, - PANEL_DEBUG_TASKLIST = 1 << 14, - PANEL_DEBUG_PAGER = 1 << 15, - PANEL_DEBUG_ITEMBAR = 1 << 16, - PANEL_DEBUG_CLOCK = 1 << 17, - PANEL_DEBUG_ACTIONS = 1 << 18, -} -PanelDebugFlag; + PANEL_DEBUG_BASE_WINDOW = 1 << 5, + PANEL_DEBUG_DISPLAY_LAYOUT = 1 << 6, + PANEL_DEBUG_EXTERNAL = 1 << 7, + PANEL_DEBUG_MAIN = 1 << 8, + PANEL_DEBUG_MODULE = 1 << 9, + PANEL_DEBUG_MODULE_FACTORY = 1 << 10, + PANEL_DEBUG_POSITIONING = 1 << 11, + PANEL_DEBUG_STRUTS = 1 << 12, + PANEL_DEBUG_SYSTRAY = 1 << 13, + PANEL_DEBUG_TASKLIST = 1 << 14, + PANEL_DEBUG_PAGER = 1 << 15, + PANEL_DEBUG_ITEMBAR = 1 << 16, + PANEL_DEBUG_CLOCK = 1 << 17, + PANEL_DEBUG_ACTIONS = 1 << 18, +} PanelDebugFlag; -gboolean panel_debug_has_domain (PanelDebugFlag domain); +gboolean +panel_debug_has_domain (PanelDebugFlag domain); -void panel_debug (PanelDebugFlag domain, - const gchar *message, - ...) G_GNUC_PRINTF (2, 3); +void +panel_debug (PanelDebugFlag domain, + const gchar *message, + ...) G_GNUC_PRINTF (2, 3); -void panel_debug_filtered (PanelDebugFlag domain, - const gchar *message, - ...) G_GNUC_PRINTF (2, 3); +void +panel_debug_filtered (PanelDebugFlag domain, + const gchar *message, + ...) G_GNUC_PRINTF (2, 3); + +G_END_DECLS G_END_DECLS diff --git a/common/panel-private.h b/common/panel-private.h index 9b1e77463..a54102b07 100644 --- a/common/panel-private.h +++ b/common/panel-private.h @@ -34,29 +34,41 @@ #endif /* support macros for debugging (improved macro for better position indication) */ -#define panel_assert(expr) g_assert (expr) -#define panel_assert_not_reached() g_assert_not_reached () -#define panel_return_if_fail(expr) G_STMT_START { \ - if (G_UNLIKELY (!(expr))) \ - { \ - g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ - "%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \ - #expr); \ - return; \ - }; }G_STMT_END -#define panel_return_val_if_fail(expr,val) G_STMT_START { \ - if (G_UNLIKELY (!(expr))) \ - { \ - g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ - "%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \ - #expr); \ - return (val); \ - }; }G_STMT_END +#define panel_assert(expr) g_assert (expr) +#define panel_assert_not_reached() g_assert_not_reached () +#define panel_return_if_fail(expr) \ + G_STMT_START \ + { \ + if (G_UNLIKELY (!(expr))) \ + { \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ + "%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \ + #expr); \ + return; \ + }; \ + } \ + G_STMT_END +#define panel_return_val_if_fail(expr, val) \ + G_STMT_START \ + { \ + if (G_UNLIKELY (!(expr))) \ + { \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ + "%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \ + #expr); \ + return (val); \ + }; \ + } \ + G_STMT_END /* handling flags */ -#define PANEL_SET_FLAG(flags,flag) G_STMT_START{ ((flags) |= (flag)); }G_STMT_END -#define PANEL_UNSET_FLAG(flags,flag) G_STMT_START{ ((flags) &= ~(flag)); }G_STMT_END -#define PANEL_HAS_FLAG(flags,flag) (((flags) & (flag)) != 0) +#define PANEL_SET_FLAG(flags, flag) \ + G_STMT_START { ((flags) |= (flag)); } \ + G_STMT_END +#define PANEL_UNSET_FLAG(flags, flag) \ + G_STMT_START { ((flags) &= ~(flag)); } \ + G_STMT_END +#define PANEL_HAS_FLAG(flags, flag) (((flags) & (flag)) != 0) /* relative path to the plugin directory */ #define PANEL_PLUGIN_RELATIVE_PATH "xfce4" G_DIR_SEPARATOR_S "panel" @@ -76,13 +88,25 @@ #define PANEL_PLUGIN_AUTO_RESTART (60) /* integer swap functions */ -#define SWAP_INTEGER(a,b) G_STMT_START { gint swp = a; a = b; b = swp; } G_STMT_END -#define TRANSPOSE_AREA(area) G_STMT_START { SWAP_INTEGER (area.width, area.height); \ - SWAP_INTEGER (area.x, area.y); } G_STMT_END +#define SWAP_INTEGER(a, b) \ + G_STMT_START \ + { \ + gint swp = a; \ + a = b; \ + b = swp; \ + } \ + G_STMT_END +#define TRANSPOSE_AREA(area) \ + G_STMT_START \ + { \ + SWAP_INTEGER (area.width, area.height); \ + SWAP_INTEGER (area.x, area.y); \ + } \ + G_STMT_END /* quick GList and GSList counting without traversing */ -#define LIST_HAS_ONE_ENTRY(l) ((l) != NULL && (l)->next == NULL) -#define LIST_HAS_ONE_OR_NO_ENTRIES(l) ((l) == NULL || (l)->next == NULL) +#define LIST_HAS_ONE_ENTRY(l) ((l) != NULL && (l)->next == NULL) +#define LIST_HAS_ONE_OR_NO_ENTRIES(l) ((l) == NULL || (l)->next == NULL) #define LIST_HAS_TWO_OR_MORE_ENTRIES(l) ((l) != NULL && (l)->next != NULL) /* group deprecations we don't want to replace */ @@ -90,57 +114,57 @@ static inline void panel_image_menu_item_set_image (GtkWidget *image_menu_item, GtkWidget *image) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (image_menu_item), image); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS } static inline GtkWidget * panel_image_menu_item_new (void) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS return gtk_image_menu_item_new (); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS } static inline GtkWidget * panel_image_menu_item_new_with_label (const gchar *label) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS return gtk_image_menu_item_new_with_label (label); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS } static inline GtkWidget * panel_image_menu_item_new_with_mnemonic (const gchar *label) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS return gtk_image_menu_item_new_with_mnemonic (label); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS } static inline gint panel_screen_get_number (GdkScreen *screen) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS return gdk_screen_get_number (screen); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS } static inline gint panel_screen_get_width (GdkScreen *screen) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS return gdk_screen_get_width (screen); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS } static inline gint panel_screen_get_height (GdkScreen *screen) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS return gdk_screen_get_height (screen); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS } #endif /* !__PANEL_PRIVATE_H__ */ diff --git a/common/panel-utils.c b/common/panel-utils.c index 71d5007c0..574e5707f 100644 --- a/common/panel-utils.c +++ b/common/panel-utils.c @@ -28,8 +28,8 @@ void -_panel_utils_weak_notify (gpointer data, - GObject *where_the_object_was) +_panel_utils_weak_notify (gpointer data, + GObject *where_the_object_was) { if (XFCE_IS_PANEL_PLUGIN (data)) xfce_panel_plugin_unblock_menu (data); @@ -40,7 +40,7 @@ _panel_utils_weak_notify (gpointer data, static void -panel_utils_help_button_clicked (GtkWidget *button, +panel_utils_help_button_clicked (GtkWidget *button, XfcePanelPlugin *panel_plugin) { GtkWidget *toplevel; @@ -50,8 +50,8 @@ panel_utils_help_button_clicked (GtkWidget *button, toplevel = gtk_widget_get_toplevel (button); panel_utils_show_help (GTK_WINDOW (toplevel), - xfce_panel_plugin_get_name (panel_plugin), - NULL); + xfce_panel_plugin_get_name (panel_plugin), + NULL); } @@ -77,14 +77,14 @@ panel_utils_unblock_autohide (XfcePanelPlugin *panel_plugin) GtkBuilder * -panel_utils_builder_new (XfcePanelPlugin *panel_plugin, - const gchar *buffer, - gsize length, - GObject **dialog_return) +panel_utils_builder_new (XfcePanelPlugin *panel_plugin, + const gchar *buffer, + gsize length, + GObject **dialog_return) { - GError *error = NULL; + GError *error = NULL; GtkBuilder *builder; - GObject *dialog, *button; + GObject *dialog, *button; panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (panel_plugin), NULL); @@ -102,19 +102,19 @@ panel_utils_builder_new (XfcePanelPlugin *panel_plugin, g_object_weak_ref (G_OBJECT (dialog), _panel_utils_weak_notify, panel_plugin); g_signal_connect_swapped (dialog, "show", - G_CALLBACK (panel_utils_block_autohide), panel_plugin); + G_CALLBACK (panel_utils_block_autohide), panel_plugin); g_signal_connect_swapped (dialog, "hide", - G_CALLBACK (panel_utils_unblock_autohide), panel_plugin); + G_CALLBACK (panel_utils_unblock_autohide), panel_plugin); button = gtk_builder_get_object (builder, "close-button"); if (G_LIKELY (button != NULL)) g_signal_connect_swapped (G_OBJECT (button), "clicked", - G_CALLBACK (gtk_widget_destroy), dialog); + G_CALLBACK (gtk_widget_destroy), dialog); button = gtk_builder_get_object (builder, "help-button"); if (G_LIKELY (button != NULL)) g_signal_connect (G_OBJECT (button), "clicked", - G_CALLBACK (panel_utils_help_button_clicked), panel_plugin); + G_CALLBACK (panel_utils_help_button_clicked), panel_plugin); if (G_LIKELY (dialog_return != NULL)) *dialog_return = dialog; @@ -140,7 +140,7 @@ panel_utils_builder_new (XfcePanelPlugin *panel_plugin, void -panel_utils_show_help (GtkWindow *parent, +panel_utils_show_help (GtkWindow *parent, const gchar *page, const gchar *offset) { @@ -152,10 +152,10 @@ panel_utils_show_help (GtkWindow *parent, gboolean panel_utils_device_grab (GtkWidget *widget) { - GdkScreen *screen = gtk_widget_get_screen (widget); + GdkScreen *screen = gtk_widget_get_screen (widget); GdkDisplay *display = gdk_screen_get_display (screen); - GdkSeat *seat = gdk_display_get_default_seat (display); - GdkWindow *window = gdk_window_get_effective_toplevel (gtk_widget_get_window (widget)); + GdkSeat *seat = gdk_display_get_default_seat (display); + GdkWindow *window = gdk_window_get_effective_toplevel (gtk_widget_get_window (widget)); return xfce_gdk_device_grab (seat, window, GDK_SEAT_CAPABILITY_ALL, NULL); } @@ -163,13 +163,13 @@ panel_utils_device_grab (GtkWidget *widget) void -panel_utils_set_atk_info (GtkWidget *widget, +panel_utils_set_atk_info (GtkWidget *widget, const gchar *name, const gchar *description) { - static gboolean initialized = FALSE; - static gboolean atk_enabled = TRUE; - AtkObject *object; + static gboolean initialized = FALSE; + static gboolean atk_enabled = TRUE; + AtkObject *object; panel_return_if_fail (GTK_IS_WIDGET (widget)); diff --git a/common/panel-utils.h b/common/panel-utils.h index 285d6f336..2b6a65318 100644 --- a/common/panel-utils.h +++ b/common/panel-utils.h @@ -25,29 +25,37 @@ G_BEGIN_DECLS -void _panel_utils_weak_notify (gpointer data, - GObject *where_the_object_was); +void +_panel_utils_weak_notify (gpointer data, + GObject *where_the_object_was); -GtkBuilder *panel_utils_builder_new (XfcePanelPlugin *panel_plugin, - const gchar *buffer, - gsize length, - GObject **dialog_return) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +GtkBuilder * +panel_utils_builder_new (XfcePanelPlugin *panel_plugin, + const gchar *buffer, + gsize length, + GObject **dialog_return) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; -void panel_utils_show_help (GtkWindow *parent, - const gchar *page, - const gchar *offset); +void +panel_utils_show_help (GtkWindow *parent, + const gchar *page, + const gchar *offset); -gboolean panel_utils_device_grab (GtkWidget *widget); +gboolean +panel_utils_device_grab (GtkWidget *widget); -void panel_utils_set_atk_info (GtkWidget *widget, - const gchar *name, - const gchar *description); +void +panel_utils_set_atk_info (GtkWidget *widget, + const gchar *name, + const gchar *description); -void panel_utils_destroy_later (GtkWidget *widget); +void +panel_utils_destroy_later (GtkWidget *widget); -void panel_utils_wl_surface_commit (GtkWidget *widget); +void +panel_utils_wl_surface_commit (GtkWidget *widget); -void panel_utils_widget_remap (GtkWidget *widget); +void +panel_utils_widget_remap (GtkWidget *widget); G_END_DECLS diff --git a/common/panel-xfconf.c b/common/panel-xfconf.c index 5acc31640..8193d61f5 100644 --- a/common/panel-xfconf.c +++ b/common/panel-xfconf.c @@ -29,10 +29,10 @@ static void panel_properties_store_value (XfconfChannel *channel, - const gchar *xfconf_property, - GType xfconf_property_type, - GObject *object, - const gchar *object_property) + const gchar *xfconf_property, + GType xfconf_property_type, + GObject *object, + const gchar *object_property) { GValue value = G_VALUE_INIT; GdkRGBA *rgba; @@ -46,7 +46,7 @@ panel_properties_store_value (XfconfChannel *channel, if (G_LIKELY (xfconf_property_type != GDK_TYPE_RGBA)) { - xfconf_channel_set_property (channel, xfconf_property, &value); + xfconf_channel_set_property (channel, xfconf_property, &value); } else { @@ -69,7 +69,7 @@ panel_properties_store_value (XfconfChannel *channel, XfconfChannel * panel_properties_get_channel (GObject *object_for_weak_ref) { - GError *error = NULL; + GError *error = NULL; XfconfChannel *channel; panel_return_val_if_fail (G_IS_OBJECT (object_for_weak_ref), NULL); @@ -90,14 +90,14 @@ panel_properties_get_channel (GObject *object_for_weak_ref) void -panel_properties_bind (XfconfChannel *channel, - GObject *object, - const gchar *property_base, +panel_properties_bind (XfconfChannel *channel, + GObject *object, + const gchar *property_base, const PanelProperty *properties, - gboolean save_properties) + gboolean save_properties) { const PanelProperty *prop; - gchar *property; + gchar *property; panel_return_if_fail (channel == NULL || XFCONF_IS_CHANNEL (channel)); panel_return_if_fail (G_IS_OBJECT (object)); diff --git a/common/panel-xfconf.h b/common/panel-xfconf.h index f51e40c73..20f74abfd 100644 --- a/common/panel-xfconf.h +++ b/common/panel-xfconf.h @@ -23,26 +23,31 @@ G_BEGIN_DECLS -typedef struct _PanelProperty PanelProperty; -struct _PanelProperty +typedef struct _PanelProperty { const gchar *property; - GType type; -}; + GType type; +} PanelProperty; -XfconfChannel *panel_properties_get_channel (GObject *object_for_weak_ref); +XfconfChannel * +panel_properties_get_channel (GObject *object_for_weak_ref); -void panel_properties_bind (XfconfChannel *channel, - GObject *object, - const gchar *property_base, - const PanelProperty *properties, - gboolean save_properties); +void +panel_properties_bind (XfconfChannel *channel, + GObject *object, + const gchar *property_base, + const PanelProperty *properties, + gboolean save_properties); -void panel_properties_unbind (GObject *object); +void +panel_properties_unbind (GObject *object); -GType panel_properties_value_array_get_type (void) G_GNUC_CONST; +GType +panel_properties_value_array_get_type (void) G_GNUC_CONST; + +G_END_DECLS G_END_DECLS diff --git a/libxfce4panel/libxfce4panel-config.h.in b/libxfce4panel/libxfce4panel-config.h.in index ad7cd6d30..86e8c2c87 100644 --- a/libxfce4panel/libxfce4panel-config.h.in +++ b/libxfce4panel/libxfce4panel-config.h.in @@ -43,7 +43,7 @@ G_BEGIN_DECLS * Like libxfce4panel_major_version, but from the headers used at * application compile time, rather than from the library * linked against at application run time. - * + * * Since: 4.8 **/ #define LIBXFCE4PANEL_MAJOR_VERSION (@LIBXFCE4PANEL_VERSION_MAJOR@) @@ -55,7 +55,7 @@ G_BEGIN_DECLS * Like libxfce4panel_minor_version, but from the headers used at * application compile time, rather than from the library * linked against at application run time. - * + * * Since: 4.8 **/ #define LIBXFCE4PANEL_MINOR_VERSION (@LIBXFCE4PANEL_VERSION_MINOR@) @@ -67,7 +67,7 @@ G_BEGIN_DECLS * Like libxfce4panel_micro_version, but from the headers used at * application compile time, rather than from the library * linked against at application run time - * + * * Since: 4.8 **/ #define LIBXFCE4PANEL_MICRO_VERSION (@LIBXFCE4PANEL_VERSION_MICRO@) @@ -82,10 +82,10 @@ G_BEGIN_DECLS * * Returns: %TRUE if the version of the libxfce4panel header files is * the same as or newer than the passed-in version. - * + * * Since: 4.8 **/ -#define LIBXFCE4PANEL_CHECK_VERSION(major,minor,micro) \ +#define LIBXFCE4PANEL_CHECK_VERSION(major, minor, micro) \ (LIBXFCE4PANEL_MAJOR_VERSION > (major) \ || (LIBXFCE4PANEL_MAJOR_VERSION == (major) \ && LIBXFCE4PANEL_MINOR_VERSION > (minor)) \ @@ -97,9 +97,10 @@ extern const guint libxfce4panel_major_version; extern const guint libxfce4panel_minor_version; extern const guint libxfce4panel_micro_version; -const gchar *libxfce4panel_check_version (guint required_major, - guint required_minor, - guint required_micro); +const gchar * +libxfce4panel_check_version (guint required_major, + guint required_minor, + guint required_micro); G_END_DECLS diff --git a/libxfce4panel/libxfce4panel-enums.h b/libxfce4panel/libxfce4panel-enums.h index d2e587f58..e803e48ce 100644 --- a/libxfce4panel/libxfce4panel-enums.h +++ b/libxfce4panel/libxfce4panel-enums.h @@ -50,8 +50,7 @@ typedef enum /*<enum,prefix=XFCE_PANEL_PLUGIN_MODE >*/ XFCE_PANEL_PLUGIN_MODE_HORIZONTAL, XFCE_PANEL_PLUGIN_MODE_VERTICAL, XFCE_PANEL_PLUGIN_MODE_DESKBAR -} -XfcePanelPluginMode; +} XfcePanelPluginMode; /** * XfceScreenPosition @@ -79,33 +78,32 @@ XfcePanelPluginMode; **/ typedef enum /*<enum,prefix=XFCE_SCREEN_POSITION >*/ { - XFCE_SCREEN_POSITION_NONE, - - /* top */ - XFCE_SCREEN_POSITION_NW_H, /* North West Horizontal */ - XFCE_SCREEN_POSITION_N, /* North */ - XFCE_SCREEN_POSITION_NE_H, /* North East Horizontal */ - - /* left */ - XFCE_SCREEN_POSITION_NW_V, /* North West Vertical */ - XFCE_SCREEN_POSITION_W, /* West */ - XFCE_SCREEN_POSITION_SW_V, /* South West Vertical */ - - /* right */ - XFCE_SCREEN_POSITION_NE_V, /* North East Vertical */ - XFCE_SCREEN_POSITION_E, /* East */ - XFCE_SCREEN_POSITION_SE_V, /* South East Vertical */ - - /* bottom */ - XFCE_SCREEN_POSITION_SW_H, /* South West Horizontal */ - XFCE_SCREEN_POSITION_S, /* South */ - XFCE_SCREEN_POSITION_SE_H, /* South East Horizontal */ - - /* floating */ - XFCE_SCREEN_POSITION_FLOATING_H, /* Floating Horizontal */ - XFCE_SCREEN_POSITION_FLOATING_V /* Floating Vertical */ -} -XfceScreenPosition; + XFCE_SCREEN_POSITION_NONE, + + /* top */ + XFCE_SCREEN_POSITION_NW_H, /* North West Horizontal */ + XFCE_SCREEN_POSITION_N, /* North */ + XFCE_SCREEN_POSITION_NE_H, /* North East Horizontal */ + + /* left */ + XFCE_SCREEN_POSITION_NW_V, /* North West Vertical */ + XFCE_SCREEN_POSITION_W, /* West */ + XFCE_SCREEN_POSITION_SW_V, /* South West Vertical */ + + /* right */ + XFCE_SCREEN_POSITION_NE_V, /* North East Vertical */ + XFCE_SCREEN_POSITION_E, /* East */ + XFCE_SCREEN_POSITION_SE_V, /* South East Vertical */ + + /* bottom */ + XFCE_SCREEN_POSITION_SW_H, /* South West Horizontal */ + XFCE_SCREEN_POSITION_S, /* South */ + XFCE_SCREEN_POSITION_SE_H, /* South East Horizontal */ + + /* floating */ + XFCE_SCREEN_POSITION_FLOATING_H, /* Floating Horizontal */ + XFCE_SCREEN_POSITION_FLOATING_V /* Floating Vertical */ +} XfceScreenPosition; /** * xfce_screen_position_is_horizontal: @@ -115,10 +113,10 @@ XfceScreenPosition; * * Returns: %TRUE if horizontal, %FALSE otherwise **/ -#define xfce_screen_position_is_horizontal(position) \ - (position <= XFCE_SCREEN_POSITION_NE_H || \ - (position >= XFCE_SCREEN_POSITION_SW_H && \ - position <= XFCE_SCREEN_POSITION_FLOATING_H)) +#define xfce_screen_position_is_horizontal(position) \ + (position <= XFCE_SCREEN_POSITION_NE_H \ + || (position >= XFCE_SCREEN_POSITION_SW_H \ + && position <= XFCE_SCREEN_POSITION_FLOATING_H)) /** * xfce_screen_position_get_orientation: @@ -129,8 +127,7 @@ XfceScreenPosition; * Returns: the #GtkOrientation corresponding to @position. **/ #define xfce_screen_position_get_orientation(position) \ - (xfce_screen_position_is_horizontal (position) ? \ - GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL) + (xfce_screen_position_is_horizontal (position) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL) /** * xfce_screen_position_is_floating: @@ -141,8 +138,7 @@ XfceScreenPosition; * Returns: %TRUE if floating, %FALSE otherwise. **/ #define xfce_screen_position_is_floating(position) \ - (position >= XFCE_SCREEN_POSITION_FLOATING_H || \ - position == XFCE_SCREEN_POSITION_NONE) + (position >= XFCE_SCREEN_POSITION_FLOATING_H || position == XFCE_SCREEN_POSITION_NONE) /** * xfce_screen_position_is_top: @@ -154,8 +150,7 @@ XfceScreenPosition; * Returns: %TRUE if on the top of the screen, %FALSE otherwise **/ #define xfce_screen_position_is_top(position) \ - (position >= XFCE_SCREEN_POSITION_NW_H && \ - position <= XFCE_SCREEN_POSITION_NE_H) + (position >= XFCE_SCREEN_POSITION_NW_H && position <= XFCE_SCREEN_POSITION_NE_H) /** * xfce_screen_position_is_left: @@ -167,8 +162,7 @@ XfceScreenPosition; * Returns: %TRUE if on the left of the screen, %FALSE otherwise **/ #define xfce_screen_position_is_left(position) \ - (position >= XFCE_SCREEN_POSITION_NW_V && \ - position <= XFCE_SCREEN_POSITION_SW_V) + (position >= XFCE_SCREEN_POSITION_NW_V && position <= XFCE_SCREEN_POSITION_SW_V) /** * xfce_screen_position_is_right: @@ -180,8 +174,7 @@ XfceScreenPosition; * Returns: %TRUE if on the right of the screen, %FALSE otherwise **/ #define xfce_screen_position_is_right(position) \ - (position >= XFCE_SCREEN_POSITION_NE_V && \ - position <= XFCE_SCREEN_POSITION_SE_V) + (position >= XFCE_SCREEN_POSITION_NE_V && position <= XFCE_SCREEN_POSITION_SE_V) /** * xfce_screen_position_is_bottom: @@ -193,8 +186,7 @@ XfceScreenPosition; * Returns: %TRUE if on the bottom of the screen, %FALSE otherwise **/ #define xfce_screen_position_is_bottom(position) \ - (position >= XFCE_SCREEN_POSITION_SW_H && \ - position <= XFCE_SCREEN_POSITION_SE_H) + (position >= XFCE_SCREEN_POSITION_SW_H && position <= XFCE_SCREEN_POSITION_SE_H) G_END_DECLS diff --git a/libxfce4panel/xfce-arrow-button.c b/libxfce4panel/xfce-arrow-button.c index 4bbb89a5f..e5281b021 100644 --- a/libxfce4panel/xfce-arrow-button.c +++ b/libxfce4panel/xfce-arrow-button.c @@ -43,7 +43,7 @@ -#define ARROW_WIDTH (8) +#define ARROW_WIDTH (8) #define MAX_BLINKING_COUNT (16) enum @@ -58,39 +58,46 @@ enum PROP_ARROW_TYPE }; -static void xfce_arrow_button_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void xfce_arrow_button_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void xfce_arrow_button_dispose (GObject *object); -static gboolean xfce_arrow_button_draw (GtkWidget *widget, - cairo_t *cr); -static void xfce_arrow_button_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static void xfce_arrow_button_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height); -static void xfce_arrow_button_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); +static void +xfce_arrow_button_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +xfce_arrow_button_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +xfce_arrow_button_dispose (GObject *object); +static gboolean +xfce_arrow_button_draw (GtkWidget *widget, + cairo_t *cr); +static void +xfce_arrow_button_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width); +static void +xfce_arrow_button_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height); +static void +xfce_arrow_button_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); struct _XfceArrowButtonPrivate { /* arrow type of the button */ - GtkArrowType arrow_type; + GtkArrowType arrow_type; /* blinking timeout id */ - guint blinking_timeout_id; + guint blinking_timeout_id; /* counter to make the blinking stop when * MAX_BLINKING_COUNT is reached */ - guint blinking_counter; + guint blinking_counter; /* button style overridden when blinking */ GtkReliefStyle style; @@ -107,9 +114,9 @@ G_DEFINE_TYPE_WITH_PRIVATE (XfceArrowButton, xfce_arrow_button, GTK_TYPE_TOGGLE_ static void -xfce_arrow_button_class_init (XfceArrowButtonClass * klass) +xfce_arrow_button_class_init (XfceArrowButtonClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; GtkWidgetClass *gtkwidget_class; gobject_class = G_OBJECT_CLASS (klass); @@ -131,14 +138,13 @@ xfce_arrow_button_class_init (XfceArrowButtonClass * klass) * Emitted when the arrow direction of the menu button changes. * This value also determines the direction of the popup menu. **/ - arrow_button_signals[ARROW_TYPE_CHANGED] = - g_signal_new (g_intern_static_string ("arrow-type-changed"), - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfceArrowButtonClass, arrow_type_changed), - NULL, NULL, - g_cclosure_marshal_VOID__ENUM, - G_TYPE_NONE, 1, GTK_TYPE_ARROW_TYPE); + arrow_button_signals[ARROW_TYPE_CHANGED] = g_signal_new (g_intern_static_string ("arrow-type-changed"), + G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfceArrowButtonClass, arrow_type_changed), + NULL, NULL, + g_cclosure_marshal_VOID__ENUM, + G_TYPE_NONE, 1, GTK_TYPE_ARROW_TYPE); /** * XfceArrowButton:arrow-type @@ -153,8 +159,7 @@ xfce_arrow_button_class_init (XfceArrowButtonClass * klass) "The arrow type of the menu button", GTK_TYPE_ARROW_TYPE, GTK_ARROW_UP, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } @@ -163,7 +168,7 @@ static void xfce_arrow_button_init (XfceArrowButton *button) { GtkStyleContext *context; - GtkCssProvider *provider; + GtkCssProvider *provider; button->priv = xfce_arrow_button_get_instance_private (button); @@ -192,10 +197,10 @@ xfce_arrow_button_init (XfceArrowButton *button) static void -xfce_arrow_button_set_property (GObject *object, - guint prop_id, +xfce_arrow_button_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { XfceArrowButton *button = XFCE_ARROW_BUTTON (object); @@ -214,9 +219,9 @@ xfce_arrow_button_set_property (GObject *object, static void -xfce_arrow_button_get_property (GObject *object, - guint prop_id, - GValue *value, +xfce_arrow_button_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { XfceArrowButton *button = XFCE_ARROW_BUTTON (object); @@ -253,16 +258,16 @@ xfce_arrow_button_dispose (GObject *object) static gboolean xfce_arrow_button_draw (GtkWidget *widget, - cairo_t *cr) + cairo_t *cr) { XfceArrowButton *button = XFCE_ARROW_BUTTON (widget); - GtkWidget *child; - gdouble x, y, width; - GtkAllocation alloc; - gdouble angle; + GtkWidget *child; + gdouble x, y, width; + GtkAllocation alloc; + gdouble angle; GtkStyleContext *context; - GtkBorder padding, border; - GdkRGBA fg_rgba; + GtkBorder padding, border; + GdkRGBA fg_rgba; /* draw the button */ (*GTK_WIDGET_CLASS (xfce_arrow_button_parent_class)->draw) (widget, cr); @@ -296,7 +301,7 @@ xfce_arrow_button_draw (GtkWidget *widget, else { width = (gdouble) MIN (alloc.height - padding.top - padding.bottom - border.top - border.bottom, - alloc.width - padding.left - padding.right - border.left - border.right); + alloc.width - padding.left - padding.right - border.left - border.right); width = (gdouble) CLAMP (width, 0.0, (gdouble) ARROW_WIDTH); x = (gdouble) (alloc.width - width) / 2.0; @@ -305,13 +310,18 @@ xfce_arrow_button_draw (GtkWidget *widget, switch (button->priv->arrow_type) { - case GTK_ARROW_DOWN: angle = G_PI; + case GTK_ARROW_DOWN: + angle = G_PI; break; - case GTK_ARROW_LEFT: angle = G_PI / 2.0 + G_PI; + case GTK_ARROW_LEFT: + angle = G_PI / 2.0 + G_PI; + break; + case GTK_ARROW_RIGHT: + angle = G_PI / 2.0; break; - case GTK_ARROW_RIGHT: angle = G_PI / 2.0; + default: + angle = 0.0; break; - default: angle = 0.0; } gtk_style_context_get_color (context, gtk_widget_get_state_flags (widget), &fg_rgba); gdk_cairo_set_source_rgba (cr, &fg_rgba); @@ -326,14 +336,14 @@ xfce_arrow_button_draw (GtkWidget *widget, static void xfce_arrow_button_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) + gint *minimum_width, + gint *natural_width) { XfceArrowButton *button = XFCE_ARROW_BUTTON (widget); - GtkWidget *child; - gint minimum_child_width, natural_child_width; + GtkWidget *child; + gint minimum_child_width, natural_child_width; GtkStyleContext *context; - GtkBorder padding, border; + GtkBorder padding, border; minimum_child_width = natural_child_width = 0; child = gtk_bin_get_child (GTK_BIN (widget)); @@ -375,14 +385,14 @@ xfce_arrow_button_get_preferred_width (GtkWidget *widget, static void xfce_arrow_button_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) + gint *minimum_height, + gint *natural_height) { XfceArrowButton *button = XFCE_ARROW_BUTTON (widget); - GtkWidget *child; - gint minimum_child_height, natural_child_height; + GtkWidget *child; + gint minimum_child_height, natural_child_height; GtkStyleContext *context; - GtkBorder padding, border; + GtkBorder padding, border; minimum_child_height = natural_child_height = 0; child = gtk_bin_get_child (GTK_BIN (widget)); @@ -424,12 +434,12 @@ xfce_arrow_button_get_preferred_height (GtkWidget *widget, static void -xfce_arrow_button_size_allocate (GtkWidget *widget, +xfce_arrow_button_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { XfceArrowButton *button = XFCE_ARROW_BUTTON (widget); - GtkWidget *child; - GtkAllocation child_allocation; + GtkWidget *child; + GtkAllocation child_allocation; /* allocate the button */ (*GTK_WIDGET_CLASS (xfce_arrow_button_parent_class)->size_allocate) (widget, allocation); @@ -487,7 +497,7 @@ static void xfce_arrow_button_blinking_timeout_destroyed (gpointer user_data) { XfceArrowButton *button = XFCE_ARROW_BUTTON (user_data); - GtkWidget *plugin; + GtkWidget *plugin; button->priv->blinking_timeout_id = 0; button->priv->blinking_counter = 0; @@ -543,7 +553,7 @@ xfce_arrow_button_get_arrow_type (XfceArrowButton *button) **/ void xfce_arrow_button_set_arrow_type (XfceArrowButton *button, - GtkArrowType arrow_type) + GtkArrowType arrow_type) { g_return_if_fail (XFCE_IS_ARROW_BUTTON (button)); @@ -601,13 +611,13 @@ xfce_arrow_button_get_blinking (XfceArrowButton *button) **/ void xfce_arrow_button_set_blinking (XfceArrowButton *button, - gboolean blinking) + gboolean blinking) { g_return_if_fail (XFCE_IS_ARROW_BUTTON (button)); if (blinking) { - if (! xfce_arrow_button_get_blinking (button)) + if (!xfce_arrow_button_get_blinking (button)) { GtkWidget *plugin; @@ -620,8 +630,8 @@ xfce_arrow_button_set_blinking (XfceArrowButton *button, gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NORMAL); /* start blinking timeout */ - button->priv->blinking_timeout_id = - gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, 500, + button->priv->blinking_timeout_id + = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, 500, xfce_arrow_button_blinking_timeout, button, xfce_arrow_button_blinking_timeout_destroyed); xfce_arrow_button_blinking_timeout (button); diff --git a/libxfce4panel/xfce-arrow-button.h b/libxfce4panel/xfce-arrow-button.h index d267d65f0..0a0f4f08d 100644 --- a/libxfce4panel/xfce-arrow-button.h +++ b/libxfce4panel/xfce-arrow-button.h @@ -27,15 +27,15 @@ G_BEGIN_DECLS typedef struct _XfceArrowButtonPrivate XfceArrowButtonPrivate; -typedef struct _XfceArrowButtonClass XfceArrowButtonClass; -typedef struct _XfceArrowButton XfceArrowButton; +typedef struct _XfceArrowButtonClass XfceArrowButtonClass; +typedef struct _XfceArrowButton XfceArrowButton; -#define XFCE_TYPE_ARROW_BUTTON (xfce_arrow_button_get_type ()) -#define XFCE_ARROW_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_ARROW_BUTTON, XfceArrowButton)) -#define XFCE_ARROW_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_ARROW_BUTTON, XfceArrowButtonClass)) -#define XFCE_IS_ARROW_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_ARROW_BUTTON)) +#define XFCE_TYPE_ARROW_BUTTON (xfce_arrow_button_get_type ()) +#define XFCE_ARROW_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_ARROW_BUTTON, XfceArrowButton)) +#define XFCE_ARROW_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_ARROW_BUTTON, XfceArrowButtonClass)) +#define XFCE_IS_ARROW_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_ARROW_BUTTON)) #define XFCE_IS_ARROW_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_ARROW_BUTTON)) -#define XFCE_ARROW_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_ARROW_BUTTON, XfceArrowButtonClass)) +#define XFCE_ARROW_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_ARROW_BUTTON, XfceArrowButtonClass)) struct _XfceArrowButtonClass { @@ -44,7 +44,7 @@ struct _XfceArrowButtonClass /*< signals >*/ void (*arrow_type_changed) (XfceArrowButton *button, - GtkArrowType type); + GtkArrowType type); }; /** @@ -62,17 +62,23 @@ struct _XfceArrowButton XfceArrowButtonPrivate *priv; }; -GType xfce_arrow_button_get_type (void) G_GNUC_CONST; +GType +xfce_arrow_button_get_type (void) G_GNUC_CONST; -GtkWidget *xfce_arrow_button_new (GtkArrowType arrow_type) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +GtkWidget * +xfce_arrow_button_new (GtkArrowType arrow_type) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; -GtkArrowType xfce_arrow_button_get_arrow_type (XfceArrowButton *button); -void xfce_arrow_button_set_arrow_type (XfceArrowButton *button, - GtkArrowType arrow_type); +GtkArrowType +xfce_arrow_button_get_arrow_type (XfceArrowButton *button); +void +xfce_arrow_button_set_arrow_type (XfceArrowButton *button, + GtkArrowType arrow_type); -gboolean xfce_arrow_button_get_blinking (XfceArrowButton *button); -void xfce_arrow_button_set_blinking (XfceArrowButton *button, - gboolean blinking); +gboolean +xfce_arrow_button_get_blinking (XfceArrowButton *button); +void +xfce_arrow_button_set_blinking (XfceArrowButton *button, + gboolean blinking); G_END_DECLS diff --git a/libxfce4panel/xfce-panel-convenience.c b/libxfce4panel/xfce-panel-convenience.c index 2dd241427..818f09368 100644 --- a/libxfce4panel/xfce-panel-convenience.c +++ b/libxfce4panel/xfce-panel-convenience.c @@ -55,9 +55,9 @@ GtkWidget * xfce_panel_create_button (void) { - GtkWidget *button = gtk_button_new (); + GtkWidget *button = gtk_button_new (); GtkStyleContext *context; - GtkCssProvider *provider; + GtkCssProvider *provider; gtk_widget_set_can_default (GTK_WIDGET (button), FALSE); gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE); @@ -92,7 +92,7 @@ GtkWidget * xfce_panel_create_toggle_button (void) { GtkStyleContext *context; - GtkCssProvider *provider; + GtkCssProvider *provider; GtkWidget *button = gtk_toggle_button_new (); @@ -150,21 +150,21 @@ xfce_panel_get_channel_name (void) static GdkPixbuf * -xfce_panel_pixbuf_from_source_at_size_and_scale (const gchar *source, +xfce_panel_pixbuf_from_source_at_size_and_scale (const gchar *source, GtkIconTheme *icon_theme, - gint dest_width, - gint dest_height, - gint scale) + gint dest_width, + gint dest_height, + gint scale) { GdkPixbuf *pixbuf = NULL; - gchar *p; - gchar *name; - gchar *filename; - gint src_w, src_h; - gdouble ratio; + gchar *p; + gchar *name; + gchar *filename; + gint src_w, src_h; + gdouble ratio; GdkPixbuf *dest; - GError *error = NULL; - gint size = MIN (dest_width, dest_height); + GError *error = NULL; + gint size = MIN (dest_width, dest_height); g_return_val_if_fail (source != NULL, NULL); g_return_val_if_fail (icon_theme == NULL || GTK_IS_ICON_THEME (icon_theme), NULL); @@ -239,7 +239,7 @@ xfce_panel_pixbuf_from_source_at_size_and_scale (const gchar *source, ratio = MIN ((gdouble) dest_width / (gdouble) src_w, (gdouble) dest_height / (gdouble) src_h); - dest_width = rint (src_w * ratio); + dest_width = rint (src_w * ratio); dest_height = rint (src_h * ratio); dest = gdk_pixbuf_scale_simple (pixbuf, @@ -283,10 +283,10 @@ xfce_panel_pixbuf_from_source_at_size_and_scale (const gchar *source, * Since: 4.10 **/ GdkPixbuf * -xfce_panel_pixbuf_from_source_at_size (const gchar *source, +xfce_panel_pixbuf_from_source_at_size (const gchar *source, GtkIconTheme *icon_theme, - gint dest_width, - gint dest_height) + gint dest_width, + gint dest_height) { return xfce_panel_pixbuf_from_source_at_size_and_scale (source, icon_theme, dest_width, dest_height, 1); } @@ -309,9 +309,9 @@ xfce_panel_pixbuf_from_source_at_size (const gchar *source, * Since: 4.8 **/ GdkPixbuf * -xfce_panel_pixbuf_from_source (const gchar *source, +xfce_panel_pixbuf_from_source (const gchar *source, GtkIconTheme *icon_theme, - gint size) + gint size) { return xfce_panel_pixbuf_from_source_at_size (source, icon_theme, size, size); } @@ -333,11 +333,11 @@ xfce_panel_pixbuf_from_source (const gchar *source, * Since: 4.17.4 **/ void -xfce_panel_set_image_from_source (GtkImage *image, - const gchar *source, +xfce_panel_set_image_from_source (GtkImage *image, + const gchar *source, GtkIconTheme *icon_theme, - gint size, - gint scale) + gint size, + gint scale) { GdkPixbuf *pixbuf; diff --git a/libxfce4panel/xfce-panel-convenience.h b/libxfce4panel/xfce-panel-convenience.h index 9f5b24600..8dc931b45 100644 --- a/libxfce4panel/xfce-panel-convenience.h +++ b/libxfce4panel/xfce-panel-convenience.h @@ -26,26 +26,32 @@ G_BEGIN_DECLS -GtkWidget *xfce_panel_create_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; - -GtkWidget *xfce_panel_create_toggle_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; - -const gchar *xfce_panel_get_channel_name (void); - -GdkPixbuf *xfce_panel_pixbuf_from_source_at_size (const gchar *source, - GtkIconTheme *icon_theme, - gint dest_width, - gint dest_height) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; - -GdkPixbuf *xfce_panel_pixbuf_from_source (const gchar *source, - GtkIconTheme *icon_theme, - gint size) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; - -void xfce_panel_set_image_from_source (GtkImage *image, - const gchar *source, - GtkIconTheme *icon_theme, - gint size, - gint scale); +GtkWidget * +xfce_panel_create_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; + +GtkWidget * +xfce_panel_create_toggle_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; + +const gchar * +xfce_panel_get_channel_name (void); + +GdkPixbuf * +xfce_panel_pixbuf_from_source_at_size (const gchar *source, + GtkIconTheme *icon_theme, + gint dest_width, + gint dest_height) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; + +GdkPixbuf * +xfce_panel_pixbuf_from_source (const gchar *source, + GtkIconTheme *icon_theme, + gint size) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; + +void +xfce_panel_set_image_from_source (GtkImage *image, + const gchar *source, + GtkIconTheme *icon_theme, + gint size, + gint scale); G_END_DECLS diff --git a/libxfce4panel/xfce-panel-image.c b/libxfce4panel/xfce-panel-image.c index 4c410c076..49daf29ae 100644 --- a/libxfce4panel/xfce-panel-image.c +++ b/libxfce4panel/xfce-panel-image.c @@ -60,11 +60,16 @@ /* design limit for the panel, to reduce the uncached pixbuf size */ #define MAX_PIXBUF_SIZE (128) -#define xfce_panel_image_unref_null(obj) G_STMT_START { if ((obj) != NULL) \ - { \ - g_object_unref (G_OBJECT (obj)); \ - (obj) = NULL; \ - } } G_STMT_END +#define xfce_panel_image_unref_null(obj) \ + G_STMT_START \ + { \ + if ((obj) != NULL) \ + { \ + g_object_unref (G_OBJECT (obj)); \ + (obj) = NULL; \ + } \ + } \ + G_STMT_END @@ -77,20 +82,20 @@ struct _XfcePanelImagePrivate GdkPixbuf *cache; /* source name */ - gchar *source; + gchar *source; /* fixed size */ - gint size; + gint size; /* whether we round to fixed icon sizes */ - guint force_icon_sizes : 1; + guint force_icon_sizes : 1; /* cached width and height */ - gint width; - gint height; + gint width; + gint height; /* idle load timeout */ - guint idle_load_id; + guint idle_load_id; }; enum @@ -103,31 +108,42 @@ enum -static void xfce_panel_image_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void xfce_panel_image_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void xfce_panel_image_finalize (GObject *object); -static void xfce_panel_image_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static void xfce_panel_image_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height); -static void xfce_panel_image_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gboolean xfce_panel_image_draw (GtkWidget *widget, - cairo_t *cr); -static void xfce_panel_image_style_updated (GtkWidget *widget); -static gboolean xfce_panel_image_load (gpointer data); -static void xfce_panel_image_load_destroy (gpointer data); -static GdkPixbuf *xfce_panel_image_scale_pixbuf (GdkPixbuf *source, - gint dest_width, - gint dest_height); +static void +xfce_panel_image_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +xfce_panel_image_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +xfce_panel_image_finalize (GObject *object); +static void +xfce_panel_image_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width); +static void +xfce_panel_image_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height); +static void +xfce_panel_image_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static gboolean +xfce_panel_image_draw (GtkWidget *widget, + cairo_t *cr); +static void +xfce_panel_image_style_updated (GtkWidget *widget); +static gboolean +xfce_panel_image_load (gpointer data); +static void +xfce_panel_image_load_destroy (gpointer data); +static GdkPixbuf * +xfce_panel_image_scale_pixbuf (GdkPixbuf *source, + gint dest_width, + gint dest_height); @@ -138,7 +154,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (XfcePanelImage, xfce_panel_image, GTK_TYPE_WIDGET) static void xfce_panel_image_class_init (XfcePanelImageClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; GtkWidgetClass *gtkwidget_class; gobject_class = G_OBJECT_CLASS (klass); @@ -153,55 +169,51 @@ xfce_panel_image_class_init (XfcePanelImageClass *klass) gtkwidget_class->draw = xfce_panel_image_draw; gtkwidget_class->style_updated = xfce_panel_image_style_updated; -/** - * XfcePanelImage:source: - * - * Deprecated: 4.18.1: Use #GtkImage:storage-type instead. - **/ + /** + * XfcePanelImage:source: + * + * Deprecated: 4.18.1: Use #GtkImage:storage-type instead. + **/ g_object_class_install_property (gobject_class, PROP_SOURCE, g_param_spec_string ("source", "Source", "Icon or filename", NULL, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -/** - * XfcePanelImage:pixbuf: - * - * Deprecated: 4.18.1: Use #GtkImage:pixbuf instead. - **/ + /** + * XfcePanelImage:pixbuf: + * + * Deprecated: 4.18.1: Use #GtkImage:pixbuf instead. + **/ g_object_class_install_property (gobject_class, PROP_PIXBUF, g_param_spec_object ("pixbuf", "Pixbuf", "Pixbuf image", GDK_TYPE_PIXBUF, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -/** - * XfcePanelImage:size: - * - * Deprecated: 4.18.1: Use #GtkImage:pixel-size instead. - **/ + /** + * XfcePanelImage:size: + * + * Deprecated: 4.18.1: Use #GtkImage:pixel-size instead. + **/ g_object_class_install_property (gobject_class, PROP_SIZE, g_param_spec_int ("size", "Size", "Pixel size of the image", -1, MAX_PIXBUF_SIZE, -1, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); gtk_widget_class_install_style_property (gtkwidget_class, g_param_spec_boolean ("force-gtk-icon-sizes", NULL, "Force the image to fix to GtkIconSizes", FALSE, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } @@ -225,9 +237,9 @@ xfce_panel_image_init (XfcePanelImage *image) static void -xfce_panel_image_get_property (GObject *object, - guint prop_id, - GValue *value, +xfce_panel_image_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (object)->priv; @@ -255,10 +267,10 @@ xfce_panel_image_get_property (GObject *object, static void -xfce_panel_image_set_property (GObject *object, - guint prop_id, +xfce_panel_image_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { switch (prop_id) { @@ -306,16 +318,14 @@ xfce_panel_image_finalize (GObject *object) static gint xfce_panel_image_padding_correction (GtkWidget *widget) { - GtkWidget *parent; - GtkStyleContext *context; - gint focus_width; - gint focus_pad; - gint correction; + GtkWidget *parent; + GtkStyleContext *context; + gint focus_width; + gint focus_pad; + gint correction; parent = gtk_widget_get_parent (widget); - if (parent != NULL && - GTK_IS_BUTTON (parent) && - !gtk_widget_get_can_focus (parent)) + if (parent != NULL && GTK_IS_BUTTON (parent) && !gtk_widget_get_can_focus (parent)) { context = gtk_widget_get_style_context (parent); gtk_style_context_get_style (context, @@ -337,12 +347,12 @@ xfce_panel_image_padding_correction (GtkWidget *widget) static void xfce_panel_image_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) + gint *minimum_width, + gint *natural_width) { XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv; - GtkAllocation alloc; - gint width, width_min; + GtkAllocation alloc; + gint width, width_min; if (priv->size > 0) width = priv->size; @@ -375,12 +385,12 @@ xfce_panel_image_get_preferred_width (GtkWidget *widget, static void xfce_panel_image_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) + gint *minimum_height, + gint *natural_height) { XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv; - GtkAllocation alloc; - gint height; + GtkAllocation alloc; + gint height; if (priv->size > 0) height = priv->size; @@ -407,7 +417,7 @@ xfce_panel_image_get_preferred_height (GtkWidget *widget, static void -xfce_panel_image_size_allocate (GtkWidget *widget, +xfce_panel_image_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv; @@ -418,8 +428,7 @@ xfce_panel_image_size_allocate (GtkWidget *widget, if ((priv->pixbuf != NULL || priv->source != NULL) && allocation->width > 0 && allocation->height > 0 - && (allocation->width != priv->width - || allocation->height != priv->height)) + && (allocation->width != priv->width || allocation->height != priv->height)) { /* store the new size */ priv->width = allocation->width; @@ -446,17 +455,17 @@ xfce_panel_image_size_allocate (GtkWidget *widget, static gboolean xfce_panel_image_draw (GtkWidget *widget, - cairo_t *cr) + cairo_t *cr) { XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv; - gint source_width, source_height; - gint dest_x, dest_y; - GdkPixbuf *rendered = NULL; - GdkPixbuf *pixbuf = priv->cache; - GtkStyleContext *context; - GdkScreen *screen; - GtkIconTheme *icon_theme; - GtkIconInfo *icon_info; + gint source_width, source_height; + gint dest_x, dest_y; + GdkPixbuf *rendered = NULL; + GdkPixbuf *pixbuf = priv->cache; + GtkStyleContext *context; + GdkScreen *screen; + GtkIconTheme *icon_theme; + GtkIconInfo *icon_info; if (G_LIKELY (pixbuf != NULL)) { @@ -497,7 +506,7 @@ static void xfce_panel_image_style_updated (GtkWidget *widget) { XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv; - gboolean force; + gboolean force; /* let gtk update the widget style */ (*GTK_WIDGET_CLASS (xfce_panel_image_parent_class)->style_updated) (widget); @@ -531,17 +540,15 @@ static gboolean xfce_panel_image_load (gpointer data) { XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (data)->priv; - GdkPixbuf *pixbuf; - GdkScreen *screen; - GtkIconTheme *icon_theme = NULL; - gint dest_w, dest_h; + GdkPixbuf *pixbuf; + GdkScreen *screen; + GtkIconTheme *icon_theme = NULL; + gint dest_w, dest_h; dest_w = priv->width; dest_h = priv->height; - if (G_UNLIKELY (priv->force_icon_sizes - && dest_w < 32 - && dest_w == dest_h)) + if (G_UNLIKELY (priv->force_icon_sizes && dest_w < 32 && dest_w == dest_h)) { /* we use some hardcoded values here for convienence, * above 32 pixels svg icons will kick in */ @@ -594,12 +601,12 @@ xfce_panel_image_load_destroy (gpointer data) static GdkPixbuf * xfce_panel_image_scale_pixbuf (GdkPixbuf *source, - gint dest_width, - gint dest_height) + gint dest_width, + gint dest_height) { gdouble ratio; - gint source_width; - gint source_height; + gint source_width; + gint source_height; panel_return_val_if_fail (GDK_IS_PIXBUF (source), NULL); @@ -619,7 +626,7 @@ xfce_panel_image_scale_pixbuf (GdkPixbuf *source, ratio = MIN ((gdouble) dest_width / (gdouble) source_width, (gdouble) dest_height / (gdouble) source_height); - dest_width = rint (source_width * ratio); + dest_width = rint (source_width * ratio); dest_height = rint (source_height * ratio); return gdk_pixbuf_scale_simple (source, MAX (dest_width, 1), @@ -716,7 +723,7 @@ xfce_panel_image_new_from_source (const gchar *source) **/ void xfce_panel_image_set_from_pixbuf (XfcePanelImage *image, - GdkPixbuf *pixbuf) + GdkPixbuf *pixbuf) { g_return_if_fail (XFCE_IS_PANEL_IMAGE (image)); g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf)); @@ -724,8 +731,7 @@ xfce_panel_image_set_from_pixbuf (XfcePanelImage *image, xfce_panel_image_clear (image); /* set the new pixbuf, scale it to the maximum size if needed */ - image->priv->pixbuf = xfce_panel_image_scale_pixbuf (pixbuf, - MAX_PIXBUF_SIZE, MAX_PIXBUF_SIZE); + image->priv->pixbuf = xfce_panel_image_scale_pixbuf (pixbuf, MAX_PIXBUF_SIZE, MAX_PIXBUF_SIZE); gtk_widget_queue_resize (GTK_WIDGET (image)); } @@ -746,7 +752,7 @@ xfce_panel_image_set_from_pixbuf (XfcePanelImage *image, **/ void xfce_panel_image_set_from_source (XfcePanelImage *image, - const gchar *source) + const gchar *source) { g_return_if_fail (XFCE_IS_PANEL_IMAGE (image)); g_return_if_fail (source == NULL || *source != '\0'); @@ -776,9 +782,8 @@ xfce_panel_image_set_from_source (XfcePanelImage *image, **/ void xfce_panel_image_set_size (XfcePanelImage *image, - gint size) + gint size) { - g_return_if_fail (XFCE_IS_PANEL_IMAGE (image)); if (G_LIKELY (image->priv->size != size)) @@ -835,8 +840,8 @@ xfce_panel_image_clear (XfcePanelImage *image) if (priv->source != NULL) { - g_free (priv->source); - priv->source = NULL; + g_free (priv->source); + priv->source = NULL; } xfce_panel_image_unref_null (priv->pixbuf); diff --git a/libxfce4panel/xfce-panel-image.h b/libxfce4panel/xfce-panel-image.h index 75e277fdc..396e88322 100644 --- a/libxfce4panel/xfce-panel-image.h +++ b/libxfce4panel/xfce-panel-image.h @@ -27,8 +27,8 @@ G_BEGIN_DECLS -typedef struct _XfcePanelImageClass XfcePanelImageClass; -typedef struct _XfcePanelImage XfcePanelImage; +typedef struct _XfcePanelImageClass XfcePanelImageClass; +typedef struct _XfcePanelImage XfcePanelImage; typedef struct _XfcePanelImagePrivate XfcePanelImagePrivate; struct _XfcePanelImageClass @@ -58,42 +58,51 @@ struct _XfcePanelImage XfcePanelImagePrivate *priv; }; -#define XFCE_TYPE_PANEL_IMAGE (xfce_panel_image_get_type ()) -#define XFCE_PANEL_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_PANEL_IMAGE, XfcePanelImage)) -#define XFCE_PANEL_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_PANEL_IMAGE, XfcePanelImageClass)) -#define XFCE_IS_PANEL_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_PANEL_IMAGE)) +#define XFCE_TYPE_PANEL_IMAGE (xfce_panel_image_get_type ()) +#define XFCE_PANEL_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_PANEL_IMAGE, XfcePanelImage)) +#define XFCE_PANEL_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_PANEL_IMAGE, XfcePanelImageClass)) +#define XFCE_IS_PANEL_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_PANEL_IMAGE)) #define XFCE_IS_PANEL_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_PANEL_IMAGE)) -#define XFCE_PANEL_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_PANEL_IMAGE, XfcePanelImageClass)) - -GType xfce_panel_image_get_type (void) -G_GNUC_CONST G_GNUC_DEPRECATED; - -GtkWidget *xfce_panel_image_new (void) -G_GNUC_MALLOC G_GNUC_DEPRECATED_FOR (gtk_image_new()); - -GtkWidget *xfce_panel_image_new_from_pixbuf (GdkPixbuf *pixbuf) -G_GNUC_MALLOC G_GNUC_DEPRECATED_FOR (gtk_image_new_from_pixbuf()); - -GtkWidget *xfce_panel_image_new_from_source (const gchar *source) -G_GNUC_MALLOC G_GNUC_DEPRECATED_FOR (gtk_image_new() and xfce_panel_set_image_from_source()); - -void xfce_panel_image_set_from_pixbuf (XfcePanelImage *image, - GdkPixbuf *pixbuf) -G_GNUC_DEPRECATED_FOR (gtk_image_set_from_pixbuf()); - -void xfce_panel_image_set_from_source (XfcePanelImage *image, - const gchar *source) -G_GNUC_DEPRECATED_FOR (xfce_panel_set_image_from_source()); - -void xfce_panel_image_set_size (XfcePanelImage *image, - gint size) -G_GNUC_DEPRECATED_FOR (gtk_image_set_pixel_size()); - -gint xfce_panel_image_get_size (XfcePanelImage *image) -G_GNUC_DEPRECATED_FOR (gtk_image_get_pixel_size()); - -void xfce_panel_image_clear (XfcePanelImage *image) -G_GNUC_DEPRECATED_FOR (gtk_image_clear()); +#define XFCE_PANEL_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_PANEL_IMAGE, XfcePanelImageClass)) + +GType +xfce_panel_image_get_type (void) + G_GNUC_CONST G_GNUC_DEPRECATED; + +GtkWidget * +xfce_panel_image_new (void) + G_GNUC_MALLOC G_GNUC_DEPRECATED_FOR (gtk_image_new ()); + +GtkWidget * +xfce_panel_image_new_from_pixbuf (GdkPixbuf *pixbuf) + G_GNUC_MALLOC G_GNUC_DEPRECATED_FOR (gtk_image_new_from_pixbuf ()); + +GtkWidget * +xfce_panel_image_new_from_source (const gchar *source) + G_GNUC_MALLOC G_GNUC_DEPRECATED_FOR (gtk_image_new () and xfce_panel_set_image_from_source ()); + +void +xfce_panel_image_set_from_pixbuf (XfcePanelImage *image, + GdkPixbuf *pixbuf) + G_GNUC_DEPRECATED_FOR (gtk_image_set_from_pixbuf ()); + +void +xfce_panel_image_set_from_source (XfcePanelImage *image, + const gchar *source) + G_GNUC_DEPRECATED_FOR (xfce_panel_set_image_from_source ()); + +void +xfce_panel_image_set_size (XfcePanelImage *image, + gint size) + G_GNUC_DEPRECATED_FOR (gtk_image_set_pixel_size ()); + +gint +xfce_panel_image_get_size (XfcePanelImage *image) + G_GNUC_DEPRECATED_FOR (gtk_image_get_pixel_size ()); + +void +xfce_panel_image_clear (XfcePanelImage *image) + G_GNUC_DEPRECATED_FOR (gtk_image_clear ()); G_END_DECLS diff --git a/libxfce4panel/xfce-panel-macros.h b/libxfce4panel/xfce-panel-macros.h index 986c2553a..52b998e8c 100644 --- a/libxfce4panel/xfce-panel-macros.h +++ b/libxfce4panel/xfce-panel-macros.h @@ -100,7 +100,7 @@ typedef GTypeModule XfcePanelTypeModule; **/ #define xfce_panel_plugin_xfconf_channel_new(plugin) \ xfconf_channel_new_with_property_base (XFCE_PANEL_CHANNEL_NAME, \ - xfce_panel_plugin_get_property_base (XFCE_PANEL_PLUGIN (plugin))) + xfce_panel_plugin_get_property_base (XFCE_PANEL_PLUGIN (plugin))) @@ -159,44 +159,42 @@ typedef GTypeModule XfcePanelTypeModule; **/ #define XFCE_PANEL_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT) \ static gpointer type_name##_parent_class = NULL; \ - static GType type_name##_type = 0; \ - \ - static void type_name##_init (TypeName *self); \ - static void type_name##_class_init (TypeName##Class *klass); \ - static void type_name##_class_intern_init (gpointer klass) \ + static GType type_name##_type = 0; \ +\ + static void type_name##_init (TypeName *self); \ + static void type_name##_class_init (TypeName##Class *klass); \ + static void type_name##_class_intern_init (gpointer klass) \ { \ type_name##_parent_class = g_type_class_peek_parent (klass); \ - type_name##_class_init ((TypeName##Class*) klass); \ + type_name##_class_init ((TypeName##Class *) klass); \ } \ - \ +\ GType \ - type_name##_get_type (void) \ + type_name##_get_type (void) \ { \ return type_name##_type; \ } \ - \ +\ void \ - type_name##_register_type (XfcePanelTypeModule *type_module) \ + type_name##_register_type (XfcePanelTypeModule *type_module) \ { \ GType plugin_define_type_id; \ - static const GTypeInfo plugin_define_type_info = \ - { \ + static const GTypeInfo plugin_define_type_info = { \ sizeof (TypeName##Class), \ NULL, \ NULL, \ - (GClassInitFunc) (void (*)(void)) type_name##_class_intern_init, \ + (GClassInitFunc) (void (*) (void)) type_name##_class_intern_init, \ NULL, \ NULL, \ sizeof (TypeName), \ 0, \ - (GInstanceInitFunc) (void (*)(void)) type_name##_init, \ + (GInstanceInitFunc) (void (*) (void)) type_name##_init, \ NULL, \ }; \ - \ - plugin_define_type_id = \ - g_type_module_register_type (G_TYPE_MODULE (type_module), TYPE_PARENT, \ - "Xfce" #TypeName, &plugin_define_type_info, 0); \ - \ +\ + plugin_define_type_id = g_type_module_register_type (G_TYPE_MODULE (type_module), TYPE_PARENT, \ + "Xfce" #TypeName, &plugin_define_type_info, 0); \ +\ type_name##_type = plugin_define_type_id; \ } @@ -205,25 +203,25 @@ typedef GTypeModule XfcePanelTypeModule; /* <private> */ #define _XPP_DEFINE_PLUGIN(TypeName, type_name, resident, args...) \ GType xfce_panel_module_init (GTypeModule *type_module, gboolean *make_resident); \ - \ +\ XFCE_PANEL_DEFINE_TYPE (TypeName, type_name, XFCE_TYPE_PANEL_PLUGIN) \ - \ +\ G_MODULE_EXPORT GType \ xfce_panel_module_init (GTypeModule *type_module, \ - gboolean *make_resident) \ + gboolean *make_resident) \ { \ - typedef void (*XppRegFunc) (XfcePanelTypeModule *module); \ + typedef void (*XppRegFunc) (XfcePanelTypeModule * module); \ XppRegFunc reg_funcs[] = { type_name##_register_type, args }; \ - guint i; \ - \ + guint i; \ +\ /* whether to make this plugin resident */ \ if (make_resident != NULL) \ *make_resident = resident; \ - \ +\ /* register the plugin types */ \ for (i = 0; i < G_N_ELEMENTS (reg_funcs); i++) \ - (* reg_funcs[i]) (type_module); \ - \ + (*reg_funcs[i]) (type_module); \ +\ return type_name##_get_type (); \ } @@ -250,9 +248,9 @@ typedef GTypeModule XfcePanelTypeModule; **/ #define XFCE_PANEL_DEFINE_PREINIT_FUNC(preinit_func) \ G_MODULE_EXPORT gboolean xfce_panel_module_preinit (gint argc, gchar **argv); \ - \ +\ G_MODULE_EXPORT gboolean \ - xfce_panel_module_preinit (gint argc, \ + xfce_panel_module_preinit (gint argc, \ gchar **argv) \ { \ return (*preinit_func) (argc, argv); \ @@ -293,7 +291,7 @@ typedef GTypeModule XfcePanelTypeModule; **/ #define XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK(construct_func, check_func) \ _XFCE_PANEL_PLUGIN_REGISTER_EXTENDED (construct_func, /* foo */, \ - if (G_LIKELY ((*check_func) (xpp_screen)))) + if (G_LIKELY ((*check_func) (xpp_screen)))) @@ -324,48 +322,48 @@ typedef GTypeModule XfcePanelTypeModule; xfce_panel_module_realize (XfcePanelPlugin *xpp) \ { \ g_return_if_fail (XFCE_IS_PANEL_PLUGIN (xpp)); \ - \ +\ g_signal_handlers_disconnect_by_func (G_OBJECT (xpp), \ - G_CALLBACK (xfce_panel_module_realize), NULL); \ - \ + G_CALLBACK (xfce_panel_module_realize), NULL); \ +\ (*construct_func) (xpp); \ } \ - \ +\ PREINIT_CODE \ - \ +\ G_MODULE_EXPORT XfcePanelPlugin * \ - xfce_panel_module_construct (const gchar *xpp_name, \ - gint xpp_unique_id, \ - const gchar *xpp_display_name, \ - const gchar *xpp_comment, \ - gchar **xpp_arguments, \ - GdkScreen *xpp_screen); \ + xfce_panel_module_construct (const gchar *xpp_name, \ + gint xpp_unique_id, \ + const gchar *xpp_display_name, \ + const gchar *xpp_comment, \ + gchar **xpp_arguments, \ + GdkScreen *xpp_screen); \ G_MODULE_EXPORT XfcePanelPlugin * \ - xfce_panel_module_construct (const gchar *xpp_name, \ - gint xpp_unique_id, \ - const gchar *xpp_display_name, \ - const gchar *xpp_comment, \ - gchar **xpp_arguments, \ - GdkScreen *xpp_screen) \ + xfce_panel_module_construct (const gchar *xpp_name, \ + gint xpp_unique_id, \ + const gchar *xpp_display_name, \ + const gchar *xpp_comment, \ + gchar **xpp_arguments, \ + GdkScreen *xpp_screen) \ { \ XfcePanelPlugin *xpp = NULL; \ - \ +\ g_return_val_if_fail (GDK_IS_SCREEN (xpp_screen), NULL); \ g_return_val_if_fail (xpp_name != NULL && xpp_unique_id != -1, NULL); \ - \ +\ CHECK_CODE \ - { \ - xpp = g_object_new (XFCE_TYPE_PANEL_PLUGIN, \ - "name", xpp_name, \ - "unique-id", xpp_unique_id, \ - "display-name", xpp_display_name, \ - "comment", xpp_comment, \ - "arguments", xpp_arguments, NULL); \ - \ - g_signal_connect_after (G_OBJECT (xpp), "realize", \ - G_CALLBACK (xfce_panel_module_realize), NULL); \ - } \ - \ + { \ + xpp = g_object_new (XFCE_TYPE_PANEL_PLUGIN, \ + "name", xpp_name, \ + "unique-id", xpp_unique_id, \ + "display-name", xpp_display_name, \ + "comment", xpp_comment, \ + "arguments", xpp_arguments, NULL); \ +\ + g_signal_connect_after (G_OBJECT (xpp), "realize", \ + G_CALLBACK (xfce_panel_module_realize), NULL); \ + } \ +\ return xpp; \ } diff --git a/libxfce4panel/xfce-panel-plugin-provider.c b/libxfce4panel/xfce-panel-plugin-provider.c index 4dc41f3f6..3c91bb15b 100644 --- a/libxfce4panel/xfce-panel-plugin-provider.c +++ b/libxfce4panel/xfce-panel-plugin-provider.c @@ -46,13 +46,12 @@ G_DEFINE_INTERFACE (XfcePanelPluginProvider, xfce_panel_plugin_provider, G_TYPE_ static void xfce_panel_plugin_provider_default_init (XfcePanelPluginProviderInterface *klass) { - provider_signals[PROVIDER_SIGNAL] = - g_signal_new (g_intern_static_string ("provider-signal"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__UINT, - G_TYPE_NONE, 1, G_TYPE_UINT); + provider_signals[PROVIDER_SIGNAL] = g_signal_new (g_intern_static_string ("provider-signal"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); } @@ -79,7 +78,7 @@ xfce_panel_plugin_provider_get_unique_id (XfcePanelPluginProvider *provider) void xfce_panel_plugin_provider_set_size (XfcePanelPluginProvider *provider, - gint size) + gint size) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider)); @@ -90,7 +89,7 @@ xfce_panel_plugin_provider_set_size (XfcePanelPluginProvider *provider, void xfce_panel_plugin_provider_set_icon_size (XfcePanelPluginProvider *provider, - gint icon_size) + gint icon_size) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider)); @@ -101,7 +100,7 @@ xfce_panel_plugin_provider_set_icon_size (XfcePanelPluginProvider *provider, void xfce_panel_plugin_provider_set_dark_mode (XfcePanelPluginProvider *provider, - gboolean dark_mode) + gboolean dark_mode) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider)); @@ -112,7 +111,7 @@ xfce_panel_plugin_provider_set_dark_mode (XfcePanelPluginProvider *provider, void xfce_panel_plugin_provider_set_mode (XfcePanelPluginProvider *provider, - XfcePanelPluginMode mode) + XfcePanelPluginMode mode) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider)); @@ -123,7 +122,7 @@ xfce_panel_plugin_provider_set_mode (XfcePanelPluginProvider *provider, void xfce_panel_plugin_provider_set_nrows (XfcePanelPluginProvider *provider, - guint rows) + guint rows) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider)); @@ -134,7 +133,7 @@ xfce_panel_plugin_provider_set_nrows (XfcePanelPluginProvider *provider, void xfce_panel_plugin_provider_set_screen_position (XfcePanelPluginProvider *provider, - XfceScreenPosition screen_position) + XfceScreenPosition screen_position) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider)); @@ -154,8 +153,8 @@ xfce_panel_plugin_provider_save (XfcePanelPluginProvider *provider) void -xfce_panel_plugin_provider_emit_signal (XfcePanelPluginProvider *provider, - XfcePanelPluginProviderSignal provider_signal) +xfce_panel_plugin_provider_emit_signal (XfcePanelPluginProvider *provider, + XfcePanelPluginProviderSignal provider_signal) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider)); @@ -219,9 +218,9 @@ xfce_panel_plugin_provider_removed (XfcePanelPluginProvider *provider) gboolean xfce_panel_plugin_provider_remote_event (XfcePanelPluginProvider *provider, - const gchar *name, - const GValue *value, - guint *handle) + const gchar *name, + const GValue *value, + guint *handle) { const GValue *real_value = value; @@ -246,7 +245,7 @@ xfce_panel_plugin_provider_remote_event (XfcePanelPluginProvider *provider, void xfce_panel_plugin_provider_set_locked (XfcePanelPluginProvider *provider, - gboolean locked) + gboolean locked) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider)); diff --git a/libxfce4panel/xfce-panel-plugin-provider.h b/libxfce4panel/xfce-panel-plugin-provider.h index d7c328a12..d353dd052 100644 --- a/libxfce4panel/xfce-panel-plugin-provider.h +++ b/libxfce4panel/xfce-panel-plugin-provider.h @@ -28,14 +28,14 @@ G_BEGIN_DECLS G_DECLARE_INTERFACE (XfcePanelPluginProvider, xfce_panel_plugin_provider, XFCE, PANEL_PLUGIN_PROVIDER, GObject) /* plugin module functions */ -typedef GtkWidget *(*PluginConstructFunc) (const gchar *name, - gint unique_id, - const gchar *display_name, - const gchar *comment, - gchar **arguments, - GdkScreen *screen); -typedef GType (*PluginInitFunc) (GTypeModule *module, - gboolean *make_resident); +typedef GtkWidget *(*PluginConstructFunc) (const gchar *name, + gint unique_id, + const gchar *display_name, + const gchar *comment, + gchar **arguments, + GdkScreen *screen); +typedef GType (*PluginInitFunc) (GTypeModule *module, + gboolean *make_resident); struct _XfcePanelPluginProviderInterface { @@ -43,33 +43,33 @@ struct _XfcePanelPluginProviderInterface GTypeInterface __parent__; /*<public >*/ - const gchar *(*get_name) (XfcePanelPluginProvider *provider); - gint (*get_unique_id) (XfcePanelPluginProvider *provider); - void (*set_size) (XfcePanelPluginProvider *provider, - gint size); - void (*set_icon_size) (XfcePanelPluginProvider *provider, - gint icon_size); - void (*set_dark_mode) (XfcePanelPluginProvider *provider, - gboolean dark_mode); - void (*set_mode) (XfcePanelPluginProvider *provider, - XfcePanelPluginMode mode); - void (*set_nrows) (XfcePanelPluginProvider *provider, - guint rows); - void (*set_screen_position) (XfcePanelPluginProvider *provider, - XfceScreenPosition screen_position); - void (*save) (XfcePanelPluginProvider *provider); - gboolean (*get_show_configure) (XfcePanelPluginProvider *provider); - void (*show_configure) (XfcePanelPluginProvider *provider); - gboolean (*get_show_about) (XfcePanelPluginProvider *provider); - void (*show_about) (XfcePanelPluginProvider *provider); - void (*removed) (XfcePanelPluginProvider *provider); - gboolean (*remote_event) (XfcePanelPluginProvider *provider, - const gchar *name, - const GValue *value, - guint *handle); - void (*set_locked) (XfcePanelPluginProvider *provider, - gboolean locked); - void (*ask_remove) (XfcePanelPluginProvider *provider); + const gchar *(*get_name) (XfcePanelPluginProvider *provider); + gint (*get_unique_id) (XfcePanelPluginProvider *provider); + void (*set_size) (XfcePanelPluginProvider *provider, + gint size); + void (*set_icon_size) (XfcePanelPluginProvider *provider, + gint icon_size); + void (*set_dark_mode) (XfcePanelPluginProvider *provider, + gboolean dark_mode); + void (*set_mode) (XfcePanelPluginProvider *provider, + XfcePanelPluginMode mode); + void (*set_nrows) (XfcePanelPluginProvider *provider, + guint rows); + void (*set_screen_position) (XfcePanelPluginProvider *provider, + XfceScreenPosition screen_position); + void (*save) (XfcePanelPluginProvider *provider); + gboolean (*get_show_configure) (XfcePanelPluginProvider *provider); + void (*show_configure) (XfcePanelPluginProvider *provider); + gboolean (*get_show_about) (XfcePanelPluginProvider *provider); + void (*show_about) (XfcePanelPluginProvider *provider); + void (*removed) (XfcePanelPluginProvider *provider); + gboolean (*remote_event) (XfcePanelPluginProvider *provider, + const gchar *name, + const GValue *value, + guint *handle); + void (*set_locked) (XfcePanelPluginProvider *provider, + gboolean locked); + void (*ask_remove) (XfcePanelPluginProvider *provider); }; /* signals send from the plugin to the panel (possibly through the wrapper) */ @@ -93,40 +93,38 @@ typedef enum /*< skip >*/ PROVIDER_SIGNAL_FOCUS_PLUGIN, PROVIDER_SIGNAL_SHRINK_PLUGIN, PROVIDER_SIGNAL_UNSHRINK_PLUGIN -} -XfcePanelPluginProviderSignal; +} XfcePanelPluginProviderSignal; /* properties to the plugin; with a value or as an action */ typedef enum /*< skip >*/ { - PROVIDER_PROP_TYPE_SET_SIZE, /* gint */ - PROVIDER_PROP_TYPE_SET_ICON_SIZE, /* gint */ - PROVIDER_PROP_TYPE_SET_DARK_MODE, /* gboolean */ - PROVIDER_PROP_TYPE_SET_MODE, /* XfcePanelPluginMode (as gint) */ - PROVIDER_PROP_TYPE_SET_SCREEN_POSITION, /* XfceScreenPosition (as gint) */ - PROVIDER_PROP_TYPE_SET_BACKGROUND_ALPHA, /* gdouble */ - PROVIDER_PROP_TYPE_SET_NROWS, /* gint */ - PROVIDER_PROP_TYPE_SET_LOCKED, /* gboolean */ - PROVIDER_PROP_TYPE_SET_SENSITIVE, /* gboolean */ - PROVIDER_PROP_TYPE_ACTION_REMOVED, /* none */ - PROVIDER_PROP_TYPE_ACTION_SAVE, /* none */ - PROVIDER_PROP_TYPE_ACTION_QUIT, /* none */ + PROVIDER_PROP_TYPE_SET_SIZE, /* gint */ + PROVIDER_PROP_TYPE_SET_ICON_SIZE, /* gint */ + PROVIDER_PROP_TYPE_SET_DARK_MODE, /* gboolean */ + PROVIDER_PROP_TYPE_SET_MODE, /* XfcePanelPluginMode (as gint) */ + PROVIDER_PROP_TYPE_SET_SCREEN_POSITION, /* XfceScreenPosition (as gint) */ + PROVIDER_PROP_TYPE_SET_BACKGROUND_ALPHA, /* gdouble */ + PROVIDER_PROP_TYPE_SET_NROWS, /* gint */ + PROVIDER_PROP_TYPE_SET_LOCKED, /* gboolean */ + PROVIDER_PROP_TYPE_SET_SENSITIVE, /* gboolean */ + PROVIDER_PROP_TYPE_ACTION_REMOVED, /* none */ + PROVIDER_PROP_TYPE_ACTION_SAVE, /* none */ + PROVIDER_PROP_TYPE_ACTION_QUIT, /* none */ PROVIDER_PROP_TYPE_ACTION_QUIT_FOR_RESTART, /* none */ PROVIDER_PROP_TYPE_ACTION_BACKGROUND_UNSET, /* none */ - PROVIDER_PROP_TYPE_ACTION_SHOW_CONFIGURE, /* none */ - PROVIDER_PROP_TYPE_ACTION_SHOW_ABOUT, /* none */ - PROVIDER_PROP_TYPE_ACTION_ASK_REMOVE, /* none */ + PROVIDER_PROP_TYPE_ACTION_SHOW_CONFIGURE, /* none */ + PROVIDER_PROP_TYPE_ACTION_SHOW_ABOUT, /* none */ + PROVIDER_PROP_TYPE_ACTION_ASK_REMOVE, /* none */ /* WrapperPlug, using the same enum and D-Bus signal for simplicity */ - PROVIDER_PROP_TYPE_SET_OPACITY, /* gdouble */ + PROVIDER_PROP_TYPE_SET_OPACITY, /* gdouble */ /* X11 only */ - PROVIDER_PROP_TYPE_SET_BACKGROUND_COLOR, /* string */ - PROVIDER_PROP_TYPE_SET_BACKGROUND_IMAGE, /* string */ + PROVIDER_PROP_TYPE_SET_BACKGROUND_COLOR, /* string */ + PROVIDER_PROP_TYPE_SET_BACKGROUND_IMAGE, /* string */ /* Wayland only */ - PROVIDER_PROP_TYPE_SET_MONITOR, /* gint */ - PROVIDER_PROP_TYPE_SET_GEOMETRY, /* GdkRectangle */ -} -XfcePanelPluginProviderPropType; + PROVIDER_PROP_TYPE_SET_MONITOR, /* gint */ + PROVIDER_PROP_TYPE_SET_GEOMETRY, /* GdkRectangle */ +} XfcePanelPluginProviderPropType; /* plugin exit values */ enum @@ -156,52 +154,70 @@ enum -const gchar *xfce_panel_plugin_provider_get_name (XfcePanelPluginProvider *provider); +const gchar * +xfce_panel_plugin_provider_get_name (XfcePanelPluginProvider *provider); -gint xfce_panel_plugin_provider_get_unique_id (XfcePanelPluginProvider *provider); +gint +xfce_panel_plugin_provider_get_unique_id (XfcePanelPluginProvider *provider); -void xfce_panel_plugin_provider_set_size (XfcePanelPluginProvider *provider, - gint size); +void +xfce_panel_plugin_provider_set_size (XfcePanelPluginProvider *provider, + gint size); -void xfce_panel_plugin_provider_set_icon_size (XfcePanelPluginProvider *provider, - gint icon_size); +void +xfce_panel_plugin_provider_set_icon_size (XfcePanelPluginProvider *provider, + gint icon_size); -void xfce_panel_plugin_provider_set_dark_mode (XfcePanelPluginProvider *provider, - gboolean dark_mode); +void +xfce_panel_plugin_provider_set_dark_mode (XfcePanelPluginProvider *provider, + gboolean dark_mode); -void xfce_panel_plugin_provider_set_mode (XfcePanelPluginProvider *provider, - XfcePanelPluginMode mode); +void +xfce_panel_plugin_provider_set_mode (XfcePanelPluginProvider *provider, + XfcePanelPluginMode mode); -void xfce_panel_plugin_provider_set_nrows (XfcePanelPluginProvider *provider, - guint rows); +void +xfce_panel_plugin_provider_set_nrows (XfcePanelPluginProvider *provider, + guint rows); -void xfce_panel_plugin_provider_set_screen_position (XfcePanelPluginProvider *provider, - XfceScreenPosition screen_position); +void +xfce_panel_plugin_provider_set_screen_position (XfcePanelPluginProvider *provider, + XfceScreenPosition screen_position); -void xfce_panel_plugin_provider_save (XfcePanelPluginProvider *provider); +void +xfce_panel_plugin_provider_save (XfcePanelPluginProvider *provider); -void xfce_panel_plugin_provider_emit_signal (XfcePanelPluginProvider *provider, - XfcePanelPluginProviderSignal provider_signal); +void +xfce_panel_plugin_provider_emit_signal (XfcePanelPluginProvider *provider, + XfcePanelPluginProviderSignal provider_signal); -gboolean xfce_panel_plugin_provider_get_show_configure (XfcePanelPluginProvider *provider); +gboolean +xfce_panel_plugin_provider_get_show_configure (XfcePanelPluginProvider *provider); -void xfce_panel_plugin_provider_show_configure (XfcePanelPluginProvider *provider); +void +xfce_panel_plugin_provider_show_configure (XfcePanelPluginProvider *provider); -gboolean xfce_panel_plugin_provider_get_show_about (XfcePanelPluginProvider *provider); +gboolean +xfce_panel_plugin_provider_get_show_about (XfcePanelPluginProvider *provider); -void xfce_panel_plugin_provider_show_about (XfcePanelPluginProvider *provider); +void +xfce_panel_plugin_provider_show_about (XfcePanelPluginProvider *provider); -void xfce_panel_plugin_provider_removed (XfcePanelPluginProvider *provider); +void +xfce_panel_plugin_provider_removed (XfcePanelPluginProvider *provider); -gboolean xfce_panel_plugin_provider_remote_event (XfcePanelPluginProvider *provider, - const gchar *name, - const GValue *value, - guint *handle); +gboolean +xfce_panel_plugin_provider_remote_event (XfcePanelPluginProvider *provider, + const gchar *name, + const GValue *value, + guint *handle); -void xfce_panel_plugin_provider_set_locked (XfcePanelPluginProvider *provider, - gboolean locked); +void +xfce_panel_plugin_provider_set_locked (XfcePanelPluginProvider *provider, + gboolean locked); -void xfce_panel_plugin_provider_ask_remove (XfcePanelPluginProvider *provider); +void +xfce_panel_plugin_provider_ask_remove (XfcePanelPluginProvider *provider); G_END_DECLS diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c index e9d19686b..b1e4aca95 100644 --- a/libxfce4panel/xfce-panel-plugin.c +++ b/libxfce4panel/xfce-panel-plugin.c @@ -62,60 +62,90 @@ typedef const gchar *(*ProviderToPluginChar) (XfcePanelPluginProvider *provider); -typedef gint (*ProviderToPluginInt) (XfcePanelPluginProvider *provider); - - - -static void xfce_panel_plugin_provider_init (XfcePanelPluginProviderInterface *iface); -static GObject *xfce_panel_plugin_constructor (GType type, - guint n_props, - GObjectConstructParam *props); -static void xfce_panel_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void xfce_panel_plugin_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void xfce_panel_plugin_dispose (GObject *object); -static void xfce_panel_plugin_finalize (GObject *object); -static void xfce_panel_plugin_realize (GtkWidget *widget); -static gboolean xfce_panel_plugin_button_press_event (GtkWidget *widget, - GdkEventButton *event); -static void xfce_panel_plugin_menu_move (XfcePanelPlugin *plugin); -static void xfce_panel_plugin_menu_remove (XfcePanelPlugin *plugin); -static void xfce_panel_plugin_menu_add_items (XfcePanelPlugin *plugin); -static void xfce_panel_plugin_menu_panel_preferences (XfcePanelPlugin *plugin); -static GtkMenu *xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin); -static inline gchar *xfce_panel_plugin_relative_filename (XfcePanelPlugin *plugin); -static void xfce_panel_plugin_unregister_menu (GtkMenu *menu, - XfcePanelPlugin *plugin); -static void xfce_panel_plugin_set_size (XfcePanelPluginProvider *provider, - gint size); -static void xfce_panel_plugin_set_icon_size (XfcePanelPluginProvider *provider, - gint icon_size); -static void xfce_panel_plugin_set_dark_mode (XfcePanelPluginProvider *provider, - gboolean dark_mode); -static void xfce_panel_plugin_set_mode (XfcePanelPluginProvider *provider, - XfcePanelPluginMode mode); -static void xfce_panel_plugin_set_nrows (XfcePanelPluginProvider *provider, - guint nrows); -static void xfce_panel_plugin_set_screen_position (XfcePanelPluginProvider *provider, - XfceScreenPosition screen_position); -static void xfce_panel_plugin_save (XfcePanelPluginProvider *provider); -static gboolean xfce_panel_plugin_get_show_configure (XfcePanelPluginProvider *provider); -static void xfce_panel_plugin_show_configure (XfcePanelPluginProvider *provider); -static gboolean xfce_panel_plugin_get_show_about (XfcePanelPluginProvider *provider); -static void xfce_panel_plugin_show_about (XfcePanelPluginProvider *provider); -static void xfce_panel_plugin_removed (XfcePanelPluginProvider *provider); -static gboolean xfce_panel_plugin_remote_event (XfcePanelPluginProvider *provider, - const gchar *name, - const GValue *value, - guint *handle); -static void xfce_panel_plugin_set_locked (XfcePanelPluginProvider *provider, - gboolean locked); -static void xfce_panel_plugin_ask_remove (XfcePanelPluginProvider *provider); +typedef gint (*ProviderToPluginInt) (XfcePanelPluginProvider *provider); + + + +static void +xfce_panel_plugin_provider_init (XfcePanelPluginProviderInterface *iface); +static GObject * +xfce_panel_plugin_constructor (GType type, + guint n_props, + GObjectConstructParam *props); +static void +xfce_panel_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +xfce_panel_plugin_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +xfce_panel_plugin_dispose (GObject *object); +static void +xfce_panel_plugin_finalize (GObject *object); +static void +xfce_panel_plugin_realize (GtkWidget *widget); +static gboolean +xfce_panel_plugin_button_press_event (GtkWidget *widget, + GdkEventButton *event); +static void +xfce_panel_plugin_menu_move (XfcePanelPlugin *plugin); +static void +xfce_panel_plugin_menu_remove (XfcePanelPlugin *plugin); +static void +xfce_panel_plugin_menu_add_items (XfcePanelPlugin *plugin); +static void +xfce_panel_plugin_menu_panel_preferences (XfcePanelPlugin *plugin); +static GtkMenu * +xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin); +static inline gchar * +xfce_panel_plugin_relative_filename (XfcePanelPlugin *plugin); +static void +xfce_panel_plugin_unregister_menu (GtkMenu *menu, + XfcePanelPlugin *plugin); +static void +xfce_panel_plugin_set_size (XfcePanelPluginProvider *provider, + gint size); +static void +xfce_panel_plugin_set_icon_size (XfcePanelPluginProvider *provider, + gint icon_size); +static void +xfce_panel_plugin_set_dark_mode (XfcePanelPluginProvider *provider, + gboolean dark_mode); +static void +xfce_panel_plugin_set_mode (XfcePanelPluginProvider *provider, + XfcePanelPluginMode mode); +static void +xfce_panel_plugin_set_nrows (XfcePanelPluginProvider *provider, + guint nrows); +static void +xfce_panel_plugin_set_screen_position (XfcePanelPluginProvider *provider, + XfceScreenPosition screen_position); +static void +xfce_panel_plugin_save (XfcePanelPluginProvider *provider); +static gboolean +xfce_panel_plugin_get_show_configure (XfcePanelPluginProvider *provider); +static void +xfce_panel_plugin_show_configure (XfcePanelPluginProvider *provider); +static gboolean +xfce_panel_plugin_get_show_about (XfcePanelPluginProvider *provider); +static void +xfce_panel_plugin_show_about (XfcePanelPluginProvider *provider); +static void +xfce_panel_plugin_removed (XfcePanelPluginProvider *provider); +static gboolean +xfce_panel_plugin_remote_event (XfcePanelPluginProvider *provider, + const gchar *name, + const GValue *value, + guint *handle); +static void +xfce_panel_plugin_set_locked (XfcePanelPluginProvider *provider, + gboolean locked); +static void +xfce_panel_plugin_ask_remove (XfcePanelPluginProvider *provider); @@ -158,54 +188,53 @@ enum typedef enum { - PLUGIN_FLAG_DISPOSED = 1 << 0, - PLUGIN_FLAG_CONSTRUCTED = 1 << 1, - PLUGIN_FLAG_REALIZED = 1 << 2, + PLUGIN_FLAG_DISPOSED = 1 << 0, + PLUGIN_FLAG_CONSTRUCTED = 1 << 1, + PLUGIN_FLAG_REALIZED = 1 << 2, PLUGIN_FLAG_SHOW_CONFIGURE = 1 << 3, - PLUGIN_FLAG_SHOW_ABOUT = 1 << 4, -} -PluginFlags; + PLUGIN_FLAG_SHOW_ABOUT = 1 << 4, +} PluginFlags; struct _XfcePanelPluginPrivate { /* plugin information */ - gchar *name; - gchar *display_name; - gchar *comment; - gint unique_id; - gchar *property_base; - gchar **arguments; - gint size; /* single row size */ - gint icon_size; - gboolean dark_mode; - guint expand : 1; - guint shrink : 1; - guint nrows; - XfcePanelPluginMode mode; - guint small : 1; - XfceScreenPosition screen_position; - guint locked : 1; - GSList *menu_items; + gchar *name; + gchar *display_name; + gchar *comment; + gint unique_id; + gchar *property_base; + gchar **arguments; + gint size; /* single row size */ + gint icon_size; + gboolean dark_mode; + guint expand : 1; + guint shrink : 1; + guint nrows; + XfcePanelPluginMode mode; + guint small : 1; + XfceScreenPosition screen_position; + guint locked : 1; + GSList *menu_items; /* flags for rembering states */ - PluginFlags flags; + PluginFlags flags; /* plugin right-click menu */ - GtkMenu *menu; + GtkMenu *menu; /* menu block counter (configure insensitive) */ - gint menu_blocked; + gint menu_blocked; /* autohide block counter */ - gint panel_lock; + gint panel_lock; }; -static guint plugin_signals[LAST_SIGNAL]; -static GQuark item_properties = 0; -static GQuark item_about = 0; -static GParamSpec *plugin_props[N_PROPERTIES] = { NULL, }; +static guint plugin_signals[LAST_SIGNAL]; +static GQuark item_properties = 0; +static GQuark item_about = 0; +static GParamSpec *plugin_props[N_PROPERTIES] = { NULL }; @@ -219,7 +248,7 @@ G_DEFINE_TYPE_WITH_CODE (XfcePanelPlugin, xfce_panel_plugin, GTK_TYPE_EVENT_BOX, static void xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; GtkWidgetClass *gtkwidget_class; klass->construct = NULL; @@ -246,14 +275,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * See also: xfce_panel_plugin_menu_show_about(). **/ - plugin_signals[ABOUT] = - g_signal_new (g_intern_static_string ("about"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfcePanelPluginClass, about), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + plugin_signals[ABOUT] = g_signal_new (g_intern_static_string ("about"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfcePanelPluginClass, about), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); /** * XfcePanelPlugin::configure-plugin @@ -267,14 +295,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * See also: xfce_panel_plugin_menu_show_configure() and * xfce_titled_dialog_new (). **/ - plugin_signals[CONFIGURE_PLUGIN] = - g_signal_new (g_intern_static_string ("configure-plugin"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfcePanelPluginClass, configure_plugin), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + plugin_signals[CONFIGURE_PLUGIN] = g_signal_new (g_intern_static_string ("configure-plugin"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfcePanelPluginClass, configure_plugin), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); /** * XfcePanelPlugin::free-data @@ -283,14 +310,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * This signal is emmitted when the plugin is closing. Plugin * writers should use this signal to free any allocated resources. **/ - plugin_signals[FREE_DATA] = - g_signal_new (g_intern_static_string ("free-data"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfcePanelPluginClass, free_data), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + plugin_signals[FREE_DATA] = g_signal_new (g_intern_static_string ("free-data"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfcePanelPluginClass, free_data), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); /** * XfcePanelPlugin::orientation-changed @@ -301,14 +327,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * the @plugin is on changes. Plugins writers can for example use * this signal to change the order of widgets in the plugin. **/ - plugin_signals[ORIENTATION_CHANGED] = - g_signal_new (g_intern_static_string ("orientation-changed"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfcePanelPluginClass, orientation_changed), - NULL, NULL, - g_cclosure_marshal_VOID__ENUM, - G_TYPE_NONE, 1, GTK_TYPE_ORIENTATION); + plugin_signals[ORIENTATION_CHANGED] = g_signal_new (g_intern_static_string ("orientation-changed"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfcePanelPluginClass, orientation_changed), + NULL, NULL, + g_cclosure_marshal_VOID__ENUM, + G_TYPE_NONE, 1, GTK_TYPE_ORIENTATION); /** * XfcePanelPlugin::mode-changed @@ -320,14 +345,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * Since: 4.10 **/ - plugin_signals[MODE_CHANGED] = - g_signal_new (g_intern_static_string ("mode-changed"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfcePanelPluginClass, mode_changed), - NULL, NULL, - g_cclosure_marshal_VOID__ENUM, - G_TYPE_NONE, 1, XFCE_TYPE_PANEL_PLUGIN_MODE); + plugin_signals[MODE_CHANGED] = g_signal_new (g_intern_static_string ("mode-changed"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfcePanelPluginClass, mode_changed), + NULL, NULL, + g_cclosure_marshal_VOID__ENUM, + G_TYPE_NONE, 1, XFCE_TYPE_PANEL_PLUGIN_MODE); /** * XfcePanelPlugin::nrows-changed @@ -339,14 +363,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * Since: 4.10 **/ - plugin_signals[NROWS_CHANGED] = - g_signal_new (g_intern_static_string ("nrows-changed"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfcePanelPluginClass, nrows_changed), - NULL, NULL, - g_cclosure_marshal_VOID__UINT, - G_TYPE_NONE, 1, G_TYPE_UINT); + plugin_signals[NROWS_CHANGED] = g_signal_new (g_intern_static_string ("nrows-changed"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfcePanelPluginClass, nrows_changed), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); /** * XfcePanelPlugin::remote-event @@ -362,14 +385,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * to send the signal also to other plugins with the same * name. **/ - plugin_signals[REMOTE_EVENT] = - g_signal_new (g_intern_static_string ("remote-event"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfcePanelPluginClass, remote_event), - NULL, NULL, - _libxfce4panel_marshal_BOOLEAN__STRING_BOXED, - G_TYPE_BOOLEAN, 2, G_TYPE_STRING, G_TYPE_VALUE); + plugin_signals[REMOTE_EVENT] = g_signal_new (g_intern_static_string ("remote-event"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfcePanelPluginClass, remote_event), + NULL, NULL, + _libxfce4panel_marshal_BOOLEAN__STRING_BOXED, + G_TYPE_BOOLEAN, 2, G_TYPE_STRING, G_TYPE_VALUE); /** * XfcePanelPlugin::removed @@ -388,14 +410,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * Since: 4.8 **/ - plugin_signals[REMOVED] = - g_signal_new (g_intern_static_string ("removed"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfcePanelPluginClass, removed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + plugin_signals[REMOVED] = g_signal_new (g_intern_static_string ("removed"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfcePanelPluginClass, removed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); /** * XfcePanelPlugin::save @@ -408,14 +429,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * See also: xfce_panel_plugin_save_location(). **/ - plugin_signals[SAVE] = - g_signal_new (g_intern_static_string ("save"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfcePanelPluginClass, save), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + plugin_signals[SAVE] = g_signal_new (g_intern_static_string ("save"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfcePanelPluginClass, save), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); /** * XfcePanelPlugin::size-changed @@ -432,14 +452,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * g_signal_connect (plugin, "size-changed", G_CALLBACK (gtk_true), NULL); **/ - plugin_signals[SIZE_CHANGED] = - g_signal_new (g_intern_static_string ("size-changed"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfcePanelPluginClass, size_changed), - g_signal_accumulator_true_handled, NULL, - _libxfce4panel_marshal_BOOLEAN__INT, - G_TYPE_BOOLEAN, 1, G_TYPE_INT); + plugin_signals[SIZE_CHANGED] = g_signal_new (g_intern_static_string ("size-changed"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfcePanelPluginClass, size_changed), + g_signal_accumulator_true_handled, NULL, + _libxfce4panel_marshal_BOOLEAN__INT, + G_TYPE_BOOLEAN, 1, G_TYPE_INT); /** * XfcePanelPlugin::screen-position-changed @@ -450,14 +469,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * the @plugin is on changes. Plugins writers can for example use * this signal to change the arrow direction of buttons. **/ - plugin_signals[SCREEN_POSITION_CHANGED] = - g_signal_new (g_intern_static_string ("screen-position-changed"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (XfcePanelPluginClass, screen_position_changed), - NULL, NULL, - g_cclosure_marshal_VOID__ENUM, - G_TYPE_NONE, 1, XFCE_TYPE_SCREEN_POSITION); + plugin_signals[SCREEN_POSITION_CHANGED] = g_signal_new (g_intern_static_string ("screen-position-changed"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (XfcePanelPluginClass, screen_position_changed), + NULL, NULL, + g_cclosure_marshal_VOID__ENUM, + G_TYPE_NONE, 1, XFCE_TYPE_SCREEN_POSITION); /** * XfcePanelPlugin:name: @@ -467,14 +485,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * xfce_panel_plugin_get_name() is recommended since that returns * a const string. **/ - plugin_props[PROP_NAME] = - g_param_spec_string ("name", - "Name", - "Plugin internal name", - NULL, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS - | G_PARAM_CONSTRUCT_ONLY); + plugin_props[PROP_NAME] = g_param_spec_string ("name", + "Name", + "Plugin internal name", + NULL, + G_PARAM_READWRITE + | G_PARAM_STATIC_STRINGS + | G_PARAM_CONSTRUCT_ONLY); /** * XfcePanelPlugin:display-name: @@ -484,14 +501,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * it to read the plugin display name, but xfce_panel_plugin_get_display_name() * is recommended. **/ - plugin_props[PROP_DISPLAY_NAME] = - g_param_spec_string ("display-name", - "Display Name", - "Plugin display name", - NULL, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS - | G_PARAM_CONSTRUCT_ONLY); + plugin_props[PROP_DISPLAY_NAME] = g_param_spec_string ("display-name", + "Display Name", + "Plugin display name", + NULL, + G_PARAM_READWRITE + | G_PARAM_STATIC_STRINGS + | G_PARAM_CONSTRUCT_ONLY); /** * XfcePanelPlugin:comment: @@ -503,14 +519,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * Since: 4.8 **/ - plugin_props[PROP_COMMENT] = - g_param_spec_string ("comment", - "Comment", - "Plugin comment", - NULL, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS - | G_PARAM_CONSTRUCT_ONLY); + plugin_props[PROP_COMMENT] = g_param_spec_string ("comment", + "Comment", + "Plugin comment", + NULL, + G_PARAM_READWRITE + | G_PARAM_STATIC_STRINGS + | G_PARAM_CONSTRUCT_ONLY); /** * XfcePanelPlugin:id: @@ -521,14 +536,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * Since: 4.8 **/ - plugin_props[PROP_UNIQUE_ID] = - g_param_spec_int ("unique-id", - "Unique ID", - "Unique plugin ID", - -1, G_MAXINT, -1, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS - | G_PARAM_CONSTRUCT_ONLY); + plugin_props[PROP_UNIQUE_ID] = g_param_spec_int ("unique-id", + "Unique ID", + "Unique plugin ID", + -1, G_MAXINT, -1, + G_PARAM_READWRITE + | G_PARAM_STATIC_STRINGS + | G_PARAM_CONSTRUCT_ONLY); /** * XfcePanelPlugin:arguments: @@ -538,14 +552,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * use it to read the arguments array, but * xfce_panel_plugin_get_arguments() is recommended. **/ - plugin_props[PROP_ARGUMENTS] = - g_param_spec_boxed ("arguments", - "Arguments", - "Startup arguments for the plugin", - G_TYPE_STRV, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS - | G_PARAM_CONSTRUCT_ONLY); + plugin_props[PROP_ARGUMENTS] = g_param_spec_boxed ("arguments", + "Arguments", + "Startup arguments for the plugin", + G_TYPE_STRV, + G_PARAM_READWRITE + | G_PARAM_STATIC_STRINGS + | G_PARAM_CONSTRUCT_ONLY); /** * XfcePanelPlugin:orientation: @@ -553,14 +566,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * The #GtkOrientation of the #XfcePanelPlugin. Plugin writer can use it to read the * plugin orientation, but xfce_panel_plugin_get_orientation() is recommended. **/ - plugin_props[PROP_ORIENTATION] = - g_param_spec_enum ("orientation", - "Orientation", - "Orientation of the plugin's panel", - GTK_TYPE_ORIENTATION, - GTK_ORIENTATION_HORIZONTAL, - G_PARAM_READABLE - | G_PARAM_STATIC_STRINGS); + plugin_props[PROP_ORIENTATION] = g_param_spec_enum ("orientation", + "Orientation", + "Orientation of the plugin's panel", + GTK_TYPE_ORIENTATION, + GTK_ORIENTATION_HORIZONTAL, + G_PARAM_READABLE + | G_PARAM_STATIC_STRINGS); /** * XfcePanelPlugin:size: @@ -568,13 +580,12 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * The size in pixels of the #XfcePanelPlugin. Plugin writer can use it to read the * plugin size, but xfce_panel_plugin_get_size() is recommended. **/ - plugin_props[PROP_SIZE] = - g_param_spec_int ("size", - "Size", - "Size of the plugin's panel", - 0, (128 * 6), 0, - G_PARAM_READABLE - | G_PARAM_STATIC_STRINGS); + plugin_props[PROP_SIZE] = g_param_spec_int ("size", + "Size", + "Size of the plugin's panel", + 0, (128 * 6), 0, + G_PARAM_READABLE + | G_PARAM_STATIC_STRINGS); /** * XfcePanelPlugin:icon-size: @@ -584,13 +595,12 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * Since: 4.14 **/ - plugin_props[PROP_ICON_SIZE] = - g_param_spec_int ("icon-size", - "Icon Size", - "Size of the plugin's icon", - 0, (256 * 6), 0, - G_PARAM_READABLE - | G_PARAM_STATIC_STRINGS); + plugin_props[PROP_ICON_SIZE] = g_param_spec_int ("icon-size", + "Icon Size", + "Size of the plugin's icon", + 0, (256 * 6), 0, + G_PARAM_READABLE + | G_PARAM_STATIC_STRINGS); /** * XfcePanelPlugin:dark-mode: @@ -600,13 +610,12 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * Since: 4.14 **/ - plugin_props[PROP_DARK_MODE] = - g_param_spec_boolean ("dark-mode", - "Dark Mode", - "Whether or not to request the Gtk dark theme variant", - FALSE, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS); + plugin_props[PROP_DARK_MODE] = g_param_spec_boolean ("dark-mode", + "Dark Mode", + "Whether or not to request the Gtk dark theme variant", + FALSE, + G_PARAM_READWRITE + | G_PARAM_STATIC_STRINGS); /** * XfcePanelPlugin:screen-position: @@ -615,14 +624,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * to read the plugin's screen position, but xfce_panel_plugin_get_screen_position() * is recommended. **/ - plugin_props[PROP_SCREEN_POSITION] = - g_param_spec_enum ("screen-position", - "Screen Position", - "Screen position of the plugin's panel", - XFCE_TYPE_SCREEN_POSITION, - XFCE_SCREEN_POSITION_NONE, - G_PARAM_READABLE - | G_PARAM_STATIC_STRINGS); + plugin_props[PROP_SCREEN_POSITION] = g_param_spec_enum ("screen-position", + "Screen Position", + "Screen position of the plugin's panel", + XFCE_TYPE_SCREEN_POSITION, + XFCE_SCREEN_POSITION_NONE, + G_PARAM_READABLE + | G_PARAM_STATIC_STRINGS); /** * XfcePanelPlugin:small: @@ -633,13 +641,12 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * Since: 4.10 **/ - plugin_props[PROP_SMALL] = - g_param_spec_boolean ("small", - "Small", - "Is this plugin small, e.g. a single button?", - FALSE, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS); + plugin_props[PROP_SMALL] = g_param_spec_boolean ("small", + "Small", + "Is this plugin small, e.g. a single button?", + FALSE, + G_PARAM_READWRITE + | G_PARAM_STATIC_STRINGS); /** * XfcePanelPlugin:expand: @@ -648,13 +655,12 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * to read or set this property, but xfce_panel_plugin_set_expand() * is recommended. **/ - plugin_props[PROP_EXPAND] = - g_param_spec_boolean ("expand", - "Expand", - "Whether this plugin is expanded", - FALSE, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS); + plugin_props[PROP_EXPAND] = g_param_spec_boolean ("expand", + "Expand", + "Whether this plugin is expanded", + FALSE, + G_PARAM_READWRITE + | G_PARAM_STATIC_STRINGS); /** * XfcePanelPlugin:shrink: @@ -665,13 +671,12 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * Since: 4.10 **/ - plugin_props[PROP_SHRINK] = - g_param_spec_boolean ("shrink", - "Shrink", - "Whether this plugin can shrink", - FALSE, - G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS); + plugin_props[PROP_SHRINK] = g_param_spec_boolean ("shrink", + "Shrink", + "Whether this plugin can shrink", + FALSE, + G_PARAM_READWRITE + | G_PARAM_STATIC_STRINGS); /** * XfcePanelPlugin:mode: @@ -680,14 +685,13 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * Since: 4.10 **/ - plugin_props[PROP_MODE] = - g_param_spec_enum ("mode", - "Mode", - "Disply mode of the plugin", - XFCE_TYPE_PANEL_PLUGIN_MODE, - XFCE_PANEL_PLUGIN_MODE_HORIZONTAL, - G_PARAM_READABLE - | G_PARAM_STATIC_STRINGS); + plugin_props[PROP_MODE] = g_param_spec_enum ("mode", + "Mode", + "Disply mode of the plugin", + XFCE_TYPE_PANEL_PLUGIN_MODE, + XFCE_PANEL_PLUGIN_MODE_HORIZONTAL, + G_PARAM_READABLE + | G_PARAM_STATIC_STRINGS); /** * XfcePanelPlugin:nrows: @@ -696,13 +700,12 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass) * * Since: 4.10 **/ - plugin_props[PROP_NROWS] = - g_param_spec_uint ("nrows", - "Nrows", - "Number of rows of the panel", - 1, 6, 1, - G_PARAM_READABLE - | G_PARAM_STATIC_STRINGS); + plugin_props[PROP_NROWS] = g_param_spec_uint ("nrows", + "Nrows", + "Number of rows of the panel", + 1, 6, 1, + G_PARAM_READABLE + | G_PARAM_STATIC_STRINGS); /* install all properties */ g_object_class_install_properties (gobject_class, N_PROPERTIES, plugin_props); @@ -781,8 +784,8 @@ xfce_panel_plugin_provider_init (XfcePanelPluginProviderInterface *iface) static GObject * -xfce_panel_plugin_constructor (GType type, - guint n_props, +xfce_panel_plugin_constructor (GType type, + guint n_props, GObjectConstructParam *props) { GObject *plugin; @@ -798,33 +801,33 @@ xfce_panel_plugin_constructor (GType type, static void -xfce_panel_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, +xfce_panel_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { - XfcePanelPluginPrivate *private = XFCE_PANEL_PLUGIN (object)->priv; + XfcePanelPluginPrivate *priv = XFCE_PANEL_PLUGIN (object)->priv; switch (prop_id) { case PROP_NAME: - g_value_set_static_string (value, private->name); + g_value_set_static_string (value, priv->name); break; case PROP_DISPLAY_NAME: - g_value_set_static_string (value, private->display_name); + g_value_set_static_string (value, priv->display_name); break; case PROP_COMMENT: - g_value_set_static_string (value, private->comment); + g_value_set_static_string (value, priv->comment); break; case PROP_UNIQUE_ID: - g_value_set_int (value, private->unique_id); + g_value_set_int (value, priv->unique_id); break; case PROP_ARGUMENTS: - g_value_set_boxed (value, private->arguments); + g_value_set_boxed (value, priv->arguments); break; case PROP_ORIENTATION: @@ -832,39 +835,39 @@ xfce_panel_plugin_get_property (GObject *object, break; case PROP_SIZE: - g_value_set_int (value, private->size * private->nrows); + g_value_set_int (value, priv->size * priv->nrows); break; case PROP_ICON_SIZE: - g_value_set_uint (value, private->icon_size); + g_value_set_uint (value, priv->icon_size); break; case PROP_DARK_MODE: - g_value_set_boolean (value, private->dark_mode); + g_value_set_boolean (value, priv->dark_mode); break; case PROP_NROWS: - g_value_set_uint (value, private->nrows); + g_value_set_uint (value, priv->nrows); break; case PROP_MODE: - g_value_set_enum (value, private->mode); + g_value_set_enum (value, priv->mode); break; case PROP_SMALL: - g_value_set_boolean (value, private->small); + g_value_set_boolean (value, priv->small); break; case PROP_SCREEN_POSITION: - g_value_set_enum (value, private->screen_position); + g_value_set_enum (value, priv->screen_position); break; case PROP_EXPAND: - g_value_set_boolean (value, private->expand); + g_value_set_boolean (value, priv->expand); break; case PROP_SHRINK: - g_value_set_boolean (value, private->shrink); + g_value_set_boolean (value, priv->shrink); break; default: @@ -876,42 +879,42 @@ xfce_panel_plugin_get_property (GObject *object, static void -xfce_panel_plugin_set_property (GObject *object, - guint prop_id, +xfce_panel_plugin_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { - XfcePanelPluginPrivate *private = XFCE_PANEL_PLUGIN (object)->priv; - gchar *name; + XfcePanelPluginPrivate *priv = XFCE_PANEL_PLUGIN (object)->priv; + gchar *name; switch (prop_id) { case PROP_NAME: case PROP_UNIQUE_ID: if (prop_id == PROP_NAME) - private->name = g_value_dup_string (value); + priv->name = g_value_dup_string (value); else - private->unique_id = g_value_get_int (value); + priv->unique_id = g_value_get_int (value); - if (private->unique_id != -1 && private->name != NULL) + if (priv->unique_id != -1 && priv->name != NULL) { /* give the widget a unique name for theming */ - name = g_strdup_printf ("%s-%d", private->name, private->unique_id); + name = g_strdup_printf ("%s-%d", priv->name, priv->unique_id); gtk_widget_set_name (GTK_WIDGET (object), name); g_free (name); } break; case PROP_DISPLAY_NAME: - private->display_name = g_value_dup_string (value); + priv->display_name = g_value_dup_string (value); break; case PROP_COMMENT: - private->comment = g_value_dup_string (value); + priv->comment = g_value_dup_string (value); break; case PROP_ARGUMENTS: - private->arguments = g_value_dup_boxed (value); + priv->arguments = g_value_dup_boxed (value); break; case PROP_DARK_MODE: @@ -982,7 +985,7 @@ static void xfce_panel_plugin_realize (GtkWidget *widget) { XfcePanelPluginClass *klass; - XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (widget); + XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (widget); /* let gtk realize the plugin */ (*GTK_WIDGET_CLASS (xfce_panel_plugin_parent_class)->realize) (widget); @@ -1003,13 +1006,13 @@ xfce_panel_plugin_realize (GtkWidget *widget) static gboolean -xfce_panel_plugin_button_press_event (GtkWidget *widget, +xfce_panel_plugin_button_press_event (GtkWidget *widget, GdkEventButton *event) { XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (widget); - guint modifiers; - GtkMenu *menu; - GtkWidget *item; + guint modifiers; + GtkMenu *menu; + GtkWidget *item; panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (widget), FALSE); @@ -1086,18 +1089,19 @@ xfce_panel_plugin_menu_remove (XfcePanelPlugin *plugin) /* create question dialog (same code is also in panel-preferences-dialog.c) */ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, - GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, - /* I18N: %s is the name of the plugin */ - _("Are you sure that you want to remove \"%s\"?"), - xfce_panel_plugin_get_display_name (plugin)); + GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, + /* I18N: %s is the name of the plugin */ + _("Are you sure that you want to remove \"%s\"?"), + xfce_panel_plugin_get_display_name (plugin)); gtk_window_set_screen (GTK_WINDOW (dialog), - gtk_widget_get_screen (GTK_WIDGET (plugin))); + gtk_widget_get_screen (GTK_WIDGET (plugin))); gtk_window_set_title (GTK_WINDOW (dialog), - _("Remove Item")); - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - _("Removing the item from the panel also means its configuration will be lost.")); + _("Remove Item")); + gtk_message_dialog_format_secondary_text ( + GTK_MESSAGE_DIALOG (dialog), + _("Removing the item from the panel also means its configuration will be lost.")); gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("_Cancel"), - GTK_RESPONSE_NO, _("_Remove"), GTK_RESPONSE_YES, NULL); + GTK_RESPONSE_NO, _("_Remove"), GTK_RESPONSE_YES, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_NO); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) @@ -1196,8 +1200,8 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin) GtkWidget *menu, *submenu; GtkWidget *item; GtkWidget *image; - gboolean locked; - GSList *li; + gboolean locked; + GSList *li; panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), NULL); @@ -1228,7 +1232,7 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin) /* properties item */ item = panel_image_menu_item_new_with_mnemonic (_("_Properties")); g_signal_connect_swapped (G_OBJECT (item), "activate", - G_CALLBACK (xfce_panel_plugin_show_configure), plugin); + G_CALLBACK (xfce_panel_plugin_show_configure), plugin); g_object_set_qdata (G_OBJECT (menu), item_properties, item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); image = gtk_image_new_from_icon_name ("document-properties", GTK_ICON_SIZE_MENU); @@ -1239,7 +1243,7 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin) /* about item */ item = panel_image_menu_item_new_with_mnemonic (_("_About")); g_signal_connect_swapped (G_OBJECT (item), "activate", - G_CALLBACK (xfce_panel_plugin_show_about), plugin); + G_CALLBACK (xfce_panel_plugin_show_about), plugin); g_object_set_qdata (G_OBJECT (menu), item_about, item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); image = gtk_image_new_from_icon_name ("help-about", GTK_ICON_SIZE_MENU); @@ -1250,7 +1254,7 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin) /* move item */ item = panel_image_menu_item_new_with_mnemonic (_("_Move")); g_signal_connect_swapped (G_OBJECT (item), "activate", - G_CALLBACK (xfce_panel_plugin_menu_move), plugin); + G_CALLBACK (xfce_panel_plugin_menu_move), plugin); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); @@ -1266,7 +1270,7 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin) /* remove */ item = panel_image_menu_item_new_with_mnemonic (_("_Remove")); g_signal_connect_object (G_OBJECT (item), "activate", - G_CALLBACK (xfce_panel_plugin_menu_remove), plugin, G_CONNECT_SWAPPED); + G_CALLBACK (xfce_panel_plugin_menu_remove), plugin, G_CONNECT_SWAPPED); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); @@ -1292,7 +1296,7 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin) /* add new items */ item = panel_image_menu_item_new_with_mnemonic (_("Add _New Items...")); g_signal_connect_swapped (G_OBJECT (item), "activate", - G_CALLBACK (xfce_panel_plugin_menu_add_items), plugin); + G_CALLBACK (xfce_panel_plugin_menu_add_items), plugin); gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); gtk_widget_show (item); @@ -1303,7 +1307,7 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin) /* customize panel */ item = panel_image_menu_item_new_with_mnemonic (_("Panel Pr_eferences...")); g_signal_connect_swapped (G_OBJECT (item), "activate", - G_CALLBACK (xfce_panel_plugin_menu_panel_preferences), plugin); + G_CALLBACK (xfce_panel_plugin_menu_panel_preferences), plugin); gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); gtk_widget_show (item); @@ -1320,7 +1324,7 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin) /* logout item */ item = panel_image_menu_item_new_with_mnemonic (_("Log _Out")); g_signal_connect_swapped (G_OBJECT (item), "activate", - G_CALLBACK (xfce_panel_plugin_menu_panel_logout), plugin); + G_CALLBACK (xfce_panel_plugin_menu_panel_logout), plugin); gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); gtk_widget_show (item); @@ -1336,7 +1340,7 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin) /* help item */ item = panel_image_menu_item_new_with_mnemonic (_("_Help")); g_signal_connect_swapped (G_OBJECT (item), "activate", - G_CALLBACK (xfce_panel_plugin_menu_panel_help), plugin); + G_CALLBACK (xfce_panel_plugin_menu_panel_help), plugin); gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); gtk_widget_show (item); @@ -1347,7 +1351,7 @@ xfce_panel_plugin_menu_get (XfcePanelPlugin *plugin) /* about item */ item = panel_image_menu_item_new_with_mnemonic (_("About")); g_signal_connect_swapped (G_OBJECT (item), "activate", - G_CALLBACK (xfce_panel_plugin_menu_panel_about), plugin); + G_CALLBACK (xfce_panel_plugin_menu_panel_about), plugin); gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); gtk_widget_show (item); @@ -1382,7 +1386,7 @@ xfce_panel_plugin_relative_filename (XfcePanelPlugin *plugin) static void -xfce_panel_plugin_unregister_menu (GtkMenu *menu, +xfce_panel_plugin_unregister_menu (GtkMenu *menu, XfcePanelPlugin *plugin) { guint id; @@ -1392,7 +1396,7 @@ xfce_panel_plugin_unregister_menu (GtkMenu *menu, /* disconnect this signal */ g_signal_handlers_disconnect_by_func (G_OBJECT (menu), - G_CALLBACK (xfce_panel_plugin_unregister_menu), plugin); + G_CALLBACK (xfce_panel_plugin_unregister_menu), plugin); /* remove pending source */ id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (menu), "menu-reposition-id")); @@ -1410,11 +1414,11 @@ xfce_panel_plugin_unregister_menu (GtkMenu *menu, static void xfce_panel_plugin_set_size (XfcePanelPluginProvider *provider, - gint size) + gint size) { XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (provider); - gboolean handled = FALSE; - gint real_size; + gboolean handled = FALSE; + gint real_size; panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (provider)); @@ -1442,7 +1446,7 @@ xfce_panel_plugin_set_size (XfcePanelPluginProvider *provider, static void xfce_panel_plugin_set_icon_size (XfcePanelPluginProvider *provider, - gint icon_size) + gint icon_size) { XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (provider); @@ -1460,7 +1464,7 @@ xfce_panel_plugin_set_icon_size (XfcePanelPluginProvider *provider, static void xfce_panel_plugin_set_dark_mode (XfcePanelPluginProvider *provider, - gboolean dark_mode) + gboolean dark_mode) { XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (provider); GtkSettings *gtk_settings; @@ -1487,11 +1491,11 @@ xfce_panel_plugin_set_dark_mode (XfcePanelPluginProvider *provider, static void xfce_panel_plugin_set_mode (XfcePanelPluginProvider *provider, - XfcePanelPluginMode mode) + XfcePanelPluginMode mode) { XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (provider); - GtkOrientation old_orientation; - GtkOrientation new_orientation; + GtkOrientation old_orientation; + GtkOrientation new_orientation; panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (provider)); @@ -1523,7 +1527,7 @@ xfce_panel_plugin_set_mode (XfcePanelPluginProvider *provider, static void xfce_panel_plugin_set_nrows (XfcePanelPluginProvider *provider, - guint nrows) + guint nrows) { XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (provider); @@ -1550,7 +1554,7 @@ xfce_panel_plugin_set_nrows (XfcePanelPluginProvider *provider, static void xfce_panel_plugin_set_screen_position (XfcePanelPluginProvider *provider, - XfceScreenPosition screen_position) + XfceScreenPosition screen_position) { XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (provider); @@ -1558,7 +1562,7 @@ xfce_panel_plugin_set_screen_position (XfcePanelPluginProvider *provider, /* check if update is required */ if (G_LIKELY (plugin->priv->screen_position != screen_position - || xfce_screen_position_is_floating (screen_position))) + || xfce_screen_position_is_floating (screen_position))) { plugin->priv->screen_position = screen_position; @@ -1646,9 +1650,9 @@ xfce_panel_plugin_removed (XfcePanelPluginProvider *provider) static gboolean xfce_panel_plugin_remote_event (XfcePanelPluginProvider *provider, - const gchar *name, - const GValue *value, - guint *handle) + const gchar *name, + const GValue *value, + guint *handle) { gboolean stop_emission; @@ -1666,7 +1670,7 @@ xfce_panel_plugin_remote_event (XfcePanelPluginProvider *provider, static void xfce_panel_plugin_set_locked (XfcePanelPluginProvider *provider, - gboolean locked) + gboolean locked) { XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (provider); @@ -1827,13 +1831,13 @@ xfce_panel_plugin_get_property_base (XfcePanelPlugin *plugin) * * Since: 4.8 **/ -const gchar * const * +const gchar *const * xfce_panel_plugin_get_arguments (XfcePanelPlugin *plugin) { g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), NULL); g_return_val_if_fail (XFCE_PANEL_PLUGIN_CONSTRUCTED (plugin), NULL); - return (const gchar * const *) plugin->priv->arguments; + return (const gchar *const *) plugin->priv->arguments; } @@ -1891,7 +1895,7 @@ xfce_panel_plugin_get_expand (XfcePanelPlugin *plugin) **/ void xfce_panel_plugin_set_expand (XfcePanelPlugin *plugin, - gboolean expand) + gboolean expand) { g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); g_return_if_fail (XFCE_PANEL_PLUGIN_CONSTRUCTED (plugin)); @@ -1906,8 +1910,7 @@ xfce_panel_plugin_set_expand (XfcePanelPlugin *plugin, /* emit signal (in provider) */ xfce_panel_plugin_provider_emit_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin), - expand ? PROVIDER_SIGNAL_EXPAND_PLUGIN : - PROVIDER_SIGNAL_COLLAPSE_PLUGIN); + expand ? PROVIDER_SIGNAL_EXPAND_PLUGIN : PROVIDER_SIGNAL_COLLAPSE_PLUGIN); g_object_notify_by_pspec (G_OBJECT (plugin), plugin_props[PROP_EXPAND]); } @@ -1949,7 +1952,7 @@ xfce_panel_plugin_get_shrink (XfcePanelPlugin *plugin) **/ void xfce_panel_plugin_set_shrink (XfcePanelPlugin *plugin, - gboolean shrink) + gboolean shrink) { g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); g_return_if_fail (XFCE_PANEL_PLUGIN_CONSTRUCTED (plugin)); @@ -1964,8 +1967,7 @@ xfce_panel_plugin_set_shrink (XfcePanelPlugin *plugin, /* emit signal (in provider) */ xfce_panel_plugin_provider_emit_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin), - shrink ? PROVIDER_SIGNAL_SHRINK_PLUGIN : - PROVIDER_SIGNAL_UNSHRINK_PLUGIN); + shrink ? PROVIDER_SIGNAL_SHRINK_PLUGIN : PROVIDER_SIGNAL_UNSHRINK_PLUGIN); g_object_notify_by_pspec (G_OBJECT (plugin), plugin_props[PROP_SHRINK]); } @@ -2005,7 +2007,7 @@ xfce_panel_plugin_get_small (XfcePanelPlugin *plugin) **/ void xfce_panel_plugin_set_small (XfcePanelPlugin *plugin, - gboolean small) + gboolean small) { g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); g_return_if_fail (XFCE_PANEL_PLUGIN_CONSTRUCTED (plugin)); @@ -2020,8 +2022,7 @@ xfce_panel_plugin_set_small (XfcePanelPlugin *plugin, /* emit signal (in provider) */ xfce_panel_plugin_provider_emit_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin), - small ? PROVIDER_SIGNAL_SMALL_PLUGIN : - PROVIDER_SIGNAL_UNSMALL_PLUGIN); + small ? PROVIDER_SIGNAL_SMALL_PLUGIN : PROVIDER_SIGNAL_UNSMALL_PLUGIN); g_object_notify_by_pspec (G_OBJECT (plugin), plugin_props[PROP_SMALL]); } @@ -2169,7 +2170,7 @@ xfce_panel_plugin_get_screen_position (XfcePanelPlugin *plugin) **/ void xfce_panel_plugin_take_window (XfcePanelPlugin *plugin, - GtkWindow *window) + GtkWindow *window) { g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); g_return_if_fail (GTK_IS_WINDOW (window)); @@ -2193,13 +2194,13 @@ xfce_panel_plugin_take_window (XfcePanelPlugin *plugin, **/ void xfce_panel_plugin_add_action_widget (XfcePanelPlugin *plugin, - GtkWidget *widget) + GtkWidget *widget) { g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); g_return_if_fail (GTK_IS_WIDGET (widget)); g_signal_connect_swapped (G_OBJECT (widget), "button-press-event", - G_CALLBACK (xfce_panel_plugin_button_press_event), plugin); + G_CALLBACK (xfce_panel_plugin_button_press_event), plugin); } @@ -2215,7 +2216,7 @@ xfce_panel_plugin_add_action_widget (XfcePanelPlugin *plugin, **/ void xfce_panel_plugin_menu_insert_item (XfcePanelPlugin *plugin, - GtkMenuItem *item) + GtkMenuItem *item) { g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); g_return_if_fail (GTK_IS_MENU_ITEM (item)); @@ -2237,7 +2238,7 @@ xfce_panel_plugin_menu_insert_item (XfcePanelPlugin *plugin, void xfce_panel_plugin_menu_show_configure (XfcePanelPlugin *plugin) { - GtkMenu *menu; + GtkMenu *menu; GtkWidget *item; g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); @@ -2248,11 +2249,11 @@ xfce_panel_plugin_menu_show_configure (XfcePanelPlugin *plugin) /* show the menu item if the menu is already generated */ if (G_UNLIKELY (plugin->priv->menu != NULL)) { - /* get and show the properties item */ - menu = xfce_panel_plugin_menu_get (plugin); - item = g_object_get_qdata (G_OBJECT (menu), item_properties); - if (G_LIKELY (item != NULL)) - gtk_widget_show (item); + /* get and show the properties item */ + menu = xfce_panel_plugin_menu_get (plugin); + item = g_object_get_qdata (G_OBJECT (menu), item_properties); + if (G_LIKELY (item != NULL)) + gtk_widget_show (item); } /* emit signal, used by the external plugin */ @@ -2272,7 +2273,7 @@ xfce_panel_plugin_menu_show_configure (XfcePanelPlugin *plugin) void xfce_panel_plugin_menu_show_about (XfcePanelPlugin *plugin) { - GtkMenu *menu; + GtkMenu *menu; GtkWidget *item; g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); @@ -2283,11 +2284,11 @@ xfce_panel_plugin_menu_show_about (XfcePanelPlugin *plugin) /* show the menu item if the menu is already generated */ if (G_UNLIKELY (plugin->priv->menu != NULL)) { - /* get and show the about item */ - menu = xfce_panel_plugin_menu_get (plugin); - item = g_object_get_qdata (G_OBJECT (menu), item_about); - if (G_LIKELY (item != NULL)) - gtk_widget_show (item); + /* get and show the about item */ + menu = xfce_panel_plugin_menu_get (plugin); + item = g_object_get_qdata (G_OBJECT (menu), item_about); + if (G_LIKELY (item != NULL)) + gtk_widget_show (item); } /* emit signal, used by the external plugin */ @@ -2323,7 +2324,6 @@ xfce_panel_plugin_menu_destroy (XfcePanelPlugin *plugin) - /** * xfce_panel_plugin_get_locked: * @plugin : an #XfcePanelPlugin. @@ -2433,7 +2433,7 @@ xfce_panel_plugin_unblock_menu (XfcePanelPlugin *plugin) **/ void xfce_panel_plugin_register_menu (XfcePanelPlugin *plugin, - GtkMenu *menu) + GtkMenu *menu) { g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); g_return_if_fail (GTK_IS_MENU (menu)); @@ -2441,13 +2441,13 @@ xfce_panel_plugin_register_menu (XfcePanelPlugin *plugin, /* connect signal to menu to decrease counter */ g_signal_connect (G_OBJECT (menu), "deactivate", - G_CALLBACK (xfce_panel_plugin_unregister_menu), plugin); + G_CALLBACK (xfce_panel_plugin_unregister_menu), plugin); g_signal_connect (G_OBJECT (menu), "selection-done", - G_CALLBACK (xfce_panel_plugin_unregister_menu), plugin); + G_CALLBACK (xfce_panel_plugin_unregister_menu), plugin); g_signal_connect (G_OBJECT (menu), "destroy", - G_CALLBACK (xfce_panel_plugin_unregister_menu), plugin); + G_CALLBACK (xfce_panel_plugin_unregister_menu), plugin); g_signal_connect (G_OBJECT (menu), "hide", - G_CALLBACK (xfce_panel_plugin_unregister_menu), plugin); + G_CALLBACK (xfce_panel_plugin_unregister_menu), plugin); /* tell panel it needs to lock */ xfce_panel_plugin_block_autohide (plugin, TRUE); @@ -2466,13 +2466,13 @@ xfce_panel_plugin_register_menu (XfcePanelPlugin *plugin, GtkArrowType xfce_panel_plugin_arrow_type (XfcePanelPlugin *plugin) { - XfceScreenPosition screen_position; - GdkScreen *screen; - GdkDisplay *display; - GdkMonitor *monitor; - GdkRectangle geometry; - gint x, y; - GdkWindow *window; + XfceScreenPosition screen_position; + GdkScreen *screen; + GdkDisplay *display; + GdkMonitor *monitor; + GdkRectangle geometry; + gint x, y; + GdkWindow *window; g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), GTK_ARROW_NONE); g_return_val_if_fail (XFCE_PANEL_PLUGIN_CONSTRUCTED (plugin), GTK_ARROW_NONE); @@ -2547,22 +2547,22 @@ xfce_panel_plugin_arrow_type (XfcePanelPlugin *plugin) **/ void xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin, - GtkWidget *menu_widget, - GtkWidget *attach_widget, - gint *x, - gint *y) + GtkWidget *menu_widget, + GtkWidget *attach_widget, + gint *x, + gint *y) { #ifdef ENABLE_X11 - GtkWidget *plug; - gint px, py; + GtkWidget *plug; + gint px, py; #endif - GtkRequisition requisition; - GdkScreen *screen; - GdkRectangle geometry; - GdkDisplay *display; - GdkMonitor *monitor; - GtkWindow *toplevel; - GtkAllocation alloc; + GtkRequisition requisition; + GdkScreen *screen; + GdkRectangle geometry; + GdkDisplay *display; + GdkMonitor *monitor; + GtkWindow *toplevel; + GtkAllocation alloc; g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); g_return_if_fail (GTK_IS_WIDGET (menu_widget)); @@ -2599,15 +2599,15 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin, #endif gtk_window_get_position (toplevel, x, y); - /* correct position for external plugins on X11 */ #ifdef ENABLE_X11 + /* correct position for external plugins on X11 */ plug = gtk_widget_get_ancestor (attach_widget, GTK_TYPE_PLUG); if (plug != NULL) { - gdk_window_get_geometry (gtk_plug_get_socket_window (GTK_PLUG (plug)), - &px, &py, NULL, NULL); - *x += px; - *y += py; + gdk_window_get_geometry (gtk_plug_get_socket_window (GTK_PLUG (plug)), + &px, &py, NULL, NULL); + *x += px; + *y += py; } #endif @@ -2698,11 +2698,11 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin, * Deprecated: 4.17.2: Use xfce_panel_plugin_popup_menu() instead. **/ void -xfce_panel_plugin_position_menu (GtkMenu *menu, - gint *x, - gint *y, +xfce_panel_plugin_position_menu (GtkMenu *menu, + gint *x, + gint *y, gboolean *push_in, - gpointer panel_plugin) + gpointer panel_plugin) { GtkWidget *attach_widget; @@ -2762,13 +2762,13 @@ xfce_panel_plugin_popup_menu_reposition (gpointer data) **/ void xfce_panel_plugin_popup_menu (XfcePanelPlugin *plugin, - GtkMenu *menu, - GtkWidget *widget, - const GdkEvent *trigger_event) + GtkMenu *menu, + GtkWidget *widget, + const GdkEvent *trigger_event) { GdkGravity widget_anchor, menu_anchor; - gboolean popup_at_widget = TRUE; - guint id; + gboolean popup_at_widget = TRUE; + guint id; g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); g_return_if_fail (GTK_IS_MENU (menu)); @@ -2778,29 +2778,29 @@ xfce_panel_plugin_popup_menu (XfcePanelPlugin *plugin, { switch (xfce_panel_plugin_arrow_type (plugin)) { - case GTK_ARROW_DOWN: - widget_anchor = GDK_GRAVITY_SOUTH_WEST; - menu_anchor = GDK_GRAVITY_NORTH_WEST; - break; - - case GTK_ARROW_RIGHT: - widget_anchor = GDK_GRAVITY_NORTH_EAST; - menu_anchor = GDK_GRAVITY_NORTH_WEST; - break; - - case GTK_ARROW_LEFT: - widget_anchor = GDK_GRAVITY_NORTH_WEST; - menu_anchor = GDK_GRAVITY_NORTH_EAST; - break; - - case GTK_ARROW_UP: - widget_anchor = GDK_GRAVITY_NORTH_WEST; - menu_anchor = GDK_GRAVITY_SOUTH_WEST; - break; - - default: - popup_at_widget = FALSE; - break; + case GTK_ARROW_DOWN: + widget_anchor = GDK_GRAVITY_SOUTH_WEST; + menu_anchor = GDK_GRAVITY_NORTH_WEST; + break; + + case GTK_ARROW_RIGHT: + widget_anchor = GDK_GRAVITY_NORTH_EAST; + menu_anchor = GDK_GRAVITY_NORTH_WEST; + break; + + case GTK_ARROW_LEFT: + widget_anchor = GDK_GRAVITY_NORTH_WEST; + menu_anchor = GDK_GRAVITY_NORTH_EAST; + break; + + case GTK_ARROW_UP: + widget_anchor = GDK_GRAVITY_NORTH_WEST; + menu_anchor = GDK_GRAVITY_SOUTH_WEST; + break; + + default: + popup_at_widget = FALSE; + break; } } else @@ -2877,7 +2877,7 @@ xfce_panel_plugin_popup_window_has_toplevel_focus (GObject *window, GParamSpec *pspec, XfcePanelPlugin *plugin) { - if (! gtk_window_has_toplevel_focus (GTK_WINDOW (window))) + if (!gtk_window_has_toplevel_focus (GTK_WINDOW (window))) { /* delay hiding so button-press event is consumed in between, otherwise we could * re-enter the plugin signal handler with a hidden window and show it again */ @@ -2894,15 +2894,11 @@ xfce_panel_plugin_popup_window_hide (GtkWidget *window, { guint id; - g_signal_handlers_disconnect_by_func (window, - xfce_panel_plugin_popup_window_button_press_event, plugin); - g_signal_handlers_disconnect_by_func (window, - xfce_panel_plugin_popup_window_key_press_event, plugin); - g_signal_handlers_disconnect_by_func (window, - xfce_panel_plugin_popup_window_hide, plugin); + g_signal_handlers_disconnect_by_func (window, xfce_panel_plugin_popup_window_button_press_event, plugin); + g_signal_handlers_disconnect_by_func (window, xfce_panel_plugin_popup_window_key_press_event, plugin); + g_signal_handlers_disconnect_by_func (window, xfce_panel_plugin_popup_window_hide, plugin); if (gtk_layer_is_supported ()) - g_signal_handlers_disconnect_by_func (window, - xfce_panel_plugin_popup_window_has_toplevel_focus, plugin); + g_signal_handlers_disconnect_by_func (window, xfce_panel_plugin_popup_window_has_toplevel_focus, plugin); id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (plugin), "window-reposition-id")); if (id != 0) @@ -3010,7 +3006,7 @@ xfce_panel_plugin_popup_window (XfcePanelPlugin *plugin, { GdkMonitor *monitor; - if (! gtk_layer_is_layer_window (window)) + if (!gtk_layer_is_layer_window (window)) gtk_layer_init_for_window (window); monitor = gdk_display_get_monitor_at_window (gdk_display_get_default (), @@ -3059,7 +3055,8 @@ xfce_panel_plugin_popup_window (XfcePanelPlugin *plugin, grabbed = gdk_seat_grab (gdk_display_get_default_seat (gdk_display_get_default ()), gtk_widget_get_window (GTK_WIDGET (window)), GDK_SEAT_CAPABILITY_ALL, TRUE, - NULL, NULL, NULL, NULL) == GDK_GRAB_SUCCESS; + NULL, NULL, NULL, NULL) + == GDK_GRAB_SUCCESS; g_object_set_data (G_OBJECT (window), "seat-grabbed", GINT_TO_POINTER (grabbed)); if (grabbed) break; @@ -3079,7 +3076,7 @@ xfce_panel_plugin_popup_window (XfcePanelPlugin *plugin, **/ void xfce_panel_plugin_focus_widget (XfcePanelPlugin *plugin, - GtkWidget *widget) + GtkWidget *widget) { g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); g_return_if_fail (GTK_IS_WIDGET (widget)); @@ -3111,7 +3108,7 @@ xfce_panel_plugin_focus_widget (XfcePanelPlugin *plugin, **/ void xfce_panel_plugin_block_autohide (XfcePanelPlugin *plugin, - gboolean blocked) + gboolean blocked) { g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); g_return_if_fail (XFCE_PANEL_PLUGIN_CONSTRUCTED (plugin)); @@ -3188,7 +3185,7 @@ xfce_panel_plugin_lookup_rc_file (XfcePanelPlugin *plugin) **/ gchar * xfce_panel_plugin_save_location (XfcePanelPlugin *plugin, - gboolean create) + gboolean create) { gchar *filename, *path; diff --git a/libxfce4panel/xfce-panel-plugin.h b/libxfce4panel/xfce-panel-plugin.h index ee80da62f..d3b30b76b 100644 --- a/libxfce4panel/xfce-panel-plugin.h +++ b/libxfce4panel/xfce-panel-plugin.h @@ -27,8 +27,8 @@ G_BEGIN_DECLS typedef struct _XfcePanelPluginPrivate XfcePanelPluginPrivate; -typedef struct _XfcePanelPluginClass XfcePanelPluginClass; -typedef struct _XfcePanelPlugin XfcePanelPlugin; +typedef struct _XfcePanelPluginClass XfcePanelPluginClass; +typedef struct _XfcePanelPlugin XfcePanelPlugin; /** * XfcePanelPluginFunc: @@ -55,7 +55,7 @@ typedef void (*XfcePanelPluginFunc) (XfcePanelPlugin *plugin); * * Since: 4.6 **/ -typedef gboolean (*XfcePanelPluginPreInit) (gint argc, +typedef gboolean (*XfcePanelPluginPreInit) (gint argc, gchar **argv); /** @@ -70,12 +70,12 @@ typedef gboolean (*XfcePanelPluginPreInit) (gint argc, **/ typedef gboolean (*XfcePanelPluginCheck) (GdkScreen *screen); -#define XFCE_TYPE_PANEL_PLUGIN (xfce_panel_plugin_get_type ()) -#define XFCE_PANEL_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_PANEL_PLUGIN, XfcePanelPlugin)) -#define XFCE_PANEL_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_PANEL_PLUGIN, XfcePanelPluginClass)) -#define XFCE_IS_PANEL_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_PANEL_PLUGIN)) +#define XFCE_TYPE_PANEL_PLUGIN (xfce_panel_plugin_get_type ()) +#define XFCE_PANEL_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_PANEL_PLUGIN, XfcePanelPlugin)) +#define XFCE_PANEL_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_PANEL_PLUGIN, XfcePanelPluginClass)) +#define XFCE_IS_PANEL_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_PANEL_PLUGIN)) #define XFCE_IS_PANEL_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_PANEL_PLUGIN)) -#define XFCE_PANEL_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_PANEL_PLUGIN, XfcePanelPluginClass)) +#define XFCE_PANEL_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_PANEL_PLUGIN, XfcePanelPluginClass)) G_DEFINE_AUTOPTR_CLEANUP_FUNC (XfcePanelPlugin, g_object_unref) /** @@ -109,29 +109,29 @@ struct _XfcePanelPluginClass /*< public >*/ /* for object oriented plugins only */ - void (*construct) (XfcePanelPlugin *plugin); + void (*construct) (XfcePanelPlugin *plugin); /* signals */ - void (*screen_position_changed) (XfcePanelPlugin *plugin, - XfceScreenPosition position); - gboolean (*size_changed) (XfcePanelPlugin *plugin, - gint size); - void (*orientation_changed) (XfcePanelPlugin *plugin, - GtkOrientation orientation); - void (*free_data) (XfcePanelPlugin *plugin); - void (*save) (XfcePanelPlugin *plugin); - void (*about) (XfcePanelPlugin *plugin); - void (*configure_plugin) (XfcePanelPlugin *plugin); - void (*removed) (XfcePanelPlugin *plugin); - gboolean (*remote_event) (XfcePanelPlugin *plugin, - const gchar *name, - const GValue *value); + void (*screen_position_changed) (XfcePanelPlugin *plugin, + XfceScreenPosition position); + gboolean (*size_changed) (XfcePanelPlugin *plugin, + gint size); + void (*orientation_changed) (XfcePanelPlugin *plugin, + GtkOrientation orientation); + void (*free_data) (XfcePanelPlugin *plugin); + void (*save) (XfcePanelPlugin *plugin); + void (*about) (XfcePanelPlugin *plugin); + void (*configure_plugin) (XfcePanelPlugin *plugin); + void (*removed) (XfcePanelPlugin *plugin); + gboolean (*remote_event) (XfcePanelPlugin *plugin, + const gchar *name, + const GValue *value); /* new in 4.10 */ - void (*mode_changed) (XfcePanelPlugin *plugin, - XfcePanelPluginMode mode); - void (*nrows_changed) (XfcePanelPlugin *plugin, - guint rows); + void (*mode_changed) (XfcePanelPlugin *plugin, + XfcePanelPluginMode mode); + void (*nrows_changed) (XfcePanelPlugin *plugin, + guint rows); /*< private >*/ void (*reserved1) (void); @@ -156,107 +156,146 @@ struct _XfcePanelPlugin -GType xfce_panel_plugin_get_type (void) G_GNUC_CONST; +GType +xfce_panel_plugin_get_type (void) G_GNUC_CONST; -const gchar *xfce_panel_plugin_get_name (XfcePanelPlugin *plugin) G_GNUC_PURE; +const gchar * +xfce_panel_plugin_get_name (XfcePanelPlugin *plugin) G_GNUC_PURE; -const gchar *xfce_panel_plugin_get_display_name (XfcePanelPlugin *plugin) G_GNUC_PURE; +const gchar * +xfce_panel_plugin_get_display_name (XfcePanelPlugin *plugin) G_GNUC_PURE; -const gchar *xfce_panel_plugin_get_comment (XfcePanelPlugin *plugin) G_GNUC_PURE; +const gchar * +xfce_panel_plugin_get_comment (XfcePanelPlugin *plugin) G_GNUC_PURE; -gint xfce_panel_plugin_get_unique_id (XfcePanelPlugin *plugin) G_GNUC_PURE; +gint +xfce_panel_plugin_get_unique_id (XfcePanelPlugin *plugin) G_GNUC_PURE; -const gchar *xfce_panel_plugin_get_property_base (XfcePanelPlugin *plugin) G_GNUC_PURE; +const gchar * +xfce_panel_plugin_get_property_base (XfcePanelPlugin *plugin) G_GNUC_PURE; -const gchar * const *xfce_panel_plugin_get_arguments (XfcePanelPlugin *plugin) G_GNUC_PURE; +const gchar *const * +xfce_panel_plugin_get_arguments (XfcePanelPlugin *plugin) G_GNUC_PURE; -gint xfce_panel_plugin_get_size (XfcePanelPlugin *plugin) G_GNUC_PURE; +gint +xfce_panel_plugin_get_size (XfcePanelPlugin *plugin) G_GNUC_PURE; -gboolean xfce_panel_plugin_get_expand (XfcePanelPlugin *plugin) G_GNUC_PURE; +gboolean +xfce_panel_plugin_get_expand (XfcePanelPlugin *plugin) G_GNUC_PURE; -void xfce_panel_plugin_set_expand (XfcePanelPlugin *plugin, - gboolean expand); +void +xfce_panel_plugin_set_expand (XfcePanelPlugin *plugin, + gboolean expand); -gboolean xfce_panel_plugin_get_shrink (XfcePanelPlugin *plugin) G_GNUC_PURE; +gboolean +xfce_panel_plugin_get_shrink (XfcePanelPlugin *plugin) G_GNUC_PURE; -void xfce_panel_plugin_set_shrink (XfcePanelPlugin *plugin, - gboolean shrink); +void +xfce_panel_plugin_set_shrink (XfcePanelPlugin *plugin, + gboolean shrink); -gboolean xfce_panel_plugin_get_small (XfcePanelPlugin *plugin) G_GNUC_PURE; +gboolean +xfce_panel_plugin_get_small (XfcePanelPlugin *plugin) G_GNUC_PURE; -void xfce_panel_plugin_set_small (XfcePanelPlugin *plugin, - gboolean small); +void +xfce_panel_plugin_set_small (XfcePanelPlugin *plugin, + gboolean small); -gint xfce_panel_plugin_get_icon_size (XfcePanelPlugin *plugin) G_GNUC_PURE; +gint +xfce_panel_plugin_get_icon_size (XfcePanelPlugin *plugin) G_GNUC_PURE; -GtkOrientation xfce_panel_plugin_get_orientation (XfcePanelPlugin *plugin) G_GNUC_PURE; +GtkOrientation +xfce_panel_plugin_get_orientation (XfcePanelPlugin *plugin) G_GNUC_PURE; -XfcePanelPluginMode xfce_panel_plugin_get_mode (XfcePanelPlugin *plugin) G_GNUC_PURE; +XfcePanelPluginMode +xfce_panel_plugin_get_mode (XfcePanelPlugin *plugin) G_GNUC_PURE; -guint xfce_panel_plugin_get_nrows (XfcePanelPlugin *plugin) G_GNUC_PURE; +guint +xfce_panel_plugin_get_nrows (XfcePanelPlugin *plugin) G_GNUC_PURE; -XfceScreenPosition xfce_panel_plugin_get_screen_position (XfcePanelPlugin *plugin) G_GNUC_PURE; +XfceScreenPosition +xfce_panel_plugin_get_screen_position (XfcePanelPlugin *plugin) G_GNUC_PURE; -void xfce_panel_plugin_take_window (XfcePanelPlugin *plugin, - GtkWindow *window); +void +xfce_panel_plugin_take_window (XfcePanelPlugin *plugin, + GtkWindow *window); -void xfce_panel_plugin_add_action_widget (XfcePanelPlugin *plugin, - GtkWidget *widget); +void +xfce_panel_plugin_add_action_widget (XfcePanelPlugin *plugin, + GtkWidget *widget); -void xfce_panel_plugin_menu_insert_item (XfcePanelPlugin *plugin, - GtkMenuItem *item); +void +xfce_panel_plugin_menu_insert_item (XfcePanelPlugin *plugin, + GtkMenuItem *item); -void xfce_panel_plugin_menu_show_configure (XfcePanelPlugin *plugin); +void +xfce_panel_plugin_menu_show_configure (XfcePanelPlugin *plugin); -void xfce_panel_plugin_menu_show_about (XfcePanelPlugin *plugin); +void +xfce_panel_plugin_menu_show_about (XfcePanelPlugin *plugin); -void xfce_panel_plugin_menu_destroy (XfcePanelPlugin *plugin); +void +xfce_panel_plugin_menu_destroy (XfcePanelPlugin *plugin); -gboolean xfce_panel_plugin_get_locked (XfcePanelPlugin *plugin); +gboolean +xfce_panel_plugin_get_locked (XfcePanelPlugin *plugin); -void xfce_panel_plugin_remove (XfcePanelPlugin *plugin); +void +xfce_panel_plugin_remove (XfcePanelPlugin *plugin); -void xfce_panel_plugin_block_menu (XfcePanelPlugin *plugin); +void +xfce_panel_plugin_block_menu (XfcePanelPlugin *plugin); -void xfce_panel_plugin_unblock_menu (XfcePanelPlugin *plugin); +void +xfce_panel_plugin_unblock_menu (XfcePanelPlugin *plugin); -void xfce_panel_plugin_register_menu (XfcePanelPlugin *plugin, - GtkMenu *menu); +void +xfce_panel_plugin_register_menu (XfcePanelPlugin *plugin, + GtkMenu *menu); -GtkArrowType xfce_panel_plugin_arrow_type (XfcePanelPlugin *plugin); +GtkArrowType +xfce_panel_plugin_arrow_type (XfcePanelPlugin *plugin); -void xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin, - GtkWidget *menu_widget, - GtkWidget *attach_widget, - gint *x, - gint *y); +void +xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin, + GtkWidget *menu_widget, + GtkWidget *attach_widget, + gint *x, + gint *y); -void xfce_panel_plugin_position_menu (GtkMenu *menu, - gint *x, - gint *y, - gboolean *push_in, - gpointer panel_plugin) -G_GNUC_DEPRECATED_FOR (xfce_panel_plugin_popup_menu()); +void +xfce_panel_plugin_position_menu (GtkMenu *menu, + gint *x, + gint *y, + gboolean *push_in, + gpointer panel_plugin) + G_GNUC_DEPRECATED_FOR (xfce_panel_plugin_popup_menu ()); -void xfce_panel_plugin_popup_menu (XfcePanelPlugin *plugin, - GtkMenu *menu, - GtkWidget *widget, - const GdkEvent *trigger_event); +void +xfce_panel_plugin_popup_menu (XfcePanelPlugin *plugin, + GtkMenu *menu, + GtkWidget *widget, + const GdkEvent *trigger_event); -void xfce_panel_plugin_popup_window (XfcePanelPlugin *plugin, - GtkWindow *window, - GtkWidget *widget); +void +xfce_panel_plugin_popup_window (XfcePanelPlugin *plugin, + GtkWindow *window, + GtkWidget *widget); -void xfce_panel_plugin_focus_widget (XfcePanelPlugin *plugin, - GtkWidget *widget); +void +xfce_panel_plugin_focus_widget (XfcePanelPlugin *plugin, + GtkWidget *widget); -void xfce_panel_plugin_block_autohide (XfcePanelPlugin *plugin, - gboolean blocked); +void +xfce_panel_plugin_block_autohide (XfcePanelPlugin *plugin, + gboolean blocked); -gchar *xfce_panel_plugin_lookup_rc_file (XfcePanelPlugin *plugin) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +gchar * +xfce_panel_plugin_lookup_rc_file (XfcePanelPlugin *plugin) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; -gchar *xfce_panel_plugin_save_location (XfcePanelPlugin *plugin, - gboolean create) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +gchar * +xfce_panel_plugin_save_location (XfcePanelPlugin *plugin, + gboolean create) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; G_END_DECLS diff --git a/migrate/main.c b/migrate/main.c index 09cae12a2..52496ec84 100644 --- a/migrate/main.c +++ b/migrate/main.c @@ -34,18 +34,19 @@ #define DEFAULT_CONFIG_FILENAME "xfce4" G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "default.xml" -#define DEFAULT_CONFIG_PATH XDGCONFIGDIR G_DIR_SEPARATOR_S DEFAULT_CONFIG_FILENAME +#define DEFAULT_CONFIG_PATH XDGCONFIGDIR G_DIR_SEPARATOR_S DEFAULT_CONFIG_FILENAME gint -main (gint argc, gchar **argv) +main (gint argc, + gchar **argv) { - GError *error = NULL; - gint retval = EXIT_SUCCESS; + GError *error = NULL; + gint retval = EXIT_SUCCESS; XfconfChannel *channel; - gint configver; - gchar *filename_default; - gboolean migrate_vendor_default; + gint configver; + gchar *filename_default; + gboolean migrate_vendor_default; /* set translation domain */ xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8"); @@ -89,7 +90,7 @@ main (gint argc, gchar **argv) if (filename_default != NULL) { - migrate_default: +migrate_default: /* apply default config */ if (!migrate_default (filename_default, &error)) diff --git a/migrate/migrate-config.c b/migrate/migrate-config.c index 3f8fe84e7..c03aabb4f 100644 --- a/migrate/migrate-config.c +++ b/migrate/migrate-config.c @@ -28,10 +28,10 @@ static guint migrate_config_strchr_count (const gchar *haystack, - const gchar needle) + const gchar needle) { const gchar *p; - guint count = 0; + guint count = 0; if (G_UNLIKELY (haystack != NULL)) { @@ -51,7 +51,7 @@ migrate_config_session_menu (gpointer key, gpointer channel) { const GValue *gvalue = value; - const gchar *prop = key; + const gchar *prop = key; /* skip non root plugin properties */ if (!G_VALUE_HOLDS_STRING (gvalue) @@ -108,12 +108,12 @@ migrate_config_action_48 (gpointer key, gpointer channel) { const GValue *gvalue = value; - const gchar *prop = key; - gchar str[64]; - gint first_action_int; - gint second_action_int; - const gchar *first_action; - const gchar *second_action; + const gchar *prop = key; + gchar str[64]; + gint first_action_int; + gint second_action_int; + const gchar *first_action; + const gchar *second_action; /* skip non root plugin properties */ if (!G_VALUE_HOLDS_STRING (gvalue) @@ -164,14 +164,14 @@ migrate_config_action_48 (gpointer key, gboolean -migrate_config (XfconfChannel *channel, - gint configver, - GError **error) +migrate_config (XfconfChannel *channel, + gint configver, + GError **error) { GHashTable *plugins; - guint n, n_panels; - gchar buf[50]; - gboolean horizontal; + guint n, n_panels; + gchar buf[50]; + gboolean horizontal; plugins = xfconf_channel_get_properties (channel, PLUGINS_PROPERTY_PREFIX); diff --git a/migrate/migrate-config.h b/migrate/migrate-config.h index 0bbc98de2..5026243fa 100644 --- a/migrate/migrate-config.h +++ b/migrate/migrate-config.h @@ -24,9 +24,10 @@ G_BEGIN_DECLS -gboolean migrate_config (XfconfChannel *channel, - gint configver, - GError **error); +gboolean +migrate_config (XfconfChannel *channel, + gint configver, + GError **error); G_END_DECLS diff --git a/migrate/migrate-default.c b/migrate/migrate-default.c index c9bba6d50..78894369a 100644 --- a/migrate/migrate-default.c +++ b/migrate/migrate-default.c @@ -33,10 +33,9 @@ typedef struct { XfconfChannel *channel; - GSList *path; - GPtrArray *array; -} -ConfigParser; + GSList *path; + GPtrArray *array; +} ConfigParser; @@ -64,7 +63,7 @@ migrate_default_gtype_from_string (const gchar *type) static void -migrate_default_set_value (GValue *value, +migrate_default_set_value (GValue *value, const gchar *string) { switch (G_VALUE_TYPE (value)) @@ -88,7 +87,6 @@ migrate_default_set_value (GValue *value, case G_TYPE_BOOLEAN: g_value_set_boolean (value, strcmp (string, "true") == 0); break; - } } @@ -97,7 +95,7 @@ migrate_default_set_value (GValue *value, static gchar * migrate_default_property_path (ConfigParser *parser) { - GSList *li; + GSList *li; GString *path; path = g_string_new (NULL); @@ -114,22 +112,22 @@ migrate_default_property_path (ConfigParser *parser) static void -migrate_default_start_element_handler (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error) +migrate_default_start_element_handler (GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + gpointer user_data, + GError **error) { ConfigParser *parser = user_data; - guint i; - const gchar *channel_name; - const gchar *prop_name, *prop_value, *prop_type; - GType type; - gchar *prop_path; - GValue value = G_VALUE_INIT; - const gchar *value_value, *value_type; - GValue *value2; + guint i; + const gchar *channel_name; + const gchar *prop_name, *prop_value, *prop_type; + GType type; + gchar *prop_path; + GValue value = G_VALUE_INIT; + const gchar *value_value, *value_type; + GValue *value2; if (strcmp (element_name, "channel") == 0) { @@ -285,25 +283,25 @@ migrate_default_start_element_handler (GMarkupParseContext *context, static void -migrate_default_end_element_handler (GMarkupParseContext *context, - const gchar *element_name, - gpointer user_data, - GError **error) +migrate_default_end_element_handler (GMarkupParseContext *context, + const gchar *element_name, + gpointer user_data, + GError **error) { ConfigParser *parser = user_data; - GSList *li; - gchar *prop_path; + GSList *li; + gchar *prop_path; if (strcmp (element_name, "channel") == 0) { if (G_LIKELY (parser->channel != NULL)) parser->channel = NULL; - if (parser->path != NULL) - { - g_set_error_literal (error, G_MARKUP_ERROR_UNKNOWN_ELEMENT, G_MARKUP_ERROR, - "Property path still contains items"); - } + if (parser->path != NULL) + { + g_set_error_literal (error, G_MARKUP_ERROR_UNKNOWN_ELEMENT, G_MARKUP_ERROR, + "Property path still contains items"); + } } else if (strcmp (element_name, "property") == 0) { @@ -326,7 +324,7 @@ migrate_default_end_element_handler (GMarkupParseContext *context, else { g_set_error_literal (error, G_MARKUP_ERROR_UNKNOWN_ELEMENT, G_MARKUP_ERROR, - "Element could no be popped from the path"); + "Element could no be popped from the path"); } } else if (strcmp (element_name, "value") == 0) @@ -342,8 +340,7 @@ migrate_default_end_element_handler (GMarkupParseContext *context, -static GMarkupParser markup_parser = -{ +static GMarkupParser markup_parser = { migrate_default_start_element_handler, migrate_default_end_element_handler, NULL, @@ -354,14 +351,14 @@ static GMarkupParser markup_parser = gboolean -migrate_default (const gchar *filename, - GError **error) +migrate_default (const gchar *filename, + GError **error) { - gsize length; - gchar *contents; + gsize length; + gchar *contents; GMarkupParseContext *context; - ConfigParser *parser; - gboolean succeed = FALSE; + ConfigParser *parser; + gboolean succeed = FALSE; g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); diff --git a/migrate/migrate-default.h b/migrate/migrate-default.h index f3d9fee88..14a20b707 100644 --- a/migrate/migrate-default.h +++ b/migrate/migrate-default.h @@ -23,7 +23,9 @@ G_BEGIN_DECLS -gboolean migrate_default (const gchar *filename, GError **error); +gboolean +migrate_default (const gchar *filename, + GError **error); G_END_DECLS diff --git a/panel/main.c b/panel/main.c index d502c7876..073a0f751 100644 --- a/panel/main.c +++ b/panel/main.c @@ -38,39 +38,39 @@ static PanelApplication *application = NULL; -static gint opt_preferences = -1; -static gint opt_add_items = -1; -static gboolean opt_save = FALSE; -static gchar *opt_add = NULL; -static gboolean opt_restart = FALSE; -static gboolean opt_quit = FALSE; -static gboolean opt_version = FALSE; -static gboolean opt_disable_wm_check = FALSE; -static gchar *opt_plugin_event = NULL; -static gchar **opt_arguments = NULL; -static guint opt_socket_id = 0; +static gint opt_preferences = -1; +static gint opt_add_items = -1; +static gboolean opt_save = FALSE; +static gchar *opt_add = NULL; +static gboolean opt_restart = FALSE; +static gboolean opt_quit = FALSE; +static gboolean opt_version = FALSE; +static gboolean opt_disable_wm_check = FALSE; +static gchar *opt_plugin_event = NULL; +static gchar **opt_arguments = NULL; +static guint opt_socket_id = 0; -static gboolean panel_callback_handler (const gchar *name, - const gchar *value, - gpointer user_data, - GError **error); +static gboolean +panel_callback_handler (const gchar *name, + const gchar *value, + gpointer user_data, + GError **error); /* command line options */ #define PANEL_CALLBACK_OPTION G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, panel_callback_handler -static GOptionEntry option_entries[] = -{ - { "preferences", 'p', PANEL_CALLBACK_OPTION, N_("Show the 'Panel Preferences' dialog"), N_("PANEL-NUMBER") }, - { "add-items", 'a', PANEL_CALLBACK_OPTION, N_("Show the 'Add New Items' dialog"), N_("PANEL-NUMBER") }, - { "save", 's', 0, G_OPTION_ARG_NONE, &opt_save, N_("Save the panel configuration"), NULL }, - { "add", '\0', 0, G_OPTION_ARG_STRING, &opt_add, N_("Add a new plugin to the panel"), N_("PLUGIN-NAME") }, - { "restart", 'r', 0, G_OPTION_ARG_NONE, &opt_restart, N_("Restart the running panel instance"), NULL }, - { "quit", 'q', 0, G_OPTION_ARG_NONE, &opt_quit, N_("Quit the running panel instance"), NULL }, - { "disable-wm-check", 'd', 0, G_OPTION_ARG_NONE, &opt_disable_wm_check, N_("Do not wait for a window manager on startup"), NULL }, - { "version", 'V', 0, G_OPTION_ARG_NONE, &opt_version, N_("Print version information and exit"), NULL }, +static GOptionEntry option_entries[] = { + { "preferences", 'p', PANEL_CALLBACK_OPTION, N_ ("Show the 'Panel Preferences' dialog"), N_ ("PANEL-NUMBER") }, + { "add-items", 'a', PANEL_CALLBACK_OPTION, N_ ("Show the 'Add New Items' dialog"), N_ ("PANEL-NUMBER") }, + { "save", 's', 0, G_OPTION_ARG_NONE, &opt_save, N_ ("Save the panel configuration"), NULL }, + { "add", '\0', 0, G_OPTION_ARG_STRING, &opt_add, N_ ("Add a new plugin to the panel"), N_ ("PLUGIN-NAME") }, + { "restart", 'r', 0, G_OPTION_ARG_NONE, &opt_restart, N_ ("Restart the running panel instance"), NULL }, + { "quit", 'q', 0, G_OPTION_ARG_NONE, &opt_quit, N_ ("Quit the running panel instance"), NULL }, + { "disable-wm-check", 'd', 0, G_OPTION_ARG_NONE, &opt_disable_wm_check, N_ ("Do not wait for a window manager on startup"), NULL }, + { "version", 'V', 0, G_OPTION_ARG_NONE, &opt_version, N_ ("Print version information and exit"), NULL }, { "plugin-event", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_plugin_event, NULL, NULL }, { "socket-id", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_INT, &opt_socket_id, NULL, NULL }, { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &opt_arguments, NULL, NULL }, @@ -80,10 +80,10 @@ static GOptionEntry option_entries[] = static gboolean -panel_callback_handler (const gchar *name, - const gchar *value, - gpointer user_data, - GError **error) +panel_callback_handler (const gchar *name, + const gchar *value, + gpointer user_data, + GError **error) { panel_return_val_if_fail (name != NULL, FALSE); @@ -148,7 +148,7 @@ panel_sm_client_quit (XfceSMClient *sm_client) static void panel_debug_notify_proxy (void) { - gchar *path; + gchar *path; const gchar *proxy_cmd; if (G_UNLIKELY (panel_debug_has_domain (PANEL_DEBUG_GDB))) @@ -188,8 +188,8 @@ panel_debug_notify_proxy (void) static void panel_dbus_name_lost (GDBusConnection *connection, - const gchar *name, - gpointer user_data) + const gchar *name, + gpointer user_data) { if (connection == NULL) g_critical ("Name %s lost on the message dbus, exiting.", name); @@ -201,29 +201,30 @@ panel_dbus_name_lost (GDBusConnection *connection, static void panel_dbus_name_acquired (GDBusConnection *connection, - const gchar *name, - gpointer user_data) + const gchar *name, + gpointer user_data) { application = panel_application_get (); - if (! panel_application_load (application, opt_disable_wm_check)) + if (!panel_application_load (application, opt_disable_wm_check)) gtk_main_quit (); } gint -main (gint argc, gchar **argv) +main (gint argc, + gchar **argv) { - GOptionContext *context; - GError *error = NULL; + GOptionContext *context; + GError *error = NULL; PanelDBusService *dbus_service; - gboolean succeed = FALSE; - gboolean remote_succeed; - guint i; - const gint signums[] = { SIGINT, SIGQUIT, SIGTERM, SIGABRT, SIGUSR1 }; - const gchar *error_msg; + gboolean succeed = FALSE; + gboolean remote_succeed; + guint i; + const gint signums[] = { SIGINT, SIGQUIT, SIGTERM, SIGABRT, SIGUSR1 }; + const gchar *error_msg; #ifdef ENABLE_X11 - XfceSMClient *sm_client = NULL; + XfceSMClient *sm_client = NULL; #endif panel_debug (PANEL_DEBUG_MAIN, @@ -331,7 +332,7 @@ main (gint argc, gchar **argv) goto dbus_return; } - launch_panel: +launch_panel: if (!xfconf_init (&error)) { @@ -438,13 +439,13 @@ dbus_return: /* normally start the panel */ if (opt_preferences >= 0 || opt_restart) { + const gchar *primary = _("No running instance of %s was found"); + const gchar *secondary = _("Do you want to start the panel? If you do, make sure " + "you save the session on logout, so the panel is " + "automatically started the next time you login."); g_clear_error (&error); - if (xfce_dialog_confirm (NULL, "system-run", _("Execute"), - _("Do you want to start the panel? If you do, make sure " - "you save the session on logout, so the panel is " - "automatically started the next time you login."), - _("No running instance of %s was found"), G_LOG_DOMAIN)) + if (xfce_dialog_confirm (NULL, "system-run", _("Execute"), secondary, primary, G_LOG_DOMAIN)) { panel_debug (PANEL_DEBUG_MAIN, "user confirmed to start the panel"); goto launch_panel; diff --git a/panel/panel-application.c b/panel/panel-application.c index b5297c342..e2e576e7f 100644 --- a/panel/panel-application.c +++ b/panel/panel-application.c @@ -57,42 +57,51 @@ -static void panel_application_dispose (GObject *object); -static void panel_application_finalize (GObject *object); -static void panel_application_plugin_move (GtkWidget *item, - PanelApplication *application); -static gboolean panel_application_plugin_insert (PanelApplication *application, - PanelWindow *window, - const gchar *name, - gint unique_id, - gchar **arguments, - gint position); -static void panel_application_dialog_destroyed (GtkWindow *dialog, - PanelApplication *application); -static void panel_application_drag_data_received (PanelWindow *window, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection_data, - guint info, - guint drag_time, - GtkWidget *itembar); -static gboolean panel_application_drag_motion (GtkWidget *window, - GdkDragContext *context, - gint x, - gint y, - guint drag_time, - PanelApplication *application); -static gboolean panel_application_drag_drop (GtkWidget *window, - GdkDragContext *context, - gint x, - gint y, - guint drag_time, - PanelApplication *application); -static void panel_application_drag_leave (GtkWidget *window, - GdkDragContext *context, - guint drag_time, - PanelApplication *application); +static void +panel_application_dispose (GObject *object); +static void +panel_application_finalize (GObject *object); +static void +panel_application_plugin_move (GtkWidget *item, + PanelApplication *application); +static gboolean +panel_application_plugin_insert (PanelApplication *application, + PanelWindow *window, + const gchar *name, + gint unique_id, + gchar **arguments, + gint position); +static void +panel_application_dialog_destroyed (GtkWindow *dialog, + PanelApplication *application); +static void +panel_application_drag_data_received (PanelWindow *window, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *selection_data, + guint info, + guint drag_time, + GtkWidget *itembar); +static gboolean +panel_application_drag_motion (GtkWidget *window, + GdkDragContext *context, + gint x, + gint y, + guint drag_time, + PanelApplication *application); +static gboolean +panel_application_drag_drop (GtkWidget *window, + GdkDragContext *context, + gint x, + gint y, + guint drag_time, + PanelApplication *application); +static void +panel_application_drag_leave (GtkWidget *window, + GdkDragContext *context, + guint drag_time, + PanelApplication *application); @@ -104,32 +113,32 @@ enum struct _PanelApplication { - GObject __parent__; + GObject __parent__; /* the plugin factory */ PanelModuleFactory *factory; /* xfconf channel */ - XfconfChannel *xfconf; + XfconfChannel *xfconf; /* internal list of all the panel windows */ - GSList *windows; + GSList *windows; /* internal list of opened dialogs */ - GSList *dialogs; + GSList *dialogs; /* autohide count at application level */ - gint autohide_block; + gint autohide_block; #ifdef ENABLE_X11 - guint wait_for_wm_timeout_id; + guint wait_for_wm_timeout_id; #endif /* drag and drop data */ - guint drop_data_ready : 1; - guint drop_occurred : 1; - guint drop_desktop_files : 1; - guint drop_index; + guint drop_data_ready : 1; + guint drop_occurred : 1; + guint drop_desktop_files : 1; + guint drop_index; }; #ifdef ENABLE_X11 @@ -137,13 +146,12 @@ typedef struct { PanelApplication *application; - Display *dpy; - Atom *atoms; - guint atom_count; - guint have_wm : 1; - guint counter; -} -WaitForWM; + Display *dpy; + Atom *atoms; + guint atom_count; + guint have_wm : 1; + guint counter; +} WaitForWM; #endif enum @@ -153,14 +161,12 @@ enum TARGET_TEXT_URI_LIST }; -static const GtkTargetEntry drag_targets[] = -{ +static const GtkTargetEntry drag_targets[] = { { "xfce-panel/plugin-widget", GTK_TARGET_SAME_APP, TARGET_PLUGIN_WIDGET } }; -static const GtkTargetEntry drop_targets[] = -{ +static const GtkTargetEntry drop_targets[] = { { "xfce-panel/plugin-name", GTK_TARGET_SAME_APP, TARGET_PLUGIN_NAME }, { "xfce-panel/plugin-widget", @@ -226,13 +232,13 @@ panel_application_init (PanelApplication *application) /* warn the user about restricted features on Wayland */ if (WINDOWING_IS_WAYLAND ()) { - if (! gtk_layer_is_supported ()) + if (!gtk_layer_is_supported ()) g_warning ("Wayland detected without layer-shell support (either because of your" " compositor or because Xfce4-panel was built without this support):" " Xfce4-panel might not look like a panel and many of its features will" " not be available"); - if (! gdk_wayland_display_query_registry (gdk_display_get_default (), - "zwlr_foreign_toplevel_manager_v1")) + if (!gdk_wayland_display_query_registry (gdk_display_get_default (), + "zwlr_foreign_toplevel_manager_v1")) g_warning ("Wayland detected without foreign-toplevel-management support (your" " compositor does not seem to support it): Some Xfce4-panel features will" " not work (e.g. intellihide), as well as some plugins (e.g. ShowDesktop," @@ -285,12 +291,11 @@ panel_application_finalize (GObject *object) static void panel_application_xfconf_window_bindings (PanelApplication *application, - PanelWindow *window, - gboolean save_properties) + PanelWindow *window, + gboolean save_properties) { - gchar *property_base; - const PanelProperty properties[] = - { + gchar *property_base; + const PanelProperty properties[] = { { "position-locked", G_TYPE_BOOLEAN }, { "autohide-behavior", G_TYPE_UINT }, { "popdown-speed", G_TYPE_UINT }, @@ -312,19 +317,16 @@ panel_application_xfconf_window_bindings (PanelApplication *application, { "enable-struts", G_TYPE_BOOLEAN }, { NULL } }; - const PanelProperty global_properties[] = - { + const PanelProperty global_properties[] = { { "dark-mode", G_TYPE_BOOLEAN }, { NULL } }; - const PanelProperty old_properties[] = - { + const PanelProperty old_properties[] = { { "autohide", G_TYPE_BOOLEAN }, { "disable-struts", G_TYPE_BOOLEAN }, { NULL } }; - const PanelProperty new_properties[] = - { + const PanelProperty new_properties[] = { { "autohide-behavior", G_TYPE_UINT }, { "enable-struts", G_TYPE_BOOLEAN }, { NULL } @@ -345,8 +347,7 @@ panel_application_xfconf_window_bindings (PanelApplication *application, PANELS_PROPERTY_PREFIX, global_properties, save_properties); /* set locking for this panel */ - panel_window_set_locked (window, - xfconf_channel_is_property_locked (application->xfconf, property_base)); + panel_window_set_locked (window, xfconf_channel_is_property_locked (application->xfconf, property_base)); g_free (property_base); } @@ -372,9 +373,8 @@ panel_application_remove_plugin_dialog (GtkWindow *parent, "otherwise you'd better quit and make a backup of the current configuration using %s, before " "checking your installation and trying to start xfce4-panel again."), "<a href=\"https://gitlab.xfce.org/apps/xfce4-panel-profiles\">xfce4-panel-profiles</a>"); - gtk_dialog_add_buttons (GTK_DIALOG (dialog), - _("_Remove"), GTK_RESPONSE_OK, - _("_Quit"), GTK_RESPONSE_CANCEL, NULL); + gtk_dialog_add_buttons ( + GTK_DIALOG (dialog), _("_Remove"), GTK_RESPONSE_OK, _("_Quit"), GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); @@ -389,21 +389,21 @@ panel_application_remove_plugin_dialog (GtkWindow *parent, static void panel_application_load_real (PanelApplication *application) { - PanelWindow *window; - guint i, j, n_panels; - gchar buf[50]; - gchar *name; - gint unique_id; - GdkScreen *screen; - GPtrArray *array; + PanelWindow *window; + guint i, j, n_panels; + gchar buf[50]; + gchar *name; + gint unique_id; + GdkScreen *screen; + GPtrArray *array; const GValue *value; - gchar *output_name; - gint screen_num; - GdkDisplay *display; - GValue val = G_VALUE_INIT; - GPtrArray *panels; - gint panel_id; - gboolean save_changed_ids = FALSE; + gchar *output_name; + gint screen_num; + GdkDisplay *display; + GValue val = G_VALUE_INIT; + GPtrArray *panels; + gint panel_id; + gboolean save_changed_ids = FALSE; panel_return_if_fail (PANEL_IS_APPLICATION (application)); panel_return_if_fail (XFCONF_IS_CHANNEL (application->xfconf)); @@ -521,8 +521,8 @@ static gboolean panel_application_wait_for_window_manager (gpointer data) { WaitForWM *wfwm = data; - guint i; - gboolean have_wm = TRUE; + guint i; + gboolean have_wm = TRUE; for (i = 0; i < wfwm->atom_count; i++) { @@ -546,7 +546,7 @@ panel_application_wait_for_window_manager (gpointer data) static void panel_application_wait_for_window_manager_destroyed (gpointer data) { - WaitForWM *wfwm = data; + WaitForWM *wfwm = data; PanelApplication *application = wfwm->application; application->wait_for_wm_timeout_id = 0; @@ -554,7 +554,7 @@ panel_application_wait_for_window_manager_destroyed (gpointer data) if (!wfwm->have_wm) { g_printerr (G_LOG_DOMAIN ": No window manager registered on screen 0. " - "To start the panel without this check, run with --disable-wm-check.\n"); + "To start the panel without this check, run with --disable-wm-check.\n"); } else { @@ -575,11 +575,11 @@ panel_application_wait_for_window_manager_destroyed (gpointer data) static void -panel_application_plugin_move_drag_data_get (GtkWidget *item, - GdkDragContext *drag_context, +panel_application_plugin_move_drag_data_get (GtkWidget *item, + GdkDragContext *drag_context, GtkSelectionData *selection_data, - guint info, - guint drag_time, + guint info, + guint drag_time, PanelApplication *application) { /* set some data, we never use this, but GTK_DEST_DEFAULT_ALL @@ -592,18 +592,16 @@ panel_application_plugin_move_drag_data_get (GtkWidget *item, static void -panel_application_plugin_move_drag_end (GtkWidget *item, - GdkDragContext *context, +panel_application_plugin_move_drag_end (GtkWidget *item, + GdkDragContext *context, PanelApplication *application) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (item)); panel_return_if_fail (PANEL_IS_APPLICATION (application)); /* disconnect this signal */ - g_signal_handlers_disconnect_by_func (G_OBJECT (item), - G_CALLBACK (panel_application_plugin_move_drag_end), application); - g_signal_handlers_disconnect_by_func (G_OBJECT (item), - G_CALLBACK (panel_application_plugin_move_drag_data_get), application); + g_signal_handlers_disconnect_by_func (item, panel_application_plugin_move_drag_end, application); + g_signal_handlers_disconnect_by_func (item, panel_application_plugin_move_drag_data_get, application); /* unblock autohide */ panel_application_windows_blocked (application, FALSE); @@ -612,14 +610,14 @@ panel_application_plugin_move_drag_end (GtkWidget *item, static void -panel_application_plugin_move (GtkWidget *item, +panel_application_plugin_move (GtkWidget *item, PanelApplication *application) { - GtkTargetList *target_list; - const gchar *icon_name; + GtkTargetList *target_list; + const gchar *icon_name; GdkDragContext *context; - PanelModule *module; - GtkIconTheme *theme; + PanelModule *module; + GtkIconTheme *theme; panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (item)); panel_return_if_fail (PANEL_IS_APPLICATION (application)); @@ -645,17 +643,17 @@ panel_application_plugin_move (GtkWidget *item, /* signal to make the window sensitive again on a drag end */ g_signal_connect (G_OBJECT (item), "drag-end", - G_CALLBACK (panel_application_plugin_move_drag_end), application); + G_CALLBACK (panel_application_plugin_move_drag_end), application); g_signal_connect (G_OBJECT (item), "drag-data-get", - G_CALLBACK (panel_application_plugin_move_drag_data_get), application); + G_CALLBACK (panel_application_plugin_move_drag_data_get), application); } static void panel_application_plugin_delete_config (PanelApplication *application, - const gchar *name, - gint unique_id) + const gchar *name, + gint unique_id) { gchar *property; gchar *filename, *path; @@ -685,7 +683,7 @@ panel_application_plugin_delete_config (PanelApplication *application, static void panel_application_plugin_remove (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget)); @@ -697,14 +695,14 @@ panel_application_plugin_remove (GtkWidget *widget, static void -panel_application_plugin_provider_signal (XfcePanelPluginProvider *provider, - XfcePanelPluginProviderSignal provider_signal, - PanelApplication *application) +panel_application_plugin_provider_signal (XfcePanelPluginProvider *provider, + XfcePanelPluginProviderSignal provider_signal, + PanelApplication *application) { - GtkWidget *itembar; + GtkWidget *itembar; PanelWindow *window; - gint unique_id; - gchar *name; + gint unique_id; + gchar *name; panel_return_if_fail (PANEL_IS_APPLICATION (application)); panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider)); @@ -827,9 +825,9 @@ panel_application_plugin_provider_signal (XfcePanelPluginProvider *provide break; case PROVIDER_SIGNAL_FOCUS_PLUGIN: - /* focus the panel window (as part of focusing a widget within the plugin) */ - panel_window_focus (window); - break; + /* focus the panel window (as part of focusing a widget within the plugin) */ + panel_window_focus (window); + break; case PROVIDER_SIGNAL_SHOW_CONFIGURE: case PROVIDER_SIGNAL_SHOW_ABOUT: @@ -845,15 +843,15 @@ panel_application_plugin_provider_signal (XfcePanelPluginProvider *provide static gboolean -panel_application_plugin_insert (PanelApplication *application, - PanelWindow *window, - const gchar *name, - gint unique_id, - gchar **arguments, - gint position) +panel_application_plugin_insert (PanelApplication *application, + PanelWindow *window, + const gchar *name, + gint unique_id, + gchar **arguments, + gint position) { GtkWidget *itembar, *provider; - gint new_unique_id; + gint new_unique_id; panel_return_val_if_fail (PANEL_IS_APPLICATION (application), FALSE); panel_return_val_if_fail (PANEL_IS_WINDOW (window), FALSE); @@ -873,7 +871,7 @@ panel_application_plugin_insert (PanelApplication *application, /* add signal to monitor provider signals */ g_signal_connect (G_OBJECT (provider), "provider-signal", - G_CALLBACK (panel_application_plugin_provider_signal), application); + G_CALLBACK (panel_application_plugin_provider_signal), application); /* add the item to the panel */ itembar = gtk_bin_get_child (GTK_BIN (window)); @@ -892,7 +890,7 @@ panel_application_plugin_insert (PanelApplication *application, static void -panel_application_dialog_destroyed (GtkWindow *dialog, +panel_application_dialog_destroyed (GtkWindow *dialog, PanelApplication *application) { panel_return_if_fail (GTK_IS_WINDOW (dialog)); @@ -910,29 +908,29 @@ panel_application_dialog_destroyed (GtkWindow *dialog, static void -panel_application_drag_data_received (PanelWindow *window, - GdkDragContext *context, - gint x, - gint y, +panel_application_drag_data_received (PanelWindow *window, + GdkDragContext *context, + gint x, + gint y, GtkSelectionData *selection_data, - guint info, - guint drag_time, - GtkWidget *itembar) + guint info, + guint drag_time, + GtkWidget *itembar) { - PanelApplication *application; - GtkWidget *provider; - gboolean succeed = FALSE; - gboolean save_application = FALSE; - const gchar *name; - guint old_position; - gchar **uris; - guint i; - gboolean found; - gint n_items; - gboolean child_small; - gboolean child_expand; - gboolean child_shrink; - GtkWidget *parent_itembar; + PanelApplication *application; + GtkWidget *provider; + gboolean succeed = FALSE; + gboolean save_application = FALSE; + const gchar *name; + guint old_position; + gchar **uris; + guint i; + gboolean found; + gint n_items; + gboolean child_small; + gboolean child_expand; + gboolean child_shrink; + GtkWidget *parent_itembar; panel_return_if_fail (PANEL_IS_WINDOW (window)); panel_return_if_fail (GDK_IS_DRAG_CONTEXT (context)); @@ -1048,10 +1046,10 @@ panel_application_drag_data_received (PanelWindow *window, uris = gtk_selection_data_get_uris (selection_data); if (G_LIKELY (uris != NULL)) { + const gchar *text = _("This will create a new launcher plugin on the panel and inserts " + "the dropped files as menu items."); n_items = g_strv_length (uris); - if (xfce_dialog_confirm (NULL, "list-add", _("Create _Launcher"), - _("This will create a new launcher plugin on the panel and inserts " - "the dropped files as menu items."), + if (xfce_dialog_confirm (NULL, "list-add", _("Create _Launcher"), text, ngettext ("Create new launcher from %d desktop file", "Create new launcher from %d desktop files", n_items), @@ -1085,7 +1083,7 @@ panel_application_drag_data_received (PanelWindow *window, } else { - invalid_drag: +invalid_drag: gdk_drag_status (context, 0, drag_time); } @@ -1095,16 +1093,16 @@ panel_application_drag_data_received (PanelWindow *window, static gboolean -panel_application_drag_motion (GtkWidget *window, - GdkDragContext *context, - gint x, - gint y, - guint drag_time, +panel_application_drag_motion (GtkWidget *window, + GdkDragContext *context, + gint x, + gint y, + guint drag_time, PanelApplication *application) { - GdkAtom target; - GtkWidget *itembar; - GdkDragAction drag_action = 0; + GdkAtom target; + GtkWidget *itembar; + GdkDragAction drag_action = 0; panel_return_val_if_fail (PANEL_IS_WINDOW (window), FALSE); panel_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), FALSE); @@ -1163,11 +1161,11 @@ not_a_drop_zone: static gboolean -panel_application_drag_drop (GtkWidget *window, - GdkDragContext *context, - gint x, - gint y, - guint drag_time, +panel_application_drag_drop (GtkWidget *window, + GdkDragContext *context, + gint x, + gint y, + guint drag_time, PanelApplication *application) { GdkAtom target; @@ -1196,9 +1194,9 @@ panel_application_drag_drop (GtkWidget *window, static void -panel_application_drag_leave (GtkWidget *window, - GdkDragContext *context, - guint drag_time, +panel_application_drag_leave (GtkWidget *window, + GdkDragContext *context, + guint drag_time, PanelApplication *application) { GtkWidget *itembar; @@ -1221,7 +1219,7 @@ panel_application_drag_leave (GtkWidget *window, static gboolean panel_application_window_id_exists (PanelApplication *application, - gint id) + gint id) { GSList *li; @@ -1255,14 +1253,14 @@ panel_application_get (void) gboolean -panel_application_load (PanelApplication *application, - gboolean disable_wm_check) +panel_application_load (PanelApplication *application, + gboolean disable_wm_check) { #ifdef ENABLE_X11 - Display *display; - WaitForWM *wfwm; - guint i; - gchar **atom_names; + Display *display; + WaitForWM *wfwm; + guint i; + gchar **atom_names; if (!disable_wm_check && WINDOWING_IS_X11 ()) { @@ -1295,8 +1293,8 @@ panel_application_load (PanelApplication *application, g_strfreev (atom_names); /* setup timeout to check for a window manager */ - application->wait_for_wm_timeout_id = - gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, 50, panel_application_wait_for_window_manager, + application->wait_for_wm_timeout_id + = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, 50, panel_application_wait_for_window_manager, wfwm, panel_application_wait_for_window_manager_destroyed); } else @@ -1316,13 +1314,13 @@ panel_application_load (PanelApplication *application, void panel_application_save (PanelApplication *application, - PanelSaveTypes save_types) + PanelSaveTypes save_types) { - GSList *li; + GSList *li; XfconfChannel *channel = application->xfconf; - GValue *value; - GPtrArray *panels = NULL; - gint panel_id; + GValue *value; + GPtrArray *panels = NULL; + gint panel_id; panel_return_if_fail (PANEL_IS_APPLICATION (application)); panel_return_if_fail (XFCONF_IS_CHANNEL (channel)); @@ -1363,18 +1361,18 @@ panel_application_save (PanelApplication *application, void panel_application_save_window (PanelApplication *application, - PanelWindow *window, - PanelSaveTypes save_types) + PanelWindow *window, + PanelSaveTypes save_types) { - GList *children, *lp; - GtkWidget *itembar; + GList *children, *lp; + GtkWidget *itembar; XfcePanelPluginProvider *provider; - gchar buf[50]; - XfconfChannel *channel = application->xfconf; - GPtrArray *array = NULL; - GValue *value; - gint plugin_id; - gint panel_id; + gchar buf[50]; + XfconfChannel *channel = application->xfconf; + GPtrArray *array = NULL; + GValue *value; + gint plugin_id; + gint panel_id; panel_return_if_fail (PANEL_IS_APPLICATION (application)); panel_return_if_fail (PANEL_IS_WINDOW (window)); @@ -1449,7 +1447,7 @@ panel_application_save_window (PanelApplication *application, void panel_application_take_dialog (PanelApplication *application, - GtkWindow *dialog) + GtkWindow *dialog) { panel_return_if_fail (PANEL_IS_APPLICATION (application)); panel_return_if_fail (GTK_IS_WINDOW (dialog)); @@ -1460,7 +1458,7 @@ panel_application_take_dialog (PanelApplication *application, /* monitor window destruction */ g_signal_connect (G_OBJECT (dialog), "destroy", - G_CALLBACK (panel_application_dialog_destroyed), application); + G_CALLBACK (panel_application_dialog_destroyed), application); application->dialogs = g_slist_prepend (application->dialogs, dialog); } @@ -1486,10 +1484,10 @@ panel_application_destroy_dialogs (PanelApplication *application) void -panel_application_add_new_item (PanelApplication *application, - PanelWindow *window, - const gchar *plugin_name, - gchar **arguments) +panel_application_add_new_item (PanelApplication *application, + PanelWindow *window, + const gchar *plugin_name, + gchar **arguments) { gint panel_id; @@ -1543,8 +1541,7 @@ panel_application_add_new_item (PanelApplication *application, } else { - g_warning ("The plugin \"%s\" you want to add is not " - "known by the panel", plugin_name); + g_warning ("The plugin \"%s\" you want to add is not known by the panel", plugin_name); } } @@ -1552,19 +1549,19 @@ panel_application_add_new_item (PanelApplication *application, PanelWindow * panel_application_new_window (PanelApplication *application, - GdkScreen *screen, - gint panel_id, - gboolean new_window) + GdkScreen *screen, + gint panel_id, + gboolean new_window) { - GtkWidget *window; - GtkWidget *itembar; - gchar *property; - gint idx; + GtkWidget *window; + GtkWidget *itembar; + gchar *property; + gint idx; static const gchar *props[] = { "mode", "size", "nrows", "icon-size", "dark-mode", "border-width" }; - guint i; - gchar *position; - static gint unqiue_id_counter = 1; - GtkWindowGroup *window_group; + guint i; + gchar *position; + static gint unqiue_id_counter = 1; + GtkWindowGroup *window_group; panel_return_val_if_fail (PANEL_IS_APPLICATION (application), NULL); panel_return_val_if_fail (screen == NULL || GDK_IS_SCREEN (screen), NULL); @@ -1648,11 +1645,11 @@ panel_application_new_window (PanelApplication *application, void panel_application_remove_window (PanelApplication *application, - PanelWindow *window) + PanelWindow *window) { - gchar *property; + gchar *property; GtkWidget *itembar; - gint panel_id; + gint panel_id; panel_return_if_fail (PANEL_IS_WINDOW (window)); panel_return_if_fail (PANEL_IS_APPLICATION (application)); @@ -1676,8 +1673,7 @@ panel_application_remove_window (PanelApplication *application, /* set all the plugins on this panel the remove signal */ itembar = gtk_bin_get_child (GTK_BIN (window)); - gtk_container_foreach (GTK_CONTAINER (itembar), - panel_application_plugin_remove, NULL); + gtk_container_foreach (GTK_CONTAINER (itembar), panel_application_plugin_remove, NULL); /* destroy */ gtk_widget_destroy (GTK_WIDGET (window)); @@ -1708,8 +1704,8 @@ panel_application_get_windows (PanelApplication *application) PanelWindow * -panel_application_get_window (PanelApplication *application, - gint panel_id) +panel_application_get_window (PanelApplication *application, + gint panel_id) { GSList *li; @@ -1726,7 +1722,7 @@ panel_application_get_window (PanelApplication *application, void panel_application_window_select (PanelApplication *application, - PanelWindow *window) + PanelWindow *window) { GSList *li; @@ -1741,7 +1737,7 @@ panel_application_window_select (PanelApplication *application, void panel_application_windows_blocked (PanelApplication *application, - gboolean blocked) + gboolean blocked) { void (*autohide_func) (PanelWindow *); @@ -1817,8 +1813,8 @@ panel_application_logout (void) if (WINDOWING_IS_X11 ()) text = _("You have started X without session manager. Clicking Quit will close the X server."); - if (xfce_dialog_confirm (NULL, "application-exit", _("Quit"), text, - _("Are you sure you want to quit the panel?"))) + if (xfce_dialog_confirm (NULL, "application-exit", + _("Quit"), text, _("Are you sure you want to quit the panel?"))) command = "xfce4-panel --quit"; else return; diff --git a/panel/panel-application.h b/panel/panel-application.h index 7d837ec0f..78a07da10 100644 --- a/panel/panel-application.h +++ b/panel/panel-application.h @@ -31,57 +31,71 @@ G_DECLARE_FINAL_TYPE (PanelApplication, panel_application, PANEL, APPLICATION, G typedef enum { SAVE_PLUGIN_PROVIDERS = 1 << 1, - SAVE_PLUGIN_IDS = 1 << 2, - SAVE_PANEL_IDS = 1 << 3, -} -PanelSaveTypes; + SAVE_PLUGIN_IDS = 1 << 2, + SAVE_PANEL_IDS = 1 << 3, +} PanelSaveTypes; #define SAVE_EVERYTHING (SAVE_PLUGIN_PROVIDERS | SAVE_PLUGIN_IDS | SAVE_PANEL_IDS) -PanelApplication *panel_application_get (void); +PanelApplication * +panel_application_get (void); -gboolean panel_application_load (PanelApplication *application, - gboolean disable_wm_check); +gboolean +panel_application_load (PanelApplication *application, + gboolean disable_wm_check); -void panel_application_save (PanelApplication *application, - PanelSaveTypes save_types); +void +panel_application_save (PanelApplication *application, + PanelSaveTypes save_types); -void panel_application_save_window (PanelApplication *application, - PanelWindow *window, - PanelSaveTypes save_types); +void +panel_application_save_window (PanelApplication *application, + PanelWindow *window, + PanelSaveTypes save_types); -void panel_application_take_dialog (PanelApplication *application, - GtkWindow *dialog); +void +panel_application_take_dialog (PanelApplication *application, + GtkWindow *dialog); -void panel_application_destroy_dialogs (PanelApplication *application); +void +panel_application_destroy_dialogs (PanelApplication *application); -void panel_application_add_new_item (PanelApplication *application, - PanelWindow *window, - const gchar *plugin_name, - gchar **arguments); +void +panel_application_add_new_item (PanelApplication *application, + PanelWindow *window, + const gchar *plugin_name, + gchar **arguments); -PanelWindow *panel_application_new_window (PanelApplication *application, - GdkScreen *screen, - gint id, - gboolean new_window); +PanelWindow * +panel_application_new_window (PanelApplication *application, + GdkScreen *screen, + gint id, + gboolean new_window); -void panel_application_remove_window (PanelApplication *application, - PanelWindow *window); +void +panel_application_remove_window (PanelApplication *application, + PanelWindow *window); -GSList *panel_application_get_windows (PanelApplication *application); +GSList * +panel_application_get_windows (PanelApplication *application); -PanelWindow *panel_application_get_window (PanelApplication *application, - gint panel_id); +PanelWindow * +panel_application_get_window (PanelApplication *application, + gint panel_id); -void panel_application_window_select (PanelApplication *application, - PanelWindow *window); +void +panel_application_window_select (PanelApplication *application, + PanelWindow *window); -void panel_application_windows_blocked (PanelApplication *application, - gboolean blocked); +void +panel_application_windows_blocked (PanelApplication *application, + gboolean blocked); -gboolean panel_application_get_locked (PanelApplication *application); +gboolean +panel_application_get_locked (PanelApplication *application); -void panel_application_logout (void); +void +panel_application_logout (void); G_END_DECLS diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c index 655b49ff2..5e0f3a688 100644 --- a/panel/panel-base-window.c +++ b/panel/panel-base-window.c @@ -37,50 +37,66 @@ -#define PANEL_BASE_CSS ".xfce4-panel.background { border-style: solid; }"\ - ".xfce4-panel.background button { background: transparent; padding: 0; }"\ - ".xfce4-panel.background.marching-ants-dashed { border: 1px dashed #ff0000; }"\ - ".xfce4-panel.background.marching-ants-dotted { border: 1px dotted #ff0000; }" -#define MARCHING_ANTS_DASHED "marching-ants-dashed" -#define MARCHING_ANTS_DOTTED "marching-ants-dotted" - - - -#define get_instance_private(instance) ((PanelBaseWindowPrivate *) \ - panel_base_window_get_instance_private (PANEL_BASE_WINDOW (instance))) - -static void panel_base_window_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void panel_base_window_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void panel_base_window_finalize (GObject *object); -static void panel_base_window_screen_changed (GtkWidget *widget, - GdkScreen *previous_screen); -static void panel_base_window_composited_changed (GdkScreen *screen, - GtkWidget *widget); -static gboolean panel_base_window_active_timeout (gpointer user_data); -static void panel_base_window_active_timeout_destroyed (gpointer user_data); -static void panel_base_window_set_background_color_css (PanelBaseWindow *window); -static void panel_base_window_set_background_image_css (PanelBaseWindow *window); -static void panel_base_window_set_background_css (PanelBaseWindow *window, - const gchar *css_string); -static void panel_base_window_set_plugin_data (PanelBaseWindow *window, - GtkCallback func); -static void panel_base_window_set_plugin_opacity (GtkWidget *widget, - gpointer user_data, - gdouble opacity); -static void panel_base_window_set_plugin_enter_opacity (GtkWidget *widget, - gpointer user_data); -static void panel_base_window_set_plugin_leave_opacity (GtkWidget *widget, - gpointer user_data); -static void panel_base_window_set_plugin_background_color (GtkWidget *widget, - gpointer user_data); -static void panel_base_window_set_plugin_background_image (GtkWidget *widget, - gpointer user_data); +#define PANEL_BASE_CSS ".xfce4-panel.background { border-style: solid; }" \ + ".xfce4-panel.background button { background: transparent; padding: 0; }" \ + ".xfce4-panel.background.marching-ants-dashed { border: 1px dashed #ff0000; }" \ + ".xfce4-panel.background.marching-ants-dotted { border: 1px dotted #ff0000; }" +#define MARCHING_ANTS_DASHED "marching-ants-dashed" +#define MARCHING_ANTS_DOTTED "marching-ants-dotted" + + + +#define get_instance_private(instance) \ + ((PanelBaseWindowPrivate *) panel_base_window_get_instance_private (PANEL_BASE_WINDOW (instance))) + +static void +panel_base_window_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +panel_base_window_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +panel_base_window_finalize (GObject *object); +static void +panel_base_window_screen_changed (GtkWidget *widget, + GdkScreen *previous_screen); +static void +panel_base_window_composited_changed (GdkScreen *screen, + GtkWidget *widget); +static gboolean +panel_base_window_active_timeout (gpointer user_data); +static void +panel_base_window_active_timeout_destroyed (gpointer user_data); +static void +panel_base_window_set_background_color_css (PanelBaseWindow *window); +static void +panel_base_window_set_background_image_css (PanelBaseWindow *window); +static void +panel_base_window_set_background_css (PanelBaseWindow *window, + const gchar *css_string); +static void +panel_base_window_set_plugin_data (PanelBaseWindow *window, + GtkCallback func); +static void +panel_base_window_set_plugin_opacity (GtkWidget *widget, + gpointer user_data, + gdouble opacity); +static void +panel_base_window_set_plugin_enter_opacity (GtkWidget *widget, + gpointer user_data); +static void +panel_base_window_set_plugin_leave_opacity (GtkWidget *widget, + gpointer user_data); +static void +panel_base_window_set_plugin_background_color (GtkWidget *widget, + gpointer user_data); +static void +panel_base_window_set_plugin_background_image (GtkWidget *widget, + gpointer user_data); @@ -99,22 +115,22 @@ enum typedef struct _PanelBaseWindowPrivate { - PanelBorders borders; + PanelBorders borders; /* transparency settings */ - guint is_composited : 1; - gdouble enter_opacity; - gdouble leave_opacity; - gboolean opacity_is_enter; + guint is_composited : 1; + gdouble enter_opacity; + gdouble leave_opacity; + gboolean opacity_is_enter; /* background css style provider */ - GtkCssProvider *css_provider; - PanelBgStyle background_style; - GdkRGBA *background_rgba; - gchar *background_image; + GtkCssProvider *css_provider; + PanelBgStyle background_style; + GdkRGBA *background_rgba; + gchar *background_image; /* active window timeout id */ - guint active_timeout_id; + guint active_timeout_id; } PanelBaseWindowPrivate; @@ -126,7 +142,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (PanelBaseWindow, panel_base_window, GTK_TYPE_WINDOW) static void panel_base_window_class_init (PanelBaseWindowClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; GtkWidgetClass *gtkwidget_class; gobject_class = G_OBJECT_CLASS (klass); @@ -249,15 +265,15 @@ panel_base_window_init (PanelBaseWindow *window) static void -panel_base_window_get_property (GObject *object, - guint prop_id, - GValue *value, +panel_base_window_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { - PanelBaseWindow *window = PANEL_BASE_WINDOW (object); - PanelBaseWindowPrivate *priv = get_instance_private (window); - GdkRGBA *rgba; - GtkStyleContext *ctx; + PanelBaseWindow *window = PANEL_BASE_WINDOW (object); + PanelBaseWindowPrivate *priv = get_instance_private (window); + GdkRGBA *rgba; + GtkStyleContext *ctx; switch (prop_id) { @@ -312,17 +328,17 @@ panel_base_window_get_property (GObject *object, static void -panel_base_window_set_property (GObject *object, - guint prop_id, +panel_base_window_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { - PanelBaseWindow *window = PANEL_BASE_WINDOW (object); + PanelBaseWindow *window = PANEL_BASE_WINDOW (object); PanelBaseWindowPrivate *priv = get_instance_private (window); - PanelBgStyle bg_style; - GFile *file; - gdouble opacity; - const gchar *str; + PanelBgStyle bg_style; + GFile *file; + gdouble opacity; + const gchar *str; switch (prop_id) { @@ -344,7 +360,7 @@ panel_base_window_set_property (GObject *object, if (opacity != priv->leave_opacity) { priv->leave_opacity = opacity; - if (priv->is_composited && ! priv->opacity_is_enter) + if (priv->is_composited && !priv->opacity_is_enter) { gtk_widget_set_opacity (GTK_WIDGET (window), priv->leave_opacity); panel_base_window_set_plugin_data (window, panel_base_window_set_plugin_leave_opacity); @@ -363,21 +379,18 @@ panel_base_window_set_property (GObject *object, && priv->background_image != NULL) { panel_base_window_set_background_image_css (window); - panel_base_window_set_plugin_data (window, - panel_base_window_set_plugin_background_image); + panel_base_window_set_plugin_data (window, panel_base_window_set_plugin_background_image); } else if (priv->background_style == PANEL_BG_STYLE_NONE) { panel_base_window_reset_background_css (window); - panel_base_window_set_plugin_data (window, - panel_base_window_set_plugin_background_color); + panel_base_window_set_plugin_data (window, panel_base_window_set_plugin_background_color); } else if (priv->background_style == PANEL_BG_STYLE_COLOR && priv->background_rgba != NULL) { panel_base_window_set_background_color_css (window); - panel_base_window_set_plugin_data (window, - panel_base_window_set_plugin_background_color); + panel_base_window_set_plugin_data (window, panel_base_window_set_plugin_background_color); } /* resize to update border size too */ @@ -393,8 +406,7 @@ panel_base_window_set_property (GObject *object, if (priv->background_style == PANEL_BG_STYLE_COLOR) { panel_base_window_set_background_color_css (window); - panel_base_window_set_plugin_data (window, - panel_base_window_set_plugin_background_color); + panel_base_window_set_plugin_data (window, panel_base_window_set_plugin_background_color); } break; @@ -414,8 +426,7 @@ panel_base_window_set_property (GObject *object, if (priv->background_style == PANEL_BG_STYLE_IMAGE) { panel_base_window_set_background_image_css (window); - panel_base_window_set_plugin_data (window, - panel_base_window_set_plugin_background_image); + panel_base_window_set_plugin_data (window, panel_base_window_set_plugin_background_image); } break; @@ -432,9 +443,9 @@ panel_base_window_set_property (GObject *object, { /* start timeout for the marching ants selection */ priv->active_timeout_id = gdk_threads_add_timeout_seconds_full ( - G_PRIORITY_DEFAULT_IDLE, 1, - panel_base_window_active_timeout, object, - panel_base_window_active_timeout_destroyed); + G_PRIORITY_DEFAULT_IDLE, 1, + panel_base_window_active_timeout, object, + panel_base_window_active_timeout_destroyed); } } else if (priv->active_timeout_id != 0) @@ -494,7 +505,7 @@ panel_base_window_screen_changed (GtkWidget *widget, GdkScreen *previous_screen) priv->is_composited = gdk_screen_is_composited (screen); } - panel_debug (PANEL_DEBUG_BASE_WINDOW, + panel_debug (PANEL_DEBUG_BASE_WINDOW, "%p: rgba visual=%p, compositing=%s", widget, visual, PANEL_DEBUG_BOOL (priv->is_composited)); } @@ -507,9 +518,9 @@ panel_base_window_composited_changed (GdkScreen *screen, { PanelBaseWindowPrivate *priv = get_instance_private (widget); PanelBaseWindow *window = PANEL_BASE_WINDOW (widget); - gboolean was_composited = priv->is_composited; - GdkWindow *gdkwindow; - GtkAllocation allocation; + gboolean was_composited = priv->is_composited; + GdkWindow *gdkwindow; + GtkAllocation allocation; /* set new compositing state */ priv->is_composited = gdk_screen_is_composited (screen); @@ -556,8 +567,8 @@ panel_base_window_composited_changed (GdkScreen *screen, static gboolean panel_base_window_active_timeout (gpointer user_data) { - PanelBaseWindow *window = PANEL_BASE_WINDOW (user_data); - GtkStyleContext *context; + PanelBaseWindow *window = PANEL_BASE_WINDOW (user_data); + GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (window)); @@ -610,7 +621,7 @@ panel_base_window_set_background_color_css (PanelBaseWindow *window) str = gdk_rgba_to_string (priv->background_rgba); css_string = g_strdup_printf (".xfce4-panel.background { background: %s; " - "border-color: transparent; } %s", + "border-color: transparent; } %s", str, PANEL_BASE_CSS); panel_base_window_set_background_css (window, css_string); @@ -641,7 +652,7 @@ panel_base_window_set_background_image_css (PanelBaseWindow *window) } css_string = g_strdup_printf (".xfce4-panel.background { background: -gtk-scaled(%s);" - "border-color: transparent; } %s", + "border-color: transparent; } %s", css_url, PANEL_BASE_CSS); panel_base_window_set_background_css (window, css_string); @@ -674,12 +685,12 @@ panel_base_window_set_background_css (PanelBaseWindow *window, void panel_base_window_reset_background_css (PanelBaseWindow *window) { - PanelBaseWindowPrivate *priv = get_instance_private (window); - GtkStyleContext *context; - GdkRGBA *background_rgba; - gchar *border_side = NULL; - gchar *base_css; - gchar *color_text; + PanelBaseWindowPrivate *priv = get_instance_private (window); + GtkStyleContext *context; + GdkRGBA *background_rgba; + gchar *border_side = NULL; + gchar *base_css; + gchar *color_text; context = gtk_widget_get_style_context (GTK_WIDGET (window)); gtk_style_context_remove_provider (context, @@ -722,7 +733,7 @@ panel_base_window_reset_background_css (PanelBaseWindow *window) void panel_base_window_orientation_changed (PanelBaseWindow *window, - gint mode) + gint mode) { GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (window)); @@ -747,7 +758,7 @@ panel_base_window_orientation_changed (PanelBaseWindow *window, static void panel_base_window_set_plugin_data (PanelBaseWindow *window, - GtkCallback func) + GtkCallback func) { GtkWidget *itembar; @@ -760,7 +771,7 @@ panel_base_window_set_plugin_data (PanelBaseWindow *window, static void panel_base_window_set_plugin_enter_opacity (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { panel_base_window_set_plugin_opacity (widget, user_data, get_instance_private (user_data)->enter_opacity); @@ -770,7 +781,7 @@ panel_base_window_set_plugin_enter_opacity (GtkWidget *widget, static void panel_base_window_set_plugin_leave_opacity (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { PanelBaseWindowPrivate *priv = get_instance_private (user_data); @@ -784,8 +795,8 @@ panel_base_window_set_plugin_leave_opacity (GtkWidget *widget, static void panel_base_window_set_plugin_opacity (GtkWidget *widget, - gpointer user_data, - gdouble opacity) + gpointer user_data, + gdouble opacity) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget)); panel_return_if_fail (PANEL_IS_BASE_WINDOW (user_data)); @@ -798,7 +809,7 @@ panel_base_window_set_plugin_opacity (GtkWidget *widget, static void panel_base_window_set_plugin_background_color (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { PanelBaseWindowPrivate *priv = get_instance_private (user_data); GdkRGBA *color; @@ -816,7 +827,7 @@ panel_base_window_set_plugin_background_color (GtkWidget *widget, static void panel_base_window_set_plugin_background_image (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget)); panel_return_if_fail (PANEL_IS_BASE_WINDOW (user_data)); @@ -830,7 +841,7 @@ panel_base_window_set_plugin_background_image (GtkWidget *widget, void panel_base_window_set_borders (PanelBaseWindow *window, - PanelBorders borders) + PanelBorders borders) { PanelBaseWindowPrivate *priv = get_instance_private (window); @@ -869,13 +880,13 @@ panel_base_window_get_borders (PanelBaseWindow *window) void panel_base_window_opacity_enter (PanelBaseWindow *window, - gboolean enter) + gboolean enter) { PanelBaseWindowPrivate *priv = get_instance_private (window); panel_return_if_fail (PANEL_IS_BASE_WINDOW (window)); - if (! priv->is_composited) + if (!priv->is_composited) return; priv->opacity_is_enter = enter; @@ -890,7 +901,7 @@ panel_base_window_opacity_enter (PanelBaseWindow *window, else { /* needs a recheck when timeout is over on Wayland, see panel_window_pointer_is_outside() */ - if (gtk_layer_is_supported () && ! panel_window_pointer_is_outside (PANEL_WINDOW (window))) + if (gtk_layer_is_supported () && !panel_window_pointer_is_outside (PANEL_WINDOW (window))) return; gtk_widget_set_opacity (GTK_WIDGET (window), priv->leave_opacity); diff --git a/panel/panel-base-window.h b/panel/panel-base-window.h index 9d7acb293..9a11f129d 100644 --- a/panel/panel-base-window.h +++ b/panel/panel-base-window.h @@ -28,10 +28,10 @@ G_DECLARE_DERIVABLE_TYPE (PanelBaseWindow, panel_base_window, PANEL, BASE_WINDOW typedef enum _PanelBorders { - PANEL_BORDER_NONE = 0, - PANEL_BORDER_LEFT = 1 << 0, - PANEL_BORDER_RIGHT = 1 << 1, - PANEL_BORDER_TOP = 1 << 2, + PANEL_BORDER_NONE = 0, + PANEL_BORDER_LEFT = 1 << 0, + PANEL_BORDER_RIGHT = 1 << 1, + PANEL_BORDER_TOP = 1 << 2, PANEL_BORDER_BOTTOM = 1 << 3 } PanelBorders; @@ -47,19 +47,29 @@ struct _PanelBaseWindowClass GtkWindowClass __parent__; }; -void panel_base_window_reset_background_css (PanelBaseWindow *window); -void panel_base_window_orientation_changed (PanelBaseWindow *window, - gint mode); -void panel_base_window_set_borders (PanelBaseWindow *window, - PanelBorders borders); -PanelBorders panel_base_window_get_borders (PanelBaseWindow *window); -void panel_base_window_opacity_enter (PanelBaseWindow *window, - gboolean enter); -gboolean panel_base_window_opacity_is_enter (PanelBaseWindow *window); -gboolean panel_base_window_is_composited (PanelBaseWindow *window); -PanelBgStyle panel_base_window_get_background_style (PanelBaseWindow *window); -GdkRGBA *panel_base_window_get_background_rgba (PanelBaseWindow *window); -gchar *panel_base_window_get_background_image (PanelBaseWindow *window); +void +panel_base_window_reset_background_css (PanelBaseWindow *window); +void +panel_base_window_orientation_changed (PanelBaseWindow *window, + gint mode); +void +panel_base_window_set_borders (PanelBaseWindow *window, + PanelBorders borders); +PanelBorders +panel_base_window_get_borders (PanelBaseWindow *window); +void +panel_base_window_opacity_enter (PanelBaseWindow *window, + gboolean enter); +gboolean +panel_base_window_opacity_is_enter (PanelBaseWindow *window); +gboolean +panel_base_window_is_composited (PanelBaseWindow *window); +PanelBgStyle +panel_base_window_get_background_style (PanelBaseWindow *window); +GdkRGBA * +panel_base_window_get_background_rgba (PanelBaseWindow *window); +gchar * +panel_base_window_get_background_image (PanelBaseWindow *window); G_END_DECLS diff --git a/panel/panel-dbus-client.c b/panel/panel-dbus-client.c index 760cf1e58..af29ac7e5 100644 --- a/panel/panel-dbus-client.c +++ b/panel/panel-dbus-client.c @@ -59,12 +59,12 @@ panel_dbus_client_get_proxy (GError **error) gboolean -panel_dbus_client_display_preferences_dialog (guint active, - guint socket_id, - GError **error) +panel_dbus_client_display_preferences_dialog (guint active, + guint socket_id, + GError **error) { XfcePanelExportedService *dbus_proxy; - gboolean result; + gboolean result; panel_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -86,11 +86,11 @@ panel_dbus_client_display_preferences_dialog (guint active, gboolean -panel_dbus_client_display_items_dialog (guint active, +panel_dbus_client_display_items_dialog (guint active, GError **error) { XfcePanelExportedService *dbus_proxy; - gboolean result; + gboolean result; panel_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -115,7 +115,7 @@ gboolean panel_dbus_client_save (GError **error) { XfcePanelExportedService *dbus_proxy; - gboolean result; + gboolean result; panel_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -133,14 +133,13 @@ panel_dbus_client_save (GError **error) gboolean -panel_dbus_client_add_new_item (const gchar *plugin_name, - gchar **arguments, - GError **error) +panel_dbus_client_add_new_item (const gchar *plugin_name, + gchar **arguments, + GError **error) { - XfcePanelExportedService *dbus_proxy; - gboolean result; - const gchar *empty_arguments[] = {"", NULL}; + gboolean result; + const gchar *empty_arguments[] = { "", NULL }; panel_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -186,16 +185,16 @@ panel_dbus_client_gtype_from_string (const gchar *str) gboolean -panel_dbus_client_plugin_event (const gchar *plugin_event, - gboolean *return_succeed, - GError **error) +panel_dbus_client_plugin_event (const gchar *plugin_event, + gboolean *return_succeed, + GError **error) { - XfcePanelExportedService *dbus_proxy; - gchar **tokens; - GType type; - guint n_tokens; - gboolean result = FALSE; - GVariant *variant = NULL; + XfcePanelExportedService *dbus_proxy; + gchar **tokens; + GType type; + guint n_tokens; + gboolean result = FALSE; + GVariant *variant = NULL; panel_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -258,7 +257,7 @@ panel_dbus_client_plugin_event (const gchar *plugin_event, result = xfce_panel_exported_service_call_plugin_event_sync (dbus_proxy, tokens[PLUGIN_NAME], tokens[NAME], - g_variant_new_variant(variant), + g_variant_new_variant (variant), return_succeed, NULL, error); @@ -272,11 +271,11 @@ out: gboolean -panel_dbus_client_terminate (gboolean restart, - GError **error) +panel_dbus_client_terminate (gboolean restart, + GError **error) { XfcePanelExportedService *dbus_proxy; - gboolean result; + gboolean result; panel_return_val_if_fail (error == NULL || *error == NULL, FALSE); diff --git a/panel/panel-dbus-client.h b/panel/panel-dbus-client.h index 25f42f011..60e81a05c 100644 --- a/panel/panel-dbus-client.h +++ b/panel/panel-dbus-client.h @@ -23,25 +23,31 @@ G_BEGIN_DECLS -gboolean panel_dbus_client_display_preferences_dialog (guint active, - guint socket_id, - GError **error); - -gboolean panel_dbus_client_display_items_dialog (guint active, - GError **error); - -gboolean panel_dbus_client_save (GError **error); - -gboolean panel_dbus_client_add_new_item (const gchar *plugin_name, - gchar **arguments, - GError **error); - -gboolean panel_dbus_client_plugin_event (const gchar *plugin_event, - gboolean *return_succeed, - GError **error); - -gboolean panel_dbus_client_terminate (gboolean restart, - GError **error); +gboolean +panel_dbus_client_display_preferences_dialog (guint active, + guint socket_id, + GError **error); + +gboolean +panel_dbus_client_display_items_dialog (guint active, + GError **error); + +gboolean +panel_dbus_client_save (GError **error); + +gboolean +panel_dbus_client_add_new_item (const gchar *plugin_name, + gchar **arguments, + GError **error); + +gboolean +panel_dbus_client_plugin_event (const gchar *plugin_event, + gboolean *return_succeed, + GError **error); + +gboolean +panel_dbus_client_terminate (gboolean restart, + GError **error); G_END_DECLS diff --git a/panel/panel-dbus-service.c b/panel/panel-dbus-service.c index 5844ed779..50e2632cf 100644 --- a/panel/panel-dbus-service.c +++ b/panel/panel-dbus-service.c @@ -35,41 +35,49 @@ #include <libxfce4ui/libxfce4ui.h> #include <libxfce4util/libxfce4util.h> -static void panel_dbus_service_finalize (GObject *object); -static void panel_dbus_service_plugin_event_result (XfcePanelPluginProvider *prev_provider, - guint handle, - gboolean result, - PanelDBusService *service); - -static gboolean panel_dbus_service_display_preferences_dialog (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - guint active, - guint socket_id, - PanelDBusService *service); -static gboolean panel_dbus_service_display_items_dialog (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - guint active, - PanelDBusService *service); -static gboolean panel_dbus_service_save (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - PanelDBusService *service); -static gboolean panel_dbus_service_add_new_item (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - const gchar *plugin_name, - gchar **arguments, - PanelDBusService *service); -static void panel_dbus_service_plugin_event_free (gpointer data); -static gboolean panel_dbus_service_plugin_event (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - const gchar *plugin_name, - const gchar *name, - GVariant *variant, - PanelDBusService *service); -static gboolean panel_dbus_service_terminate (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - gboolean restart, - PanelDBusService *service); +static void +panel_dbus_service_finalize (GObject *object); +static void +panel_dbus_service_plugin_event_result (XfcePanelPluginProvider *prev_provider, + guint handle, + gboolean result, + PanelDBusService *service); +static gboolean +panel_dbus_service_display_preferences_dialog (XfcePanelExportedService *skeleton, + GDBusMethodInvocation *invocation, + guint active, + guint socket_id, + PanelDBusService *service); +static gboolean +panel_dbus_service_display_items_dialog (XfcePanelExportedService *skeleton, + GDBusMethodInvocation *invocation, + guint active, + PanelDBusService *service); +static gboolean +panel_dbus_service_save (XfcePanelExportedService *skeleton, + GDBusMethodInvocation *invocation, + PanelDBusService *service); +static gboolean +panel_dbus_service_add_new_item (XfcePanelExportedService *skeleton, + GDBusMethodInvocation *invocation, + const gchar *plugin_name, + gchar **arguments, + PanelDBusService *service); +static void +panel_dbus_service_plugin_event_free (gpointer data); +static gboolean +panel_dbus_service_plugin_event (XfcePanelExportedService *skeleton, + GDBusMethodInvocation *invocation, + const gchar *plugin_name, + const gchar *name, + GVariant *variant, + PanelDBusService *service); +static gboolean +panel_dbus_service_terminate (XfcePanelExportedService *skeleton, + GDBusMethodInvocation *invocation, + gboolean restart, + PanelDBusService *service); @@ -81,17 +89,16 @@ struct _PanelDBusService GDBusConnection *connection; /* queue for remote-events */ - GHashTable *remote_events; + GHashTable *remote_events; }; typedef struct { - guint handle; - gchar *name; - GValue value; + guint handle; + gchar *name; + GValue value; GSList *plugins; -} -PluginEvent; +} PluginEvent; @@ -111,7 +118,6 @@ panel_dbus_service_class_init (PanelDBusServiceClass *klass) gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = panel_dbus_service_finalize; - } @@ -132,17 +138,17 @@ panel_dbus_service_init (PanelDBusService *service) &error))) { g_signal_connect (service, "handle_add_new_item", - G_CALLBACK(panel_dbus_service_add_new_item), service); + G_CALLBACK (panel_dbus_service_add_new_item), service); g_signal_connect (service, "handle_display_items_dialog", - G_CALLBACK(panel_dbus_service_display_items_dialog), service); + G_CALLBACK (panel_dbus_service_display_items_dialog), service); g_signal_connect (service, "handle_display_preferences_dialog", - G_CALLBACK(panel_dbus_service_display_preferences_dialog), service); + G_CALLBACK (panel_dbus_service_display_preferences_dialog), service); g_signal_connect (service, "handle_plugin_event", - G_CALLBACK(panel_dbus_service_plugin_event), service); + G_CALLBACK (panel_dbus_service_plugin_event), service); g_signal_connect (service, "handle_save", - G_CALLBACK(panel_dbus_service_save), service); + G_CALLBACK (panel_dbus_service_save), service); g_signal_connect (service, "handle_terminate", - G_CALLBACK(panel_dbus_service_terminate), service); + G_CALLBACK (panel_dbus_service_terminate), service); } else { @@ -177,17 +183,17 @@ panel_dbus_service_finalize (GObject *object) static gboolean panel_dbus_service_display_preferences_dialog (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - guint active, - guint socket_id, - PanelDBusService *service) + GDBusMethodInvocation *invocation, + guint active, + guint socket_id, + PanelDBusService *service) { panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE); /* show the preferences dialog */ panel_preferences_dialog_show_from_id (active, socket_id); - xfce_panel_exported_service_complete_display_preferences_dialog(skeleton, invocation); + xfce_panel_exported_service_complete_display_preferences_dialog (skeleton, invocation); return TRUE; } @@ -196,9 +202,9 @@ panel_dbus_service_display_preferences_dialog (XfcePanelExportedService *skeleto static gboolean panel_dbus_service_display_items_dialog (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - guint active, - PanelDBusService *service) + GDBusMethodInvocation *invocation, + guint active, + PanelDBusService *service) { panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE); @@ -214,8 +220,8 @@ panel_dbus_service_display_items_dialog (XfcePanelExportedService *skeleton, static gboolean panel_dbus_service_save (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - PanelDBusService *service) + GDBusMethodInvocation *invocation, + PanelDBusService *service) { PanelApplication *application; @@ -236,10 +242,10 @@ panel_dbus_service_save (XfcePanelExportedService *skeleton, static gboolean panel_dbus_service_add_new_item (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - const gchar *plugin_name, - gchar **arguments, - PanelDBusService *service) + GDBusMethodInvocation *invocation, + const gchar *plugin_name, + gchar **arguments, + PanelDBusService *service) { PanelApplication *application; @@ -260,26 +266,25 @@ panel_dbus_service_add_new_item (XfcePanelExportedService *skeleton, invocation); return TRUE; - } static gboolean panel_dbus_service_plugin_event (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - const gchar *plugin_name, - const gchar *name, - GVariant *variant, - PanelDBusService *service) + GDBusMethodInvocation *invocation, + const gchar *plugin_name, + const gchar *name, + GVariant *variant, + PanelDBusService *service) { - GSList *plugins, *li, *lnext; + GSList *plugins, *li, *lnext; PanelModuleFactory *factory; - PluginEvent *event; - guint handle; - gboolean result; - GValue value = G_VALUE_INIT; - gboolean plugin_replied = FALSE; + PluginEvent *event; + guint handle; + gboolean result; + GValue value = G_VALUE_INIT; + gboolean plugin_replied = FALSE; panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE); panel_return_val_if_fail (plugin_name != NULL, FALSE); @@ -317,7 +322,7 @@ panel_dbus_service_plugin_event (XfcePanelExportedService *skeleton, g_hash_table_insert (service->remote_events, &event->handle, event); g_signal_connect (G_OBJECT (li->data), "remote-event-result", - G_CALLBACK (panel_dbus_service_plugin_event_result), service); + G_CALLBACK (panel_dbus_service_plugin_event_result), service); /* not entirely sure the event is handled, but at least suitable * plugins were found */ @@ -342,16 +347,15 @@ panel_dbus_service_plugin_event (XfcePanelExportedService *skeleton, xfce_panel_exported_service_complete_plugin_event (skeleton, invocation, plugin_replied); return TRUE; - } static gboolean panel_dbus_service_terminate (XfcePanelExportedService *skeleton, - GDBusMethodInvocation *invocation, - gboolean restart, - PanelDBusService *service) + GDBusMethodInvocation *invocation, + gboolean restart, + PanelDBusService *service) { panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE); @@ -361,7 +365,6 @@ panel_dbus_service_terminate (XfcePanelExportedService *skeleton, invocation); return TRUE; - } @@ -381,18 +384,18 @@ panel_dbus_service_plugin_event_free (gpointer data) static void panel_dbus_service_plugin_event_result (XfcePanelPluginProvider *prev_provider, - guint handle, - gboolean result, - PanelDBusService *service) + guint handle, + gboolean result, + PanelDBusService *service) { - PluginEvent *event; - GSList *li, *lnext; + PluginEvent *event; + GSList *li, *lnext; XfcePanelPluginProvider *provider; - guint new_handle; - gboolean new_result; + guint new_handle; + gboolean new_result; g_signal_handlers_disconnect_by_func (G_OBJECT (prev_provider), - G_CALLBACK (panel_dbus_service_plugin_event_result), service); + G_CALLBACK (panel_dbus_service_plugin_event_result), service); event = g_hash_table_lookup (service->remote_events, &handle); if (G_LIKELY (event != NULL)) @@ -423,7 +426,7 @@ panel_dbus_service_plugin_event_result (XfcePanelPluginProvider *prev_provider, event->handle = new_handle; g_hash_table_insert (service->remote_events, &event->handle, event); g_signal_connect (G_OBJECT (provider), "remote-event-result", - G_CALLBACK (panel_dbus_service_plugin_event_result), service); + G_CALLBACK (panel_dbus_service_plugin_event_result), service); /* leave and wait for reply */ return; diff --git a/panel/panel-dbus-service.h b/panel/panel-dbus-service.h index d3711b1a7..c6175d67e 100644 --- a/panel/panel-dbus-service.h +++ b/panel/panel-dbus-service.h @@ -28,11 +28,14 @@ G_BEGIN_DECLS #define PANEL_TYPE_DBUS_SERVICE (panel_dbus_service_get_type ()) G_DECLARE_FINAL_TYPE (PanelDBusService, panel_dbus_service, PANEL, DBUS_SERVICE, XfcePanelExportedServiceSkeleton) -PanelDBusService *panel_dbus_service_get (void); +PanelDBusService * +panel_dbus_service_get (void); -void panel_dbus_service_exit_panel (gboolean restart); +void +panel_dbus_service_exit_panel (gboolean restart); -gboolean panel_dbus_service_get_restart (void); +gboolean +panel_dbus_service_get_restart (void); G_END_DECLS diff --git a/panel/panel-dialogs.c b/panel/panel-dialogs.c index 6f7b4b53d..3057a0592 100644 --- a/panel/panel-dialogs.c +++ b/panel/panel-dialogs.c @@ -33,8 +33,8 @@ static gboolean panel_dialogs_show_about_email_hook (GtkAboutDialog *dialog, - const gchar *uri, - gpointer data) + const gchar *uri, + gpointer data) { GError *error = NULL; @@ -74,7 +74,7 @@ panel_dialogs_show_about (void) authors[4] = g_strdup ("Tic-Tac-Toe <tictactoe@xfce.org>"); about_dialog = gtk_about_dialog_new (); - gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (about_dialog), (const gchar**) authors); + gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (about_dialog), (const gchar **) authors); g_strfreev (authors); gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG (about_dialog), _("The panel of the Xfce Desktop Environment")); gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (about_dialog), "Copyright \302\251 2004-2024 The Xfce development team"); @@ -106,8 +106,8 @@ enum static gint panel_dialogs_choose_panel_combo_get_id (GtkComboBox *combo) { - gint panel_id = -1; - GtkTreeIter iter; + gint panel_id = -1; + GtkTreeIter iter; GtkTreeModel *model; if (gtk_combo_box_get_active_iter (combo, &iter)) @@ -122,7 +122,7 @@ panel_dialogs_choose_panel_combo_get_id (GtkComboBox *combo) static void -panel_dialogs_choose_panel_combo_changed (GtkComboBox *combo, +panel_dialogs_choose_panel_combo_changed (GtkComboBox *combo, PanelApplication *application) { gint panel_id; @@ -131,8 +131,7 @@ panel_dialogs_choose_panel_combo_changed (GtkComboBox *combo, panel_return_if_fail (GTK_IS_COMBO_BOX (combo)); panel_id = panel_dialogs_choose_panel_combo_get_id (combo); - panel_application_window_select (application, - panel_application_get_window (application, panel_id)); + panel_application_window_select (application, panel_application_get_window (application, panel_id)); } @@ -140,24 +139,22 @@ panel_dialogs_choose_panel_combo_changed (GtkComboBox *combo, gint panel_dialogs_choose_panel (PanelApplication *application) { - GtkWidget *dialog; - GtkWidget *vbox; - GtkWidget *label; - GtkWidget *combo; - gchar *name; - GtkListStore *store; + GtkWidget *dialog; + GtkWidget *vbox; + GtkWidget *label; + GtkWidget *combo; + gchar *name; + GtkListStore *store; GtkCellRenderer *renderer; - GSList *windows, *li; - gint i; - gint panel_id; + GSList *windows, *li; + gint i; + gint panel_id; panel_return_val_if_fail (PANEL_IS_APPLICATION (application), -1); /* setup the dialog */ - dialog = gtk_dialog_new_with_buttons (_("Add New Item"), NULL, - 0, - _("_Cancel"), GTK_RESPONSE_CANCEL, - _("_Add"), GTK_RESPONSE_OK, NULL); + dialog = gtk_dialog_new_with_buttons ( + _("Add New Item"), NULL, 0, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Add"), GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_window_set_icon_name (GTK_WINDOW (dialog), "list-add"); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); @@ -197,7 +194,7 @@ panel_dialogs_choose_panel (PanelApplication *application) /* select first panel (changed will start marching ants) */ g_signal_connect (G_OBJECT (combo), "changed", - G_CALLBACK (panel_dialogs_choose_panel_combo_changed), application); + G_CALLBACK (panel_dialogs_choose_panel_combo_changed), application); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); /* run the dialog */ @@ -219,7 +216,7 @@ gboolean panel_dialogs_kiosk_warning (void) { PanelApplication *application; - gboolean locked; + gboolean locked; application = panel_application_get (); locked = panel_application_get_locked (application); @@ -227,10 +224,9 @@ panel_dialogs_kiosk_warning (void) if (locked) { - xfce_dialog_show_warning (NULL, - _("Because the panel is running in kiosk mode, you are not allowed " - "to make changes to the panel configuration as a regular user"), - _("Modifying the panel is not allowed")); + const gchar *text = _("Because the panel is running in kiosk mode, you are not allowed " + "to make changes to the panel configuration as a regular user"); + xfce_dialog_show_warning (NULL, text, _("Modifying the panel is not allowed")); } return locked; diff --git a/panel/panel-dialogs.h b/panel/panel-dialogs.h index b010f2b12..f06af9a9a 100644 --- a/panel/panel-dialogs.h +++ b/panel/panel-dialogs.h @@ -23,11 +23,14 @@ G_BEGIN_DECLS -void panel_dialogs_show_about (void); +void +panel_dialogs_show_about (void); -gint panel_dialogs_choose_panel (PanelApplication *application); +gint +panel_dialogs_choose_panel (PanelApplication *application); -gboolean panel_dialogs_kiosk_warning (void); +gboolean +panel_dialogs_kiosk_warning (void); G_END_DECLS diff --git a/panel/panel-item-dialog.c b/panel/panel-item-dialog.c index c96fba727..c2676fab8 100644 --- a/panel/panel-item-dialog.c +++ b/panel/panel-item-dialog.c @@ -37,73 +37,88 @@ -static void panel_item_dialog_finalize (GObject *object); -static void panel_item_dialog_response (GtkDialog *dialog, - gint response_id); -static void panel_item_dialog_unique_changed (PanelModuleFactory *factory, - PanelModule *module, - PanelItemDialog *dialog); -static gboolean panel_item_dialog_unique_changed_foreach (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data); -static gboolean panel_item_dialog_separator_func (GtkTreeModel *model, - GtkTreeIter *iter, - gpointer user_data); -static void panel_item_dialog_selection_changed (GtkTreeSelection *selection, - PanelItemDialog *dialog); -static PanelModule *panel_item_dialog_get_selected_module (GtkTreeView *treeview); -static void panel_item_dialog_row_activated (GtkTreeView *treeview, - GtkTreePath *path, - GtkTreeViewColumn *column, - gpointer user_data); -static void panel_item_dialog_drag_begin (GtkWidget *treeview, - GdkDragContext *context, - PanelItemDialog *dialog); -static void panel_item_dialog_drag_data_get (GtkWidget *treeview, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint drag_time, - PanelItemDialog *dialog); -static void panel_item_dialog_drag_data_received (GtkWidget *treeview, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection_data, - guint info, - guint drag_time, - PanelItemDialog *dialog); -static void panel_item_dialog_populate_store (PanelItemDialog *dialog); -static gint panel_item_dialog_compare_func (GtkTreeModel *model, - GtkTreeIter *a, - GtkTreeIter *b, - gpointer user_data); -static gboolean panel_item_dialog_visible_func (GtkTreeModel *model, - GtkTreeIter *iter, - gpointer user_data); -static void panel_item_dialog_text_renderer (GtkTreeViewColumn *column, - GtkCellRenderer *renderer, - GtkTreeModel *model, - GtkTreeIter *iter, - gpointer user_data); +static void +panel_item_dialog_finalize (GObject *object); +static void +panel_item_dialog_response (GtkDialog *dialog, + gint response_id); +static void +panel_item_dialog_unique_changed (PanelModuleFactory *factory, + PanelModule *module, + PanelItemDialog *dialog); +static gboolean +panel_item_dialog_unique_changed_foreach (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data); +static gboolean +panel_item_dialog_separator_func (GtkTreeModel *model, + GtkTreeIter *iter, + gpointer user_data); +static void +panel_item_dialog_selection_changed (GtkTreeSelection *selection, + PanelItemDialog *dialog); +static PanelModule * +panel_item_dialog_get_selected_module (GtkTreeView *treeview); +static void +panel_item_dialog_row_activated (GtkTreeView *treeview, + GtkTreePath *path, + GtkTreeViewColumn *column, + gpointer user_data); +static void +panel_item_dialog_drag_begin (GtkWidget *treeview, + GdkDragContext *context, + PanelItemDialog *dialog); +static void +panel_item_dialog_drag_data_get (GtkWidget *treeview, + GdkDragContext *context, + GtkSelectionData *selection_data, + guint info, + guint drag_time, + PanelItemDialog *dialog); +static void +panel_item_dialog_drag_data_received (GtkWidget *treeview, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *selection_data, + guint info, + guint drag_time, + PanelItemDialog *dialog); +static void +panel_item_dialog_populate_store (PanelItemDialog *dialog); +static gint +panel_item_dialog_compare_func (GtkTreeModel *model, + GtkTreeIter *a, + GtkTreeIter *b, + gpointer user_data); +static gboolean +panel_item_dialog_visible_func (GtkTreeModel *model, + GtkTreeIter *iter, + gpointer user_data); +static void +panel_item_dialog_text_renderer (GtkTreeViewColumn *column, + GtkCellRenderer *renderer, + GtkTreeModel *model, + GtkTreeIter *iter, + gpointer user_data); struct _PanelItemDialog { - XfceTitledDialog __parent__; + XfceTitledDialog __parent__; - PanelApplication *application; + PanelApplication *application; PanelModuleFactory *factory; - PanelWindow *active; + PanelWindow *active; /* pointers to list */ - GtkListStore *store; - GtkTreeView *treeview; - GtkWidget *add_button; + GtkListStore *store; + GtkTreeView *treeview; + GtkWidget *add_button; }; enum @@ -114,13 +129,11 @@ enum N_COLUMNS }; -static const GtkTargetEntry drag_targets[] = -{ +static const GtkTargetEntry drag_targets[] = { { "xfce-panel/plugin-name", 0, 0 } }; -static const GtkTargetEntry drop_targets[] = -{ +static const GtkTargetEntry drop_targets[] = { { "xfce-panel/plugin-widget", GTK_TARGET_SAME_APP, 0 } }; @@ -137,7 +150,7 @@ static PanelItemDialog *dialog_singleton = NULL; static void panel_item_dialog_class_init (PanelItemDialogClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; GtkDialogClass *gtkdialog_class; gobject_class = G_OBJECT_CLASS (klass); @@ -152,18 +165,18 @@ panel_item_dialog_class_init (PanelItemDialogClass *klass) static void panel_item_dialog_init (PanelItemDialog *dialog) { - GtkWidget *main_vbox; - GtkWidget *hbox; - GtkWidget *button; - GtkWidget *label; - GtkWidget *entry; - GtkWidget *scroll; - GtkWidget *treeview; - GtkWidget *icon; - GtkTreeModel *filter; + GtkWidget *main_vbox; + GtkWidget *hbox; + GtkWidget *button; + GtkWidget *label; + GtkWidget *entry; + GtkWidget *scroll; + GtkWidget *treeview; + GtkWidget *icon; + GtkTreeModel *filter; GtkTreeViewColumn *column; - GtkCellRenderer *renderer; - GtkTreeSelection *selection; + GtkCellRenderer *renderer; + GtkTreeSelection *selection; dialog->application = panel_application_get (); @@ -177,13 +190,13 @@ panel_item_dialog_init (PanelItemDialog *dialog) /* monitor unique changes */ g_signal_connect (G_OBJECT (dialog->factory), "unique-changed", - G_CALLBACK (panel_item_dialog_unique_changed), dialog); + G_CALLBACK (panel_item_dialog_unique_changed), dialog); gtk_window_set_title (GTK_WINDOW (dialog), _("Add New Items")); gtk_window_set_icon_name (GTK_WINDOW (dialog), "list-add"); gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 500); gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_NORMAL); -#if !LIBXFCE4UI_CHECK_VERSION (4, 19, 3) +#if !LIBXFCE4UI_CHECK_VERSION(4, 19, 3) xfce_titled_dialog_create_action_area (XFCE_TITLED_DIALOG (dialog)); #endif @@ -264,7 +277,7 @@ panel_item_dialog_init (PanelItemDialog *dialog) /* remove plugin when dropping it back in the treeview */ gtk_drag_dest_set (GTK_WIDGET (treeview), GTK_DEST_DEFAULT_ALL, - drop_targets, G_N_ELEMENTS (drop_targets), GDK_ACTION_MOVE); + drop_targets, G_N_ELEMENTS (drop_targets), GDK_ACTION_MOVE); g_signal_connect (G_OBJECT (treeview), "drag-data-received", G_CALLBACK (panel_item_dialog_drag_data_received), dialog); /* icon renderer */ @@ -291,8 +304,7 @@ panel_item_dialog_finalize (GObject *object) PanelItemDialog *dialog = PANEL_ITEM_DIALOG (object); /* disconnect unique-changed signal */ - g_signal_handlers_disconnect_by_func (G_OBJECT (dialog->factory), - panel_item_dialog_unique_changed, dialog); + g_signal_handlers_disconnect_by_func (dialog->factory, panel_item_dialog_unique_changed, dialog); /* make the windows sensitive again */ panel_application_windows_blocked (dialog->application, FALSE); @@ -308,10 +320,10 @@ panel_item_dialog_finalize (GObject *object) static void panel_item_dialog_response (GtkDialog *gtk_dialog, - gint response_id) + gint response_id) { PanelItemDialog *dialog = PANEL_ITEM_DIALOG (gtk_dialog); - PanelModule *module; + PanelModule *module; panel_return_if_fail (PANEL_IS_ITEM_DIALOG (dialog)); panel_return_if_fail (GTK_IS_TREE_VIEW (dialog->treeview)); @@ -326,9 +338,8 @@ panel_item_dialog_response (GtkDialog *gtk_dialog, module = panel_item_dialog_get_selected_module (dialog->treeview); if (G_LIKELY (module != NULL)) { - panel_application_add_new_item (dialog->application, - dialog->active, - panel_module_get_name (module), NULL); + panel_application_add_new_item (dialog->application, dialog->active, + panel_module_get_name (module), NULL); g_object_unref (G_OBJECT (module)); } } @@ -345,8 +356,8 @@ panel_item_dialog_response (GtkDialog *gtk_dialog, static void panel_item_dialog_unique_changed (PanelModuleFactory *factory, - PanelModule *module, - PanelItemDialog *dialog) + PanelModule *module, + PanelItemDialog *dialog) { panel_return_if_fail (PANEL_IS_MODULE_FACTORY (factory)); panel_return_if_fail (PANEL_IS_MODULE (module)); @@ -356,7 +367,7 @@ panel_item_dialog_unique_changed (PanelModuleFactory *factory, /* search the module and update its sensitivity */ g_object_set_data (G_OBJECT (dialog->store), "dialog", dialog); gtk_tree_model_foreach (GTK_TREE_MODEL (dialog->store), - panel_item_dialog_unique_changed_foreach, module); + panel_item_dialog_unique_changed_foreach, module); g_object_set_data (G_OBJECT (dialog->store), "dialog", NULL); /* update button sensitivity */ @@ -367,13 +378,13 @@ panel_item_dialog_unique_changed (PanelModuleFactory *factory, static gboolean panel_item_dialog_unique_changed_foreach (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data) { PanelModule *module; - gboolean result; - GtkWidget *dialog; + gboolean result; + GtkWidget *dialog; panel_return_val_if_fail (PANEL_IS_MODULE (user_data), FALSE); @@ -393,9 +404,10 @@ panel_item_dialog_unique_changed_foreach (GtkTreeModel *model, panel_return_val_if_fail (PANEL_IS_ITEM_DIALOG (dialog), FALSE); /* update the module unique status */ - gtk_list_store_set (GTK_LIST_STORE (model), iter, - COLUMN_SENSITIVE, panel_module_is_usable (module, - gtk_widget_get_screen (dialog)), -1); + gtk_list_store_set ( + GTK_LIST_STORE (model), iter, + COLUMN_SENSITIVE, panel_module_is_usable (module, gtk_widget_get_screen (dialog)), + -1); } g_object_unref (G_OBJECT (module)); @@ -408,8 +420,8 @@ panel_item_dialog_unique_changed_foreach (GtkTreeModel *model, static gboolean panel_item_dialog_separator_func (GtkTreeModel *model, - GtkTreeIter *iter, - gpointer user_data) + GtkTreeIter *iter, + gpointer user_data) { PanelModule *module; @@ -426,10 +438,10 @@ panel_item_dialog_separator_func (GtkTreeModel *model, static void panel_item_dialog_selection_changed (GtkTreeSelection *selection, - PanelItemDialog *dialog) + PanelItemDialog *dialog) { PanelModule *module; - gboolean sensitive = FALSE; + gboolean sensitive = FALSE; panel_return_if_fail (PANEL_IS_ITEM_DIALOG (dialog)); panel_return_if_fail (GTK_IS_TREE_SELECTION (selection)); @@ -450,9 +462,9 @@ static PanelModule * panel_item_dialog_get_selected_module (GtkTreeView *treeview) { GtkTreeSelection *selection; - GtkTreeModel *model; - GtkTreeIter iter; - PanelModule *module = NULL; + GtkTreeModel *model; + GtkTreeIter iter; + PanelModule *module = NULL; panel_return_val_if_fail (GTK_IS_TREE_VIEW (treeview), NULL); @@ -495,12 +507,12 @@ panel_item_dialog_row_activated (GtkTreeView *treeview, static void -panel_item_dialog_drag_begin (GtkWidget *treeview, - GdkDragContext *context, +panel_item_dialog_drag_begin (GtkWidget *treeview, + GdkDragContext *context, PanelItemDialog *dialog) { - PanelModule *module; - const gchar *icon_name; + PanelModule *module; + const gchar *icon_name; GtkIconTheme *theme; panel_return_if_fail (GTK_IS_TREE_VIEW (treeview)); @@ -534,12 +546,12 @@ panel_item_dialog_drag_begin (GtkWidget *treeview, static void -panel_item_dialog_drag_data_get (GtkWidget *treeview, - GdkDragContext *context, +panel_item_dialog_drag_data_get (GtkWidget *treeview, + GdkDragContext *context, GtkSelectionData *selection_data, - guint drag_info, - guint drag_time, - PanelItemDialog *dialog) + guint drag_info, + guint drag_time, + PanelItemDialog *dialog) { PanelModule *module; const gchar *internal_name; @@ -554,7 +566,7 @@ panel_item_dialog_drag_data_get (GtkWidget *treeview, /* set the internal module name as selection data */ internal_name = panel_module_get_name (module); gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), 8, - (guchar *) internal_name, strlen (internal_name)); + (guchar *) internal_name, strlen (internal_name)); g_object_unref (G_OBJECT (module)); } } @@ -562,14 +574,14 @@ panel_item_dialog_drag_data_get (GtkWidget *treeview, static void -panel_item_dialog_drag_data_received (GtkWidget *treeview, - GdkDragContext *context, - gint x, - gint y, +panel_item_dialog_drag_data_received (GtkWidget *treeview, + GdkDragContext *context, + gint x, + gint y, GtkSelectionData *selection_data, - guint info, - guint drag_time, - PanelItemDialog *dialog) + guint info, + guint drag_time, + PanelItemDialog *dialog) { GtkWidget *widget; @@ -592,9 +604,9 @@ panel_item_dialog_drag_data_received (GtkWidget *treeview, static void panel_item_dialog_populate_store (PanelItemDialog *dialog) { - GList *modules, *li; - gint n; - GtkTreeIter iter; + GList *modules, *li; + gint n; + GtkTreeIter iter; PanelModule *module; panel_return_if_fail (PANEL_IS_ITEM_DIALOG (dialog)); @@ -610,11 +622,12 @@ panel_item_dialog_populate_store (PanelItemDialog *dialog) { module = PANEL_MODULE (li->data); - gtk_list_store_insert_with_values (dialog->store, &iter, n, - COLUMN_MODULE, module, - COLUMN_ICON_NAME, panel_module_get_icon_name (module), - COLUMN_SENSITIVE, panel_module_is_usable (module, - gtk_widget_get_screen (GTK_WIDGET (dialog))), -1); + gtk_list_store_insert_with_values ( + dialog->store, &iter, n, + COLUMN_MODULE, module, + COLUMN_ICON_NAME, panel_module_get_icon_name (module), + COLUMN_SENSITIVE, panel_module_is_usable (module, gtk_widget_get_screen (GTK_WIDGET (dialog))), + -1); } g_list_free (modules); @@ -629,15 +642,15 @@ panel_item_dialog_populate_store (PanelItemDialog *dialog) static gint panel_item_dialog_compare_func (GtkTreeModel *model, - GtkTreeIter *a, - GtkTreeIter *b, - gpointer user_data) + GtkTreeIter *a, + GtkTreeIter *b, + gpointer user_data) { PanelModule *module_a; PanelModule *module_b; const gchar *name_a; const gchar *name_b; - gint result; + gint result; /* get modules a name */ gtk_tree_model_get (model, a, COLUMN_MODULE, &module_a, -1); @@ -648,26 +661,22 @@ panel_item_dialog_compare_func (GtkTreeModel *model, /* don't move the separator */ result = 0; } - else if (g_strcmp0 (LAUNCHER_PLUGIN_NAME, - panel_module_get_name (module_a)) == 0) + else if (g_strcmp0 (LAUNCHER_PLUGIN_NAME, panel_module_get_name (module_a)) == 0) { /* move the launcher to the first position */ result = -1; } - else if (g_strcmp0 (LAUNCHER_PLUGIN_NAME, - panel_module_get_name (module_b)) == 0) + else if (g_strcmp0 (LAUNCHER_PLUGIN_NAME, panel_module_get_name (module_b)) == 0) { /* move the launcher to the first position */ result = 1; } - else if (g_strcmp0 (SEPARATOR_PLUGIN_NAME, - panel_module_get_name (module_a)) == 0) + else if (g_strcmp0 (SEPARATOR_PLUGIN_NAME, panel_module_get_name (module_a)) == 0) { /* move the separator to the second position */ result = -1; } - else if (g_strcmp0 (SEPARATOR_PLUGIN_NAME, - panel_module_get_name (module_b)) == 0) + else if (g_strcmp0 (SEPARATOR_PLUGIN_NAME, panel_module_get_name (module_b)) == 0) { /* move the separator to the second position */ result = 1; @@ -699,18 +708,17 @@ panel_item_dialog_compare_func (GtkTreeModel *model, static gboolean panel_item_dialog_visible_func (GtkTreeModel *model, - GtkTreeIter *iter, - gpointer user_data) + GtkTreeIter *iter, + gpointer user_data) { - - GtkEntry *entry = GTK_ENTRY (user_data); + GtkEntry *entry = GTK_ENTRY (user_data); const gchar *text, *name, *comment; PanelModule *module; - gchar *normalized; - gchar *text_casefolded; - gchar *name_casefolded; - gchar *comment_casefolded; - gboolean visible = FALSE; + gchar *normalized; + gchar *text_casefolded; + gchar *name_casefolded; + gchar *comment_casefolded; + gboolean visible = FALSE; /* search string from dialog */ text = gtk_entry_get_text (entry); @@ -769,13 +777,13 @@ panel_item_dialog_visible_func (GtkTreeModel *model, static void panel_item_dialog_text_renderer (GtkTreeViewColumn *column, - GtkCellRenderer *renderer, - GtkTreeModel *model, - GtkTreeIter *iter, - gpointer user_data) + GtkCellRenderer *renderer, + GtkTreeModel *model, + GtkTreeIter *iter, + gpointer user_data) { PanelModule *module; - gchar *markup; + gchar *markup; const gchar *name, *comment; gtk_tree_model_get (model, iter, COLUMN_MODULE, &module, -1); @@ -800,7 +808,7 @@ panel_item_dialog_text_renderer (GtkTreeViewColumn *column, void panel_item_dialog_show (PanelWindow *window) { - GdkScreen *screen; + GdkScreen *screen; PanelApplication *application; panel_return_if_fail (window == NULL || PANEL_IS_WINDOW (window)); @@ -847,7 +855,7 @@ void panel_item_dialog_show_from_id (gint panel_id) { PanelApplication *application; - PanelWindow *window; + PanelWindow *window; application = panel_application_get (); window = panel_application_get_window (application, panel_id); diff --git a/panel/panel-item-dialog.h b/panel/panel-item-dialog.h index 19f739d82..43d107660 100644 --- a/panel/panel-item-dialog.h +++ b/panel/panel-item-dialog.h @@ -27,11 +27,14 @@ G_BEGIN_DECLS #define PANEL_TYPE_ITEM_DIALOG (panel_item_dialog_get_type ()) G_DECLARE_FINAL_TYPE (PanelItemDialog, panel_item_dialog, PANEL, ITEM_DIALOG, XfceTitledDialog) -void panel_item_dialog_show (PanelWindow *active); +void +panel_item_dialog_show (PanelWindow *active); -void panel_item_dialog_show_from_id (gint panel_id); +void +panel_item_dialog_show_from_id (gint panel_id); -gboolean panel_item_dialog_visible (void); +gboolean +panel_item_dialog_visible (void); G_END_DECLS diff --git a/panel/panel-itembar.c b/panel/panel-itembar.c index 7b1f3b23c..4ffcb5ba4 100644 --- a/panel/panel-itembar.c +++ b/panel/panel-itembar.c @@ -30,7 +30,7 @@ #include "libxfce4panel/xfce-panel-plugin-provider.h" #define IS_HORIZONTAL(itembar) ((itembar)->mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) -#define HIGHLIGHT_SIZE 2 +#define HIGHLIGHT_SIZE 2 @@ -38,49 +38,64 @@ typedef struct _PanelItembarChild PanelItembarChild; -static void panel_itembar_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void panel_itembar_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void panel_itembar_finalize (GObject *object); -static void panel_itembar_get_preferred_length (GtkWidget *widget, - gint *minimum_length, - gint *natural_length); -static void panel_itembar_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static void panel_itembar_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height); -static void panel_itembar_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gboolean panel_itembar_draw (GtkWidget *widget, - cairo_t *cr); -static void panel_itembar_add (GtkContainer *container, - GtkWidget *child); -static void panel_itembar_remove (GtkContainer *container, - GtkWidget *child); -static void panel_itembar_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data); -static GType panel_itembar_child_type (GtkContainer *container); -static void panel_itembar_set_child_property (GtkContainer *container, - GtkWidget *widget, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void panel_itembar_get_child_property (GtkContainer *container, - GtkWidget *widget, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static PanelItembarChild *panel_itembar_get_child (PanelItembar *itembar, - GtkWidget *widget); +static void +panel_itembar_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +panel_itembar_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +panel_itembar_finalize (GObject *object); +static void +panel_itembar_get_preferred_length (GtkWidget *widget, + gint *minimum_length, + gint *natural_length); +static void +panel_itembar_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width); +static void +panel_itembar_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height); +static void +panel_itembar_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static gboolean +panel_itembar_draw (GtkWidget *widget, + cairo_t *cr); +static void +panel_itembar_add (GtkContainer *container, + GtkWidget *child); +static void +panel_itembar_remove (GtkContainer *container, + GtkWidget *child); +static void +panel_itembar_forall (GtkContainer *container, + gboolean include_internals, + GtkCallback callback, + gpointer callback_data); +static GType +panel_itembar_child_type (GtkContainer *container); +static void +panel_itembar_set_child_property (GtkContainer *container, + GtkWidget *widget, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +panel_itembar_get_child_property (GtkContainer *container, + GtkWidget *widget, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static PanelItembarChild * +panel_itembar_get_child (PanelItembar *itembar, + GtkWidget *widget); @@ -88,19 +103,19 @@ struct _PanelItembar { GtkContainer __parent__; - GSList *children; + GSList *children; /* some properties we clone from the panel window */ - XfcePanelPluginMode mode; - gint size; - gboolean dark_mode; - gint icon_size; - gint nrows; + XfcePanelPluginMode mode; + gint size; + gboolean dark_mode; + gint icon_size; + gint nrows; /* dnd support */ - gint highlight_index; - gint highlight_x, highlight_y, highlight_length; - gboolean highlight_small; + gint highlight_index; + gint highlight_x, highlight_y, highlight_length; + gboolean highlight_small; }; typedef enum @@ -109,14 +124,13 @@ typedef enum CHILD_OPTION_EXPAND, CHILD_OPTION_SHRINK, CHILD_OPTION_SMALL -} -ChildOptions; +} ChildOptions; struct _PanelItembarChild { - GtkWidget *widget; - ChildOptions option; - gint row; + GtkWidget *widget; + ChildOptions option; + gint row; }; enum @@ -156,8 +170,8 @@ G_DEFINE_FINAL_TYPE (PanelItembar, panel_itembar, GTK_TYPE_CONTAINER) static void panel_itembar_class_init (PanelItembarClass *klass) { - GObjectClass *gobject_class; - GtkWidgetClass *gtkwidget_class; + GObjectClass *gobject_class; + GtkWidgetClass *gtkwidget_class; GtkContainerClass *gtkcontainer_class; gobject_class = G_OBJECT_CLASS (klass); @@ -180,13 +194,12 @@ panel_itembar_class_init (PanelItembarClass *klass) gtkcontainer_class->set_child_property = panel_itembar_set_child_property; gtk_container_class_handle_border_width (gtkcontainer_class); - itembar_signals[CHANGED] = - g_signal_new (g_intern_static_string ("changed"), - G_TYPE_FROM_CLASS (gobject_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + itembar_signals[CHANGED] = g_signal_new (g_intern_static_string ("changed"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); g_object_class_install_property (gobject_class, PROP_MODE, @@ -236,7 +249,7 @@ panel_itembar_class_init (PanelItembarClass *klass) g_param_spec_boolean ("shrink", NULL, NULL, FALSE, - G_PARAM_READWRITE| G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); gtk_container_class_install_child_property (gtkcontainer_class, CHILD_PROP_SMALL, @@ -268,10 +281,10 @@ panel_itembar_init (PanelItembar *itembar) static void -panel_itembar_set_property (GObject *object, - guint prop_id, +panel_itembar_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { PanelItembar *itembar = PANEL_ITEMBAR (object); @@ -308,9 +321,9 @@ panel_itembar_set_property (GObject *object, static void -panel_itembar_get_property (GObject *object, - guint prop_id, - GValue *value, +panel_itembar_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { switch (prop_id) @@ -332,17 +345,17 @@ panel_itembar_finalize (GObject *object) } static void -panel_itembar_get_preferred_length (GtkWidget *widget, - gint *minimum_length, - gint *natural_length) +panel_itembar_get_preferred_length (GtkWidget *widget, + gint *minimum_length, + gint *natural_length) { - PanelItembar *itembar = PANEL_ITEMBAR (widget); - GSList *li; + PanelItembar *itembar = PANEL_ITEMBAR (widget); + GSList *li; PanelItembarChild *child; - gint row_max_size, row_max_size_min; - gint col_count; - gint total_len, total_len_min; - gint child_len, child_len_min; + gint row_max_size, row_max_size_min; + gint col_count; + gint total_len, total_len_min; + gint child_len, child_len_min; /* total length we request */ total_len = 0; @@ -420,11 +433,11 @@ panel_itembar_get_preferred_length (GtkWidget *widget, static void panel_itembar_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) + gint *minimum_width, + gint *natural_width) { - PanelItembar *itembar = PANEL_ITEMBAR (widget); - gint size; + PanelItembar *itembar = PANEL_ITEMBAR (widget); + gint size; if (IS_HORIZONTAL (itembar)) { @@ -446,11 +459,11 @@ panel_itembar_get_preferred_width (GtkWidget *widget, static void panel_itembar_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) + gint *minimum_height, + gint *natural_height) { - PanelItembar *itembar = PANEL_ITEMBAR (widget); - gint size; + PanelItembar *itembar = PANEL_ITEMBAR (widget); + gint size; if (IS_HORIZONTAL (itembar)) { @@ -471,28 +484,28 @@ panel_itembar_get_preferred_height (GtkWidget *widget, static void -panel_itembar_size_allocate (GtkWidget *widget, +panel_itembar_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - PanelItembar *itembar = PANEL_ITEMBAR (widget); - GSList *lp, *ltemp; + PanelItembar *itembar = PANEL_ITEMBAR (widget); + GSList *lp, *ltemp; PanelItembarChild *child; - GtkAllocation child_alloc; - gint expand_len_avail, expand_len_req; - gint shrink_len_avail, shrink_len_req; - gint itembar_len; - gint x, y; - gint x_init, y_init; - gboolean expand_children_fit; - gint new_len, sub_len; - gint child_len, child_len_min; - gint row_max_size; - gint col_count; - gint rows_size; - - #define CHILD_MIN_ALLOC_LEN(child_len) \ - if (G_UNLIKELY ((child_len) < 1)) \ - (child_len) = 1; + GtkAllocation child_alloc; + gint expand_len_avail, expand_len_req; + gint shrink_len_avail, shrink_len_req; + gint itembar_len; + gint x, y; + gint x_init, y_init; + gboolean expand_children_fit; + gint new_len, sub_len; + gint child_len, child_len_min; + gint row_max_size; + gint col_count; + gint rows_size; + +#define CHILD_MIN_ALLOC_LEN(child_len) \ + if (G_UNLIKELY ((child_len) < 1)) \ + (child_len) = 1; /* the maximum allocation is limited by that of the * panel window, so take over the assigned allocation */ @@ -610,9 +623,9 @@ panel_itembar_size_allocate (GtkWidget *widget, /* the highlight item for which we keep some spare space */ if (G_UNLIKELY (child == NULL)) { - ltemp = g_slist_next (lp); - itembar->highlight_small = (col_count > 0 && ltemp && ltemp->data && ((PanelItembarChild *)ltemp->data)->option == CHILD_OPTION_SMALL); + itembar->highlight_small = col_count > 0 && ltemp != NULL && ltemp->data != NULL + && ((PanelItembarChild *) ltemp->data)->option == CHILD_OPTION_SMALL; if (itembar->highlight_small) { @@ -722,20 +735,20 @@ panel_itembar_size_allocate (GtkWidget *widget, if (++col_count >= itembar->nrows) { #define RESET_COLUMN_COUNTERS \ - /* update coordinates */ \ - if (IS_HORIZONTAL (itembar)) \ - { \ - x += row_max_size; \ - y = y_init; \ - } \ - else \ - { \ - y += row_max_size; \ - x = x_init; \ - } \ - \ - col_count = 0; \ - row_max_size = 0; + /* update coordinates */ \ + if (IS_HORIZONTAL (itembar)) \ + { \ + x += row_max_size; \ + y = y_init; \ + } \ + else \ + { \ + y += row_max_size; \ + x = x_init; \ + } \ +\ + col_count = 0; \ + row_max_size = 0; RESET_COLUMN_COUNTERS } @@ -777,12 +790,12 @@ panel_itembar_size_allocate (GtkWidget *widget, static gboolean panel_itembar_draw (GtkWidget *widget, - cairo_t *cr) + cairo_t *cr) { PanelItembar *itembar = PANEL_ITEMBAR (widget); - gboolean result; - GdkRectangle rect; - gint row_size; + gboolean result; + GdkRectangle rect; + gint row_size; result = (*GTK_WIDGET_CLASS (panel_itembar_parent_class)->draw) (widget, cr); @@ -793,18 +806,16 @@ panel_itembar_draw (GtkWidget *widget, rect.x = itembar->highlight_x; rect.y = itembar->highlight_y; - if ((IS_HORIZONTAL (itembar) && !itembar->highlight_small) || - (!IS_HORIZONTAL (itembar) && itembar->highlight_small)) + if ((IS_HORIZONTAL (itembar) && !itembar->highlight_small) + || (!IS_HORIZONTAL (itembar) && itembar->highlight_small)) { rect.width = HIGHLIGHT_SIZE; - rect.height = (itembar->highlight_length != -1) ? - itembar->highlight_length : row_size; + rect.height = (itembar->highlight_length != -1) ? itembar->highlight_length : row_size; } else { rect.height = HIGHLIGHT_SIZE; - rect.width = (itembar->highlight_length != -1) ? - itembar->highlight_length : row_size; + rect.width = (itembar->highlight_length != -1) ? itembar->highlight_length : row_size; } /* draw highlight box */ @@ -821,7 +832,7 @@ panel_itembar_draw (GtkWidget *widget, static void panel_itembar_add (GtkContainer *container, - GtkWidget *child) + GtkWidget *child) { panel_itembar_insert (PANEL_ITEMBAR (container), child, -1); } @@ -835,8 +846,8 @@ static gboolean panel_itembar_unref (gpointer data) { XfcePanelPluginProvider **provider = data; - gint n = 0, id; - gchar *name; + gint n = 0, id; + gchar *name; /* should always be true if there were no memory leak, except in the case below */ if (*provider == NULL) @@ -870,10 +881,10 @@ panel_itembar_unref (gpointer data) static void panel_itembar_remove (GtkContainer *container, - GtkWidget *widget) + GtkWidget *widget) { PanelItembarChild *child; - PanelItembar *itembar = PANEL_ITEMBAR (container); + PanelItembar *itembar = PANEL_ITEMBAR (container); static GtkWidget *swidget; @@ -905,12 +916,12 @@ panel_itembar_remove (GtkContainer *container, static void panel_itembar_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data) + gboolean include_internals, + GtkCallback callback, + gpointer callback_data) { - PanelItembar *itembar = PANEL_ITEMBAR (container); - GSList *children = itembar->children; + PanelItembar *itembar = PANEL_ITEMBAR (container); + GSList *children = itembar->children; PanelItembarChild *child; panel_return_if_fail (PANEL_IS_ITEMBAR (container)); @@ -921,7 +932,7 @@ panel_itembar_forall (GtkContainer *container, children = g_slist_next (children); if (G_LIKELY (child != NULL)) - (* callback) (child->widget, callback_data); + (*callback) (child->widget, callback_data); } } @@ -937,14 +948,14 @@ panel_itembar_child_type (GtkContainer *container) static void panel_itembar_set_child_property (GtkContainer *container, - GtkWidget *widget, - guint prop_id, + GtkWidget *widget, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { PanelItembarChild *child; - gboolean enable; - ChildOptions option; + gboolean enable; + ChildOptions option; child = panel_itembar_get_child (PANEL_ITEMBAR (container), widget); if (G_UNLIKELY (child == NULL)) @@ -989,10 +1000,10 @@ panel_itembar_set_child_property (GtkContainer *container, static void panel_itembar_get_child_property (GtkContainer *container, - GtkWidget *widget, - guint prop_id, - GValue *value, - GParamSpec *pspec) + GtkWidget *widget, + guint prop_id, + GValue *value, + GParamSpec *pspec) { PanelItembarChild *child; @@ -1024,9 +1035,9 @@ panel_itembar_get_child_property (GtkContainer *container, static PanelItembarChild * panel_itembar_get_child (PanelItembar *itembar, - GtkWidget *widget) + GtkWidget *widget) { - GSList *li; + GSList *li; PanelItembarChild *child; panel_return_val_if_fail (PANEL_IS_ITEMBAR (itembar), NULL); @@ -1056,8 +1067,8 @@ panel_itembar_new (void) void panel_itembar_insert (PanelItembar *itembar, - GtkWidget *widget, - gint position) + GtkWidget *widget, + gint position) { PanelItembarChild *child; @@ -1080,8 +1091,8 @@ panel_itembar_insert (PanelItembar *itembar, void panel_itembar_reorder_child (PanelItembar *itembar, - GtkWidget *widget, - gint position) + GtkWidget *widget, + gint position) { PanelItembarChild *child; @@ -1105,11 +1116,11 @@ panel_itembar_reorder_child (PanelItembar *itembar, gint panel_itembar_get_child_index (PanelItembar *itembar, - GtkWidget *widget) + GtkWidget *widget) { - GSList *li; + GSList *li; PanelItembarChild *child; - gint idx; + gint idx; panel_return_val_if_fail (PANEL_IS_ITEMBAR (itembar), -1); panel_return_val_if_fail (GTK_IS_WIDGET (widget), -1); @@ -1148,15 +1159,15 @@ panel_itembar_get_n_children (PanelItembar *itembar) guint panel_itembar_get_drop_index (PanelItembar *itembar, - gint x, - gint y) + gint x, + gint y) { PanelItembarChild *child, *child2; - GSList *li, *li2; - GtkAllocation alloc; - guint idx, col_start_idx, col_end_idx; - gint xr, yr, col_width; - gdouble aspect; + GSList *li, *li2; + GtkAllocation alloc; + guint idx, col_start_idx, col_end_idx; + gint xr, yr, col_width; + gdouble aspect; panel_return_val_if_fail (PANEL_IS_ITEMBAR (itembar), 0); @@ -1170,8 +1181,7 @@ panel_itembar_get_drop_index (PanelItembar *itembar, } /* return -1 if point is outside the widget allocation */ - if (x < alloc.x || y < alloc.y || - x >= alloc.x + alloc.width || y >= alloc.y + alloc.height) + if (x < alloc.x || y < alloc.y || x >= alloc.x + alloc.width || y >= alloc.y + alloc.height) return g_slist_length (itembar->children); col_width = -1; @@ -1227,26 +1237,26 @@ panel_itembar_get_drop_index (PanelItembar *itembar, aspect = 1.0; /* before current column */ - if (xr < 0 || - (xr < (gint) round (yr * aspect) && - xr < (gint) round ((alloc.height - yr) * aspect))) + if (xr < 0 + || (xr < round (yr * aspect) + && xr < round ((alloc.height - yr) * aspect))) { idx = col_start_idx; break; } /* before current child */ - if (xr < col_width && - xr >= (gint) round (yr * aspect) && - col_width - xr >= (gint) round (yr * aspect)) + if (xr < col_width + && xr >= round (yr * aspect) + && col_width - xr >= round (yr * aspect)) { if (child->row != 0) itembar->highlight_length = col_width; break; } /* after current column */ - if (xr < col_width && - xr >= (gint) round ((alloc.height - yr) * aspect) && - xr >= (gint) round (yr * aspect)) + if (xr < col_width + && xr >= round ((alloc.height - yr) * aspect) + && xr >= round (yr * aspect)) { idx = col_end_idx; break; @@ -1267,7 +1277,7 @@ panel_itembar_get_drop_index (PanelItembar *itembar, void panel_itembar_set_drop_highlight_item (PanelItembar *itembar, - gint idx) + gint idx) { panel_return_if_fail (PANEL_IS_ITEMBAR (itembar)); diff --git a/panel/panel-itembar.h b/panel/panel-itembar.h index d5b0c3f0e..c1dc42515 100644 --- a/panel/panel-itembar.h +++ b/panel/panel-itembar.h @@ -26,27 +26,34 @@ G_BEGIN_DECLS #define PANEL_TYPE_ITEMBAR (panel_itembar_get_type ()) G_DECLARE_FINAL_TYPE (PanelItembar, panel_itembar, PANEL, ITEMBAR, GtkContainer) -GtkWidget *panel_itembar_new (void) G_GNUC_MALLOC; - -void panel_itembar_insert (PanelItembar *itembar, - GtkWidget *widget, - gint position); - -void panel_itembar_reorder_child (PanelItembar *itembar, - GtkWidget *widget, - gint position); - -gint panel_itembar_get_child_index (PanelItembar *itembar, - GtkWidget *widget); - -guint panel_itembar_get_n_children (PanelItembar *itembar); - -guint panel_itembar_get_drop_index (PanelItembar *itembar, - gint x, - gint y); - -void panel_itembar_set_drop_highlight_item (PanelItembar *itembar, - gint idx); +GtkWidget * +panel_itembar_new (void) G_GNUC_MALLOC; + +void +panel_itembar_insert (PanelItembar *itembar, + GtkWidget *widget, + gint position); + +void +panel_itembar_reorder_child (PanelItembar *itembar, + GtkWidget *widget, + gint position); + +gint +panel_itembar_get_child_index (PanelItembar *itembar, + GtkWidget *widget); + +guint +panel_itembar_get_n_children (PanelItembar *itembar); + +guint +panel_itembar_get_drop_index (PanelItembar *itembar, + gint x, + gint y); + +void +panel_itembar_set_drop_highlight_item (PanelItembar *itembar, + gint idx); G_END_DECLS diff --git a/panel/panel-module-factory.c b/panel/panel-module-factory.c index 553ec6428..d89d97a8f 100644 --- a/panel/panel-module-factory.c +++ b/panel/panel-module-factory.c @@ -30,13 +30,17 @@ -static void panel_module_factory_finalize (GObject *object); -static void panel_module_factory_load_modules (PanelModuleFactory *factory); -static gboolean panel_module_factory_modules_cleanup (gpointer key, - gpointer value, - gpointer user_data); -static void panel_module_factory_remove_plugin (gpointer user_data, - GObject *where_the_object_was); +static void +panel_module_factory_finalize (GObject *object); +static void +panel_module_factory_load_modules (PanelModuleFactory *factory); +static gboolean +panel_module_factory_modules_cleanup (gpointer key, + gpointer value, + gpointer user_data); +static void +panel_module_factory_remove_plugin (gpointer user_data, + GObject *where_the_object_was); @@ -48,16 +52,16 @@ enum struct _PanelModuleFactory { - GObject __parent__; + GObject __parent__; /* relation for name -> PanelModule */ GHashTable *modules; /* all plugins in all windows */ - GSList *plugins; + GSList *plugins; /* if the factory contains the launcher plugin */ - guint has_launcher : 1; + guint has_launcher : 1; }; @@ -82,13 +86,12 @@ panel_module_factory_class_init (PanelModuleFactoryClass *klass) /** * Emitted when the unique status of one of the modules changed. **/ - factory_signals[UNIQUE_CHANGED] = - g_signal_new (g_intern_static_string ("unique-changed"), - G_TYPE_FROM_CLASS (gobject_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, PANEL_TYPE_MODULE); + factory_signals[UNIQUE_CHANGED] = g_signal_new (g_intern_static_string ("unique-changed"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, PANEL_TYPE_MODULE); } @@ -121,14 +124,14 @@ panel_module_factory_finalize (GObject *object) static void panel_module_factory_load_modules_dir (PanelModuleFactory *factory, - const gchar *datadir, - const gchar *libdir) + const gchar *datadir, + const gchar *libdir) { - GDir *dir; + GDir *dir; const gchar *name, *p; - gchar *filename; + gchar *filename; PanelModule *module; - gchar *internal_name; + gchar *internal_name; /* try to open the directory */ dir = g_dir_open (datadir, 0, NULL); @@ -180,7 +183,7 @@ panel_module_factory_load_modules_dir (PanelModuleFactory *factory, } else { - exists: +exists: g_free (internal_name); } @@ -279,8 +282,8 @@ panel_module_factory_modules_cleanup (gpointer key, gpointer user_data) { PanelModuleFactory *factory = PANEL_MODULE_FACTORY (user_data); - PanelModule *module = PANEL_MODULE (value); - gboolean remove_from_table; + PanelModule *module = PANEL_MODULE (value); + gboolean remove_from_table; panel_return_val_if_fail (PANEL_IS_MODULE (module), TRUE); panel_return_val_if_fail (PANEL_IS_MODULE_FACTORY (factory), TRUE); @@ -290,8 +293,7 @@ panel_module_factory_modules_cleanup (gpointer key, /* if we're going to remove this item, check if it is the launcher */ if (remove_from_table - && g_strcmp0 (LAUNCHER_PLUGIN_NAME, - panel_module_get_name (module)) == 0) + && g_strcmp0 (LAUNCHER_PLUGIN_NAME, panel_module_get_name (module)) == 0) factory->has_launcher = FALSE; return remove_from_table; @@ -300,8 +302,8 @@ panel_module_factory_modules_cleanup (gpointer key, static void -panel_module_factory_remove_plugin (gpointer user_data, - GObject *where_the_object_was) +panel_module_factory_remove_plugin (gpointer user_data, + GObject *where_the_object_was) { PanelModuleFactory *factory = PANEL_MODULE_FACTORY (user_data); @@ -313,13 +315,12 @@ panel_module_factory_remove_plugin (gpointer user_data, static inline gboolean panel_module_factory_unique_id_exists (PanelModuleFactory *factory, - gint unique_id) + gint unique_id) { GSList *li; for (li = factory->plugins; li != NULL; li = li->next) - if (xfce_panel_plugin_provider_get_unique_id ( - XFCE_PANEL_PLUGIN_PROVIDER (li->data)) == unique_id) + if (xfce_panel_plugin_provider_get_unique_id (li->data) == unique_id) return TRUE; return FALSE; @@ -381,7 +382,6 @@ panel_module_factory_emit_unique_changed (PanelModule *module) factory = panel_module_factory_get (); g_signal_emit (G_OBJECT (factory), factory_signals[UNIQUE_CHANGED], 0, module); g_object_unref (G_OBJECT (factory)); - } @@ -395,8 +395,7 @@ panel_module_factory_get_modules (PanelModuleFactory *factory) panel_module_factory_load_modules (factory); /* remove modules that are not found on the harddisk */ - g_hash_table_foreach_remove (factory->modules, - panel_module_factory_modules_cleanup, factory); + g_hash_table_foreach_remove (factory->modules, panel_module_factory_modules_cleanup, factory); return g_hash_table_get_values (factory->modules); } @@ -405,7 +404,7 @@ panel_module_factory_get_modules (PanelModuleFactory *factory) gboolean panel_module_factory_has_module (PanelModuleFactory *factory, - const gchar *name) + const gchar *name) { panel_return_val_if_fail (PANEL_IS_MODULE_FACTORY (factory), FALSE); panel_return_val_if_fail (name != NULL, FALSE); @@ -417,10 +416,10 @@ panel_module_factory_has_module (PanelModuleFactory *factory, GSList * panel_module_factory_get_plugins (PanelModuleFactory *factory, - const gchar *plugin_name) + const gchar *plugin_name) { GSList *li, *plugins = NULL; - gchar *unique_name; + gchar *unique_name; panel_return_val_if_fail (PANEL_IS_MODULE_FACTORY (factory), NULL); panel_return_val_if_fail (plugin_name != NULL, NULL); @@ -452,16 +451,16 @@ panel_module_factory_get_plugins (PanelModuleFactory *factory, GtkWidget * -panel_module_factory_new_plugin (PanelModuleFactory *factory, - const gchar *name, - GdkScreen *screen, - gint unique_id, - gchar **arguments, - gint *return_unique_id) +panel_module_factory_new_plugin (PanelModuleFactory *factory, + const gchar *name, + GdkScreen *screen, + gint unique_id, + gchar **arguments, + gint *return_unique_id) { PanelModule *module; - GtkWidget *provider; - static gint unique_id_counter = 0; + GtkWidget *provider; + static gint unique_id_counter = 0; panel_return_val_if_fail (PANEL_IS_MODULE_FACTORY (factory), NULL); panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); diff --git a/panel/panel-module-factory.h b/panel/panel-module-factory.h index 2a1619b51..ecfb18031 100644 --- a/panel/panel-module-factory.h +++ b/panel/panel-module-factory.h @@ -31,31 +31,39 @@ G_BEGIN_DECLS #define PANEL_TYPE_MODULE_FACTORY (panel_module_factory_get_type ()) G_DECLARE_FINAL_TYPE (PanelModuleFactory, panel_module_factory, PANEL, MODULE_FACTORY, GObject) -#define LAUNCHER_PLUGIN_NAME "launcher" +#define LAUNCHER_PLUGIN_NAME "launcher" #define SEPARATOR_PLUGIN_NAME "separator" -PanelModuleFactory *panel_module_factory_get (void); +PanelModuleFactory * +panel_module_factory_get (void); -void panel_module_factory_force_run_mode (PanelModuleRunMode mode); +void +panel_module_factory_force_run_mode (PanelModuleRunMode mode); -gboolean panel_module_factory_has_launcher (PanelModuleFactory *factory); +gboolean +panel_module_factory_has_launcher (PanelModuleFactory *factory); -void panel_module_factory_emit_unique_changed (PanelModule *module); +void +panel_module_factory_emit_unique_changed (PanelModule *module); -GList *panel_module_factory_get_modules (PanelModuleFactory *factory); +GList * +panel_module_factory_get_modules (PanelModuleFactory *factory); -gboolean panel_module_factory_has_module (PanelModuleFactory *factory, - const gchar *name); +gboolean +panel_module_factory_has_module (PanelModuleFactory *factory, + const gchar *name); -GSList *panel_module_factory_get_plugins (PanelModuleFactory *factory, - const gchar *plugin_name); +GSList * +panel_module_factory_get_plugins (PanelModuleFactory *factory, + const gchar *plugin_name); -GtkWidget *panel_module_factory_new_plugin (PanelModuleFactory *factory, - const gchar *name, - GdkScreen *screen, - gint unique_id, - gchar **arguments, - gint *return_unique_id) G_GNUC_MALLOC; +GtkWidget * +panel_module_factory_new_plugin (PanelModuleFactory *factory, + const gchar *name, + GdkScreen *screen, + gint unique_id, + gchar **arguments, + gint *return_unique_id) G_GNUC_MALLOC; G_END_DECLS diff --git a/panel/panel-module.c b/panel/panel-module.c index 8958c0510..8aad3449b 100644 --- a/panel/panel-module.c +++ b/panel/panel-module.c @@ -39,15 +39,19 @@ -typedef enum _PanelModuleUnique PanelModuleUnique; +typedef enum _PanelModuleUnique PanelModuleUnique; -static void panel_module_dispose (GObject *object); -static gboolean panel_module_load (GTypeModule *type_module); -static void panel_module_unload (GTypeModule *type_module); -static void panel_module_plugin_destroyed (gpointer user_data, - GObject *where_the_plugin_was); +static void +panel_module_dispose (GObject *object); +static gboolean +panel_module_load (GTypeModule *type_module); +static void +panel_module_unload (GTypeModule *type_module); +static void +panel_module_plugin_destroyed (gpointer user_data, + GObject *where_the_plugin_was); @@ -63,31 +67,31 @@ struct _PanelModule GTypeModule __parent__; /* module type */ - PanelModuleRunMode mode; + PanelModuleRunMode mode; /* filename of the library */ - gchar *filename; + gchar *filename; /* plugin information from the desktop file */ - gchar *display_name; - gchar *comment; - gchar *icon_name; + gchar *display_name; + gchar *comment; + gchar *icon_name; /* unique handling */ - guint use_count; - PanelModuleUnique unique_mode; + guint use_count; + PanelModuleUnique unique_mode; /* module location */ - GModule *library; + GModule *library; /* for non-gobject plugin */ - PluginConstructFunc construct_func; + PluginConstructFunc construct_func; /* for gobject plugins */ - GType plugin_type; + GType plugin_type; /* for wrapper plugins */ - gchar *api; + gchar *api; }; @@ -103,7 +107,7 @@ G_DEFINE_FINAL_TYPE (PanelModule, panel_module, G_TYPE_TYPE_MODULE) static void panel_module_class_init (PanelModuleClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; GTypeModuleClass *gtype_module_class; gobject_class = G_OBJECT_CLASS (klass); @@ -165,10 +169,10 @@ panel_module_dispose (GObject *object) static gboolean panel_module_load (GTypeModule *type_module) { - PanelModule *module = PANEL_MODULE (type_module); - PluginInitFunc init_func; - gboolean make_resident = TRUE; - gpointer foo; + PanelModule *module = PANEL_MODULE (type_module); + PluginInitFunc init_func; + gboolean make_resident = TRUE; + gpointer foo; panel_return_val_if_fail (PANEL_IS_MODULE (module), FALSE); panel_return_val_if_fail (G_IS_TYPE_MODULE (module), FALSE); @@ -187,14 +191,15 @@ panel_module_load (GTypeModule *type_module) return FALSE; } - /* check if there is a preinit function */ + /* check if there is a preinit function */ if (g_module_symbol (module->library, "xfce_panel_module_preinit", &foo)) { /* large message, but technically never shown to normal users */ g_warning ("The plugin \"%s\" is marked as internal in the desktop file, " "but the developer has defined an pre-init function, which is " "not supported for internal plugins. " PACKAGE_NAME " will force " - "the plugin to run external.", module->filename); + "the plugin to run external.", + module->filename); panel_module_unload (type_module); @@ -255,8 +260,8 @@ panel_module_unload (GTypeModule *type_module) static void -panel_module_plugin_destroyed (gpointer user_data, - GObject *where_the_plugin_was) +panel_module_plugin_destroyed (gpointer user_data, + GObject *where_the_plugin_was) { PanelModule *module = PANEL_MODULE (user_data); @@ -285,11 +290,11 @@ panel_module_new_from_desktop_file (const gchar *filename, PanelModuleRunMode forced_mode) { PanelModule *module = NULL; - XfceRc *rc; + XfceRc *rc; const gchar *module_name; - gchar *path; + gchar *path; const gchar *module_unique; - gboolean found; + gboolean found; panel_return_val_if_fail (!xfce_str_is_empty (filename), NULL); panel_return_val_if_fail (!xfce_str_is_empty (name), NULL); @@ -304,8 +309,8 @@ panel_module_new_from_desktop_file (const gchar *filename, if (!xfce_rc_has_group (rc, "Xfce Panel")) { - g_critical ("Plugin %s: Desktop file \"%s\" has no " - "\"Xfce Panel\" group", name, filename); + g_critical ("Plugin %s: Desktop file \"%s\" has no \"Xfce Panel\" group", + name, filename); xfce_rc_close (rc); return NULL; } @@ -313,7 +318,8 @@ panel_module_new_from_desktop_file (const gchar *filename, if (g_strcmp0 (xfce_rc_read_entry (rc, "X-XFCE-API", "1.0"), "2.0") != 0) { g_critical ("Plugin %s: The Desktop file %s requested the Gtk2 API (v1.0), which is " - "no longer supported.", name, filename); + "no longer supported.", + name, filename); xfce_rc_close (rc); return NULL; } @@ -378,9 +384,9 @@ panel_module_new_from_desktop_file (const gchar *filename, else module->unique_mode = UNIQUE_FALSE; - panel_debug_filtered (PANEL_DEBUG_MODULE, "new module %s, filename=%s, internal=%s", - name, module->filename, - PANEL_DEBUG_BOOL (module->mode == PANEL_MODULE_RUN_MODE_INTERNAL)); + panel_debug_filtered (PANEL_DEBUG_MODULE, "new module %s, filename=%s, internal=%s", + name, module->filename, + PANEL_DEBUG_BOOL (module->mode == PANEL_MODULE_RUN_MODE_INTERNAL)); } xfce_rc_close (rc); @@ -391,12 +397,12 @@ panel_module_new_from_desktop_file (const gchar *filename, GtkWidget * -panel_module_new_plugin (PanelModule *module, - GdkScreen *screen, - gint unique_id, - gchar **arguments) +panel_module_new_plugin (PanelModule *module, + GdkScreen *screen, + gint unique_id, + gchar **arguments) { - GtkWidget *plugin = NULL; + GtkWidget *plugin = NULL; const gchar *debug_type = NULL; panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL); @@ -467,11 +473,10 @@ panel_module_new_plugin (PanelModule *module, module->use_count++; panel_debug (PANEL_DEBUG_MODULE, "new item (type=%s, name=%s, id=%d)", - debug_type, panel_module_get_name (module), unique_id); + debug_type, panel_module_get_name (module), unique_id); /* handle module use count and unloading */ - g_object_weak_ref (G_OBJECT (plugin), - panel_module_plugin_destroyed, module); + g_object_weak_ref (G_OBJECT (plugin), panel_module_plugin_destroyed, module); /* add link to the module */ g_object_set_qdata (G_OBJECT (plugin), module_quark, module); @@ -510,7 +515,8 @@ panel_module_get_display_name (PanelModule *module) panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL); panel_return_val_if_fail (G_IS_TYPE_MODULE (module), NULL); panel_return_val_if_fail (module->display_name == NULL - || g_utf8_validate (module->display_name, -1, NULL), NULL); + || g_utf8_validate (module->display_name, -1, NULL), + NULL); return module->display_name; } @@ -522,7 +528,8 @@ panel_module_get_comment (PanelModule *module) { panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL); panel_return_val_if_fail (module->comment == NULL - || g_utf8_validate (module->comment, -1, NULL), NULL); + || g_utf8_validate (module->comment, -1, NULL), + NULL); return module->comment; } @@ -534,7 +541,8 @@ panel_module_get_icon_name (PanelModule *module) { panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL); panel_return_val_if_fail (module->icon_name == NULL - || g_utf8_validate (module->icon_name, -1, NULL), NULL); + || g_utf8_validate (module->icon_name, -1, NULL), + NULL); return module->icon_name; } @@ -585,11 +593,11 @@ panel_module_is_unique (PanelModule *module) gboolean panel_module_is_usable (PanelModule *module, - GdkScreen *screen) + GdkScreen *screen) { PanelModuleFactory *factory; - GSList *plugins, *li; - gboolean usable = TRUE; + GSList *plugins, *li; + gboolean usable = TRUE; panel_return_val_if_fail (PANEL_IS_MODULE (module), FALSE); panel_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); diff --git a/panel/panel-module.h b/panel/panel-module.h index e656c1b87..387b645d0 100644 --- a/panel/panel-module.h +++ b/panel/panel-module.h @@ -31,44 +31,56 @@ G_DECLARE_FINAL_TYPE (PanelModule, panel_module, PANEL, MODULE, GTypeModule) typedef enum { - PANEL_MODULE_RUN_MODE_NONE, /* unset */ + PANEL_MODULE_RUN_MODE_NONE, /* unset */ PANEL_MODULE_RUN_MODE_INTERNAL, /* plugin library will be loaded in the panel */ - PANEL_MODULE_RUN_MODE_EXTERNAL /* plugin library will be loaded in the wrapper - * with communication through PanelPluginExternal */ + PANEL_MODULE_RUN_MODE_EXTERNAL /* plugin library will be loaded in the wrapper + * with communication through PanelPluginExternal */ } PanelModuleRunMode; -PanelModule *panel_module_new_from_desktop_file (const gchar *filename, - const gchar *name, - const gchar *lib_dir, - PanelModuleRunMode forced_mode) G_GNUC_MALLOC; +PanelModule * +panel_module_new_from_desktop_file (const gchar *filename, + const gchar *name, + const gchar *lib_dir, + PanelModuleRunMode forced_mode) G_GNUC_MALLOC; -GtkWidget *panel_module_new_plugin (PanelModule *module, - GdkScreen *screen, - gint unique_id, - gchar **arguments) G_GNUC_MALLOC; +GtkWidget * +panel_module_new_plugin (PanelModule *module, + GdkScreen *screen, + gint unique_id, + gchar **arguments) G_GNUC_MALLOC; -const gchar *panel_module_get_name (PanelModule *module) G_GNUC_PURE; +const gchar * +panel_module_get_name (PanelModule *module) G_GNUC_PURE; -const gchar *panel_module_get_filename (PanelModule *module) G_GNUC_PURE; +const gchar * +panel_module_get_filename (PanelModule *module) G_GNUC_PURE; -const gchar *panel_module_get_display_name (PanelModule *module) G_GNUC_PURE; +const gchar * +panel_module_get_display_name (PanelModule *module) G_GNUC_PURE; -const gchar *panel_module_get_comment (PanelModule *module) G_GNUC_PURE; +const gchar * +panel_module_get_comment (PanelModule *module) G_GNUC_PURE; -const gchar *panel_module_get_icon_name (PanelModule *module) G_GNUC_PURE; +const gchar * +panel_module_get_icon_name (PanelModule *module) G_GNUC_PURE; -const gchar *panel_module_get_api (PanelModule *module) G_GNUC_PURE; +const gchar * +panel_module_get_api (PanelModule *module) G_GNUC_PURE; -PanelModule *panel_module_get_from_plugin_provider (XfcePanelPluginProvider *provider); +PanelModule * +panel_module_get_from_plugin_provider (XfcePanelPluginProvider *provider); -gboolean panel_module_is_valid (PanelModule *module); +gboolean +panel_module_is_valid (PanelModule *module); -gboolean panel_module_is_unique (PanelModule *module) G_GNUC_PURE; +gboolean +panel_module_is_unique (PanelModule *module) G_GNUC_PURE; -gboolean panel_module_is_usable (PanelModule *module, - GdkScreen *screen); +gboolean +panel_module_is_usable (PanelModule *module, + GdkScreen *screen); G_END_DECLS diff --git a/panel/panel-plugin-external-wrapper-wayland.c b/panel/panel-plugin-external-wrapper-wayland.c index 5c0624b2d..ba898a243 100644 --- a/panel/panel-plugin-external-wrapper-wayland.c +++ b/panel/panel-plugin-external-wrapper-wayland.c @@ -31,43 +31,56 @@ -static void panel_plugin_external_wrapper_wayland_constructed (GObject *object); -static void panel_plugin_external_wrapper_wayland_finalize (GObject *object); -static void panel_plugin_external_wrapper_wayland_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gchar **panel_plugin_external_wrapper_wayland_get_argv (PanelPluginExternal *external, - gchar **arguments); -static gboolean panel_plugin_external_wrapper_wayland_spawn (PanelPluginExternal *external, - gchar **argv, - GPid *pid, - GError **error); -static void panel_plugin_external_wrapper_wayland_set_background_color (PanelPluginExternal *external, - const GdkRGBA *color); -static void panel_plugin_external_wrapper_wayland_set_background_image (PanelPluginExternal *external, - const gchar *image); -static void panel_plugin_external_wrapper_wayland_set_geometry (PanelPluginExternal *external, - PanelWindow *window); -static void panel_plugin_external_wrapper_wayland_proxy_set_requisition (GDBusProxy *proxy, - gchar *sender_name, - gchar *signal_name, - GVariant *parameters, - PanelPluginExternalWrapperWayland *wrapper); -static void panel_plugin_external_wrapper_wayland_proxy_embedded (GDBusProxy *proxy, - gchar *sender_name, - gchar *signal_name, - GVariant *parameters, - PanelPluginExternalWrapperWayland *wrapper); -static void panel_plugin_external_wrapper_wayland_proxy_pointer_enter (GDBusProxy *proxy, - gchar *sender_name, - gchar *signal_name, - GVariant *parameters, - PanelPluginExternalWrapperWayland *wrapper); -static void panel_plugin_external_wrapper_wayland_proxy_pointer_leave (GDBusProxy *proxy, - gchar *sender_name, - gchar *signal_name, - GVariant *parameters, - PanelPluginExternalWrapperWayland *wrapper); -static gboolean panel_plugin_external_wrapper_wayland_pointer_is_outside (PanelPluginExternal *external); +static void +panel_plugin_external_wrapper_wayland_constructed (GObject *object); +static void +panel_plugin_external_wrapper_wayland_finalize (GObject *object); +static void +panel_plugin_external_wrapper_wayland_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static gchar ** +panel_plugin_external_wrapper_wayland_get_argv (PanelPluginExternal *external, + gchar **arguments); +static gboolean +panel_plugin_external_wrapper_wayland_spawn (PanelPluginExternal *external, + gchar **argv, + GPid *pid, + GError **error); +static void +panel_plugin_external_wrapper_wayland_set_background_color (PanelPluginExternal *external, + const GdkRGBA *color); +static void +panel_plugin_external_wrapper_wayland_set_background_image (PanelPluginExternal *external, + const gchar *image); +static void +panel_plugin_external_wrapper_wayland_set_geometry (PanelPluginExternal *external, + PanelWindow *window); +static void +panel_plugin_external_wrapper_wayland_proxy_set_requisition (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + PanelPluginExternalWrapperWayland *wrapper); +static void +panel_plugin_external_wrapper_wayland_proxy_embedded (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + PanelPluginExternalWrapperWayland *wrapper); +static void +panel_plugin_external_wrapper_wayland_proxy_pointer_enter (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + PanelPluginExternalWrapperWayland *wrapper); +static void +panel_plugin_external_wrapper_wayland_proxy_pointer_leave (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + PanelPluginExternalWrapperWayland *wrapper); +static gboolean +panel_plugin_external_wrapper_wayland_pointer_is_outside (PanelPluginExternal *external); diff --git a/panel/panel-plugin-external-wrapper-x11.c b/panel/panel-plugin-external-wrapper-x11.c index 7470aff9f..944ce6206 100644 --- a/panel/panel-plugin-external-wrapper-x11.c +++ b/panel/panel-plugin-external-wrapper-x11.c @@ -28,25 +28,34 @@ -static void panel_plugin_external_wrapper_x11_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gchar **panel_plugin_external_wrapper_x11_get_argv (PanelPluginExternal *external, - gchar **arguments); -static gboolean panel_plugin_external_wrapper_x11_spawn (PanelPluginExternal *external, - gchar **argv, - GPid *pid, - GError **error); -static void panel_plugin_external_wrapper_x11_set_background_color (PanelPluginExternal *external, - const GdkRGBA *color); -static void panel_plugin_external_wrapper_x11_set_background_image (PanelPluginExternal *external, - const gchar *image); -static void panel_plugin_external_wrapper_x11_set_geometry (PanelPluginExternal *external, - PanelWindow *window); -static gboolean panel_plugin_external_wrapper_x11_pointer_is_outside (PanelPluginExternal *external); -static void panel_plugin_external_wrapper_x11_socket_plug_added (GtkSocket *socket, - PanelPluginExternalWrapperX11 *wrapper); -static gboolean panel_plugin_external_wrapper_x11_socket_plug_removed (GtkSocket *socket, - PanelPluginExternalWrapperX11 *wrapper); +static void +panel_plugin_external_wrapper_x11_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static gchar ** +panel_plugin_external_wrapper_x11_get_argv (PanelPluginExternal *external, + gchar **arguments); +static gboolean +panel_plugin_external_wrapper_x11_spawn (PanelPluginExternal *external, + gchar **argv, + GPid *pid, + GError **error); +static void +panel_plugin_external_wrapper_x11_set_background_color (PanelPluginExternal *external, + const GdkRGBA *color); +static void +panel_plugin_external_wrapper_x11_set_background_image (PanelPluginExternal *external, + const gchar *image); +static void +panel_plugin_external_wrapper_x11_set_geometry (PanelPluginExternal *external, + PanelWindow *window); +static gboolean +panel_plugin_external_wrapper_x11_pointer_is_outside (PanelPluginExternal *external); +static void +panel_plugin_external_wrapper_x11_socket_plug_added (GtkSocket *socket, + PanelPluginExternalWrapperX11 *wrapper); +static gboolean +panel_plugin_external_wrapper_x11_socket_plug_removed (GtkSocket *socket, + PanelPluginExternalWrapperX11 *wrapper); @@ -133,8 +142,8 @@ static void panel_plugin_external_wrapper_x11_spawn_child_setup (gpointer data) { PanelPluginExternal *external = PANEL_PLUGIN_EXTERNAL (data); - GdkDisplay *display; - const gchar *name; + GdkDisplay *display; + const gchar *name; /* this is what gdk_spawn_on_screen does */ display = gtk_widget_get_display (GTK_WIDGET (external)); diff --git a/panel/panel-plugin-external-wrapper.c b/panel/panel-plugin-external-wrapper.c index 602425867..44230fc79 100644 --- a/panel/panel-plugin-external-wrapper.c +++ b/panel/panel-plugin-external-wrapper.c @@ -47,41 +47,52 @@ -#define get_instance_private(instance) ((PanelPluginExternalWrapperPrivate *) \ - panel_plugin_external_wrapper_get_instance_private (PANEL_PLUGIN_EXTERNAL_WRAPPER (instance))) - -static void panel_plugin_external_wrapper_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void panel_plugin_external_wrapper_constructed (GObject *object); -static void panel_plugin_external_wrapper_finalize (GObject *object); -static void panel_plugin_external_wrapper_set_properties (PanelPluginExternal *external, - GSList *properties); -static gchar **panel_plugin_external_wrapper_get_argv (PanelPluginExternal *external, - gchar **arguments); -static gboolean panel_plugin_external_wrapper_remote_event (PanelPluginExternal *external, - const gchar *name, - const GValue *value, - guint *handle); -static gboolean panel_plugin_external_wrapper_get_show_configure (PanelPluginExternal *external); -static gboolean panel_plugin_external_wrapper_get_show_about (PanelPluginExternal *external); -static gboolean panel_plugin_external_wrapper_dbus_provider_signal (XfcePanelPluginWrapperExported *skeleton, - GDBusMethodInvocation *invocation, - XfcePanelPluginProviderSignal provider_signal, - PanelPluginExternalWrapper *wrapper); -static gboolean panel_plugin_external_wrapper_dbus_remote_event_result (XfcePanelPluginWrapperExported *skeleton, - GDBusMethodInvocation *invocation, - guint handle, - gboolean result, - PanelPluginExternalWrapper *wrapper); +#define get_instance_private(instance) \ + ((PanelPluginExternalWrapperPrivate *) \ + panel_plugin_external_wrapper_get_instance_private (PANEL_PLUGIN_EXTERNAL_WRAPPER (instance))) + +static void +panel_plugin_external_wrapper_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +panel_plugin_external_wrapper_constructed (GObject *object); +static void +panel_plugin_external_wrapper_finalize (GObject *object); +static void +panel_plugin_external_wrapper_set_properties (PanelPluginExternal *external, + GSList *properties); +static gchar ** +panel_plugin_external_wrapper_get_argv (PanelPluginExternal *external, + gchar **arguments); +static gboolean +panel_plugin_external_wrapper_remote_event (PanelPluginExternal *external, + const gchar *name, + const GValue *value, + guint *handle); +static gboolean +panel_plugin_external_wrapper_get_show_configure (PanelPluginExternal *external); +static gboolean +panel_plugin_external_wrapper_get_show_about (PanelPluginExternal *external); +static gboolean +panel_plugin_external_wrapper_dbus_provider_signal (XfcePanelPluginWrapperExported *skeleton, + GDBusMethodInvocation *invocation, + XfcePanelPluginProviderSignal provider_signal, + PanelPluginExternalWrapper *wrapper); +static gboolean +panel_plugin_external_wrapper_dbus_remote_event_result (XfcePanelPluginWrapperExported *skeleton, + GDBusMethodInvocation *invocation, + guint handle, + gboolean result, + PanelPluginExternalWrapper *wrapper); typedef struct _PanelPluginExternalWrapperPrivate { XfcePanelPluginWrapperExported *skeleton; - GDBusConnection *connection; + GDBusConnection *connection; guint show_configure : 1; guint show_about : 1; @@ -112,7 +123,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (PanelPluginExternalWrapper, panel_plugin_ex static void panel_plugin_external_wrapper_class_init (PanelPluginExternalWrapperClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; PanelPluginExternalClass *plugin_external_class; gobject_class = G_OBJECT_CLASS (klass); @@ -127,19 +138,18 @@ panel_plugin_external_wrapper_class_init (PanelPluginExternalWrapperClass *klass plugin_external_class->get_show_configure = panel_plugin_external_wrapper_get_show_configure; plugin_external_class->get_show_about = panel_plugin_external_wrapper_get_show_about; - g_object_class_install_property (gobject_class, PROP_SKELETON, + g_object_class_install_property (gobject_class, + PROP_SKELETON, g_param_spec_object ("skeleton", NULL, NULL, XFCE_PANEL_PLUGIN_WRAPPER_TYPE_EXPORTED, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - external_signals[REMOTE_EVENT_RESULT] = - g_signal_new (g_intern_static_string ("remote-event-result"), - G_TYPE_FROM_CLASS (gobject_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - _panel_marshal_VOID__UINT_BOOLEAN, - G_TYPE_NONE, 2, - G_TYPE_UINT, G_TYPE_BOOLEAN); + external_signals[REMOTE_EVENT_RESULT] = g_signal_new (g_intern_static_string ("remote-event-result"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + _panel_marshal_VOID__UINT_BOOLEAN, + G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_BOOLEAN); } @@ -181,7 +191,7 @@ panel_plugin_external_wrapper_constructed (GObject *object) GError *error = NULL; gint unique_id; - priv->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); + priv->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); if (G_LIKELY (priv->connection != NULL)) { priv->skeleton = xfce_panel_plugin_wrapper_exported_skeleton_new (); @@ -238,8 +248,8 @@ panel_plugin_external_wrapper_finalize (GObject *object) static gchar ** -panel_plugin_external_wrapper_get_argv (PanelPluginExternal *external, - gchar **arguments) +panel_plugin_external_wrapper_get_argv (PanelPluginExternal *external, + gchar **arguments) { PanelModule *module; guint i, argc = PLUGIN_ARGV_ARGUMENTS; @@ -258,7 +268,7 @@ panel_plugin_external_wrapper_get_argv (PanelPluginExternal *external, argv = g_new0 (gchar *, argc + 1); argv[PLUGIN_ARGV_0] = g_strjoin ("-", WRAPPER_BIN, panel_module_get_api (module), NULL); argv[PLUGIN_ARGV_FILENAME] = g_strdup (panel_module_get_filename (module)); - argv[PLUGIN_ARGV_UNIQUE_ID] = g_strdup_printf ("%d", unique_id);; + argv[PLUGIN_ARGV_UNIQUE_ID] = g_strdup_printf ("%d", unique_id); argv[PLUGIN_ARGV_NAME] = g_strdup (panel_module_get_name (module)); argv[PLUGIN_ARGV_DISPLAY_NAME] = g_strdup (panel_module_get_display_name (module)); argv[PLUGIN_ARGV_COMMENT] = g_strdup (panel_module_get_comment (module)); @@ -280,9 +290,9 @@ static GVariant * panel_plugin_external_wrapper_gvalue_prop_to_gvariant (const GValue *value) { const GVariantType *type = NULL; - GVariant *variant = NULL; + GVariant *variant = NULL; - switch (G_VALUE_TYPE(value)) + switch (G_VALUE_TYPE (value)) { case G_TYPE_INT: type = G_VARIANT_TYPE_INT32; @@ -315,7 +325,7 @@ panel_plugin_external_wrapper_gvalue_prop_to_gvariant (const GValue *value) } if (type) - variant = g_dbus_gvalue_to_gvariant(value, type); + variant = g_dbus_gvalue_to_gvariant (value, type); return variant; } @@ -324,7 +334,7 @@ panel_plugin_external_wrapper_gvalue_prop_to_gvariant (const GValue *value) static void panel_plugin_external_wrapper_set_properties (PanelPluginExternal *external, - GSList *properties) + GSList *properties) { PanelPluginExternalWrapperPrivate *priv = get_instance_private (external); GVariantBuilder builder; @@ -343,14 +353,14 @@ panel_plugin_external_wrapper_set_properties (PanelPluginExternal *external, property = li->data; variant = panel_plugin_external_wrapper_gvalue_prop_to_gvariant (&property->value); - if (G_LIKELY(variant)) + if (G_LIKELY (variant)) { g_variant_builder_add (&builder, "(uv)", property->type, variant); g_variant_unref (variant); } else { - g_warning ("Failed to convert wrapper property from gvalue:%s to gvariant", G_VALUE_TYPE_NAME(&property->value)); + g_warning ("Failed to convert wrapper property from gvalue:%s to gvariant", G_VALUE_TYPE_NAME (&property->value)); return; } } @@ -369,9 +379,9 @@ panel_plugin_external_wrapper_set_properties (PanelPluginExternal *external, static gboolean panel_plugin_external_wrapper_remote_event (PanelPluginExternal *external, - const gchar *name, - const GValue *value, - guint *handle) + const gchar *name, + const GValue *value, + guint *handle) { PanelPluginExternalWrapperPrivate *priv = get_instance_private (external); GVariant *variant; @@ -391,7 +401,7 @@ panel_plugin_external_wrapper_remote_event (PanelPluginExternal *external, variant = panel_plugin_external_wrapper_gvalue_prop_to_gvariant (value); if (variant == NULL) { - g_warning ("Failed to convert value from gvalue:%s to gvariant", G_VALUE_TYPE_NAME(value)); + g_warning ("Failed to convert value from gvalue:%s to gvariant", G_VALUE_TYPE_NAME (value)); variant = g_variant_new_variant (g_variant_new_byte ('\0')); } @@ -433,9 +443,9 @@ panel_plugin_external_wrapper_get_show_about (PanelPluginExternal *external) static gboolean panel_plugin_external_wrapper_dbus_provider_signal (XfcePanelPluginWrapperExported *skeleton, - GDBusMethodInvocation *invocation, - XfcePanelPluginProviderSignal provider_signal, - PanelPluginExternalWrapper *wrapper) + GDBusMethodInvocation *invocation, + XfcePanelPluginProviderSignal provider_signal, + PanelPluginExternalWrapper *wrapper) { PanelPluginExternalWrapperPrivate *priv = get_instance_private (wrapper); @@ -468,10 +478,10 @@ panel_plugin_external_wrapper_dbus_provider_signal (XfcePanelPluginWrapperExport static gboolean panel_plugin_external_wrapper_dbus_remote_event_result (XfcePanelPluginWrapperExported *skeleton, - GDBusMethodInvocation *invocation, - guint handle, - gboolean result, - PanelPluginExternalWrapper *wrapper) + GDBusMethodInvocation *invocation, + guint handle, + gboolean result, + PanelPluginExternalWrapper *wrapper) { panel_return_val_if_fail (PANEL_IS_PLUGIN_EXTERNAL (wrapper), FALSE); @@ -486,9 +496,9 @@ panel_plugin_external_wrapper_dbus_remote_event_result (XfcePanelPluginWrapperEx GtkWidget * -panel_plugin_external_wrapper_new (PanelModule *module, - gint unique_id, - gchar **arguments) +panel_plugin_external_wrapper_new (PanelModule *module, + gint unique_id, + gchar **arguments) { panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL); panel_return_val_if_fail (unique_id != -1, NULL); diff --git a/panel/panel-plugin-external-wrapper.h b/panel/panel-plugin-external-wrapper.h index 488c10f96..a94ab23a9 100644 --- a/panel/panel-plugin-external-wrapper.h +++ b/panel/panel-plugin-external-wrapper.h @@ -32,9 +32,10 @@ struct _PanelPluginExternalWrapperClass PanelPluginExternalClass __parent__; }; -GtkWidget *panel_plugin_external_wrapper_new (PanelModule *module, - gint unique_id, - gchar **arguments) G_GNUC_MALLOC; +GtkWidget * +panel_plugin_external_wrapper_new (PanelModule *module, + gint unique_id, + gchar **arguments) G_GNUC_MALLOC; G_END_DECLS diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c index efcbb040f..a0e46bc5f 100644 --- a/panel/panel-plugin-external.c +++ b/panel/panel-plugin-external.c @@ -34,58 +34,89 @@ -#define get_instance_private(instance) ((PanelPluginExternalPrivate *) \ - panel_plugin_external_get_instance_private (PANEL_PLUGIN_EXTERNAL (instance))) - -static void panel_plugin_external_provider_init (XfcePanelPluginProviderInterface *iface); -static void panel_plugin_external_finalize (GObject *object); -static void panel_plugin_external_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void panel_plugin_external_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void panel_plugin_external_realize (GtkWidget *widget); -static void panel_plugin_external_unrealize (GtkWidget *widget); -static gboolean panel_plugin_external_child_ask_restart (PanelPluginExternal *external); -static void panel_plugin_external_child_spawn (PanelPluginExternal *external); -static void panel_plugin_external_child_respawn_schedule (PanelPluginExternal *external); -static void panel_plugin_external_child_watch (GPid pid, - gint status, - gpointer user_data); -static void panel_plugin_external_child_watch_destroyed (gpointer user_data); -static void panel_plugin_external_queue_free (PanelPluginExternal *external); -static void panel_plugin_external_queue_send_to_child (PanelPluginExternal *external); -static const gchar *panel_plugin_external_get_name (XfcePanelPluginProvider *provider); -static gint panel_plugin_external_get_unique_id (XfcePanelPluginProvider *provider); -static void panel_plugin_external_set_size (XfcePanelPluginProvider *provider, - gint size); -static void panel_plugin_external_set_icon_size (XfcePanelPluginProvider *provider, - gint icon_size); -static void panel_plugin_external_set_dark_mode (XfcePanelPluginProvider *provider, - gboolean dark_mode); -static void panel_plugin_external_set_mode (XfcePanelPluginProvider *provider, - XfcePanelPluginMode mode); -static void panel_plugin_external_set_nrows (XfcePanelPluginProvider *provider, - guint rows); -static void panel_plugin_external_set_screen_position (XfcePanelPluginProvider *provider, - XfceScreenPosition screen_position); -static void panel_plugin_external_save (XfcePanelPluginProvider *provider); -static gboolean panel_plugin_external_get_show_configure (XfcePanelPluginProvider *provider); -static void panel_plugin_external_show_configure (XfcePanelPluginProvider *provider); -static gboolean panel_plugin_external_get_show_about (XfcePanelPluginProvider *provider); -static void panel_plugin_external_show_about (XfcePanelPluginProvider *provider); -static void panel_plugin_external_removed (XfcePanelPluginProvider *provider); -static gboolean panel_plugin_external_remote_event (XfcePanelPluginProvider *provider, - const gchar *name, - const GValue *value, - guint *handler_id); -static void panel_plugin_external_set_locked (XfcePanelPluginProvider *provider, - gboolean locked); -static void panel_plugin_external_ask_remove (XfcePanelPluginProvider *provider); -static void panel_plugin_external_set_sensitive (PanelPluginExternal *external); +#define get_instance_private(instance) \ + ((PanelPluginExternalPrivate *) panel_plugin_external_get_instance_private (PANEL_PLUGIN_EXTERNAL (instance))) + +static void +panel_plugin_external_provider_init (XfcePanelPluginProviderInterface *iface); +static void +panel_plugin_external_finalize (GObject *object); +static void +panel_plugin_external_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +panel_plugin_external_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +panel_plugin_external_realize (GtkWidget *widget); +static void +panel_plugin_external_unrealize (GtkWidget *widget); +static gboolean +panel_plugin_external_child_ask_restart (PanelPluginExternal *external); +static void +panel_plugin_external_child_spawn (PanelPluginExternal *external); +static void +panel_plugin_external_child_respawn_schedule (PanelPluginExternal *external); +static void +panel_plugin_external_child_watch (GPid pid, + gint status, + gpointer user_data); +static void +panel_plugin_external_child_watch_destroyed (gpointer user_data); +static void +panel_plugin_external_queue_free (PanelPluginExternal *external); +static void +panel_plugin_external_queue_send_to_child (PanelPluginExternal *external); +static const gchar * +panel_plugin_external_get_name (XfcePanelPluginProvider *provider); +static gint +panel_plugin_external_get_unique_id (XfcePanelPluginProvider *provider); +static void +panel_plugin_external_set_size (XfcePanelPluginProvider *provider, + gint size); +static void +panel_plugin_external_set_icon_size (XfcePanelPluginProvider *provider, + gint icon_size); +static void +panel_plugin_external_set_dark_mode (XfcePanelPluginProvider *provider, + gboolean dark_mode); +static void +panel_plugin_external_set_mode (XfcePanelPluginProvider *provider, + XfcePanelPluginMode mode); +static void +panel_plugin_external_set_nrows (XfcePanelPluginProvider *provider, + guint rows); +static void +panel_plugin_external_set_screen_position (XfcePanelPluginProvider *provider, + XfceScreenPosition screen_position); +static void +panel_plugin_external_save (XfcePanelPluginProvider *provider); +static gboolean +panel_plugin_external_get_show_configure (XfcePanelPluginProvider *provider); +static void +panel_plugin_external_show_configure (XfcePanelPluginProvider *provider); +static gboolean +panel_plugin_external_get_show_about (XfcePanelPluginProvider *provider); +static void +panel_plugin_external_show_about (XfcePanelPluginProvider *provider); +static void +panel_plugin_external_removed (XfcePanelPluginProvider *provider); +static gboolean +panel_plugin_external_remote_event (XfcePanelPluginProvider *provider, + const gchar *name, + const GValue *value, + guint *handler_id); +static void +panel_plugin_external_set_locked (XfcePanelPluginProvider *provider, + gboolean locked); +static void +panel_plugin_external_ask_remove (XfcePanelPluginProvider *provider); +static void +panel_plugin_external_set_sensitive (PanelPluginExternal *external); @@ -93,23 +124,23 @@ typedef struct _PanelPluginExternalPrivate { /* startup arguments */ PanelModule *module; - gint unique_id; - gchar **arguments; + gint unique_id; + gchar **arguments; - guint embedded : 1; + guint embedded : 1; /* dbus message queue */ - GSList *queue; + GSList *queue; /* auto restart timer */ - GTimer *restart_timer; + GTimer *restart_timer; /* child watch data */ - GPid pid; - guint watch_id; + GPid pid; + guint watch_id; /* delayed spawning */ - guint spawn_timeout_id; + guint spawn_timeout_id; } PanelPluginExternalPrivate; enum @@ -132,7 +163,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (PanelPluginExternal, panel_plugin_external, GT static void panel_plugin_external_class_init (PanelPluginExternalClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; GtkWidgetClass *gtkwidget_class; gobject_class = G_OBJECT_CLASS (klass); @@ -146,27 +177,24 @@ panel_plugin_external_class_init (PanelPluginExternalClass *klass) g_object_class_install_property (gobject_class, PROP_UNIQUE_ID, - g_param_spec_int ("unique-id", - NULL, NULL, + g_param_spec_int ("unique-id", NULL, NULL, -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS - | G_PARAM_CONSTRUCT_ONLY)); + | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (gobject_class, PROP_MODULE, - g_param_spec_object ("module", - NULL, NULL, + g_param_spec_object ("module", NULL, NULL, PANEL_TYPE_MODULE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS - | G_PARAM_CONSTRUCT_ONLY)); + | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (gobject_class, PROP_ARGUMENTS, - g_param_spec_boxed ("arguments", - NULL, NULL, + g_param_spec_boxed ("arguments", NULL, NULL, G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS - | G_PARAM_CONSTRUCT_ONLY)); + | G_PARAM_CONSTRUCT_ONLY)); } @@ -188,7 +216,7 @@ panel_plugin_external_init (PanelPluginExternal *external) /* signal to pass gtk_widget_set_sensitive() changes to the remote window */ g_signal_connect (G_OBJECT (external), "notify::sensitive", - G_CALLBACK (panel_plugin_external_set_sensitive), NULL); + G_CALLBACK (panel_plugin_external_set_sensitive), NULL); } @@ -238,7 +266,7 @@ panel_plugin_external_finalize (GObject *object) priv->watch_id = 0; if (priv->pid != 0) g_child_watch_add (priv->pid, - (GChildWatchFunc) (void (*)(void)) g_spawn_close_pid, + (GChildWatchFunc) (void (*) (void)) g_spawn_close_pid, NULL); } @@ -257,9 +285,9 @@ panel_plugin_external_finalize (GObject *object) static void -panel_plugin_external_get_property (GObject *object, - guint prop_id, - GValue *value, +panel_plugin_external_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { PanelPluginExternalPrivate *priv = get_instance_private (object); @@ -287,10 +315,10 @@ panel_plugin_external_get_property (GObject *object, static void -panel_plugin_external_set_property (GObject *object, - guint prop_id, +panel_plugin_external_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { PanelPluginExternalPrivate *priv = get_instance_private (object); @@ -369,11 +397,11 @@ panel_plugin_external_unrealize (GtkWidget *widget) static gboolean -panel_plugin_external_child_ask_restart_dialog (GtkWindow *parent, +panel_plugin_external_child_ask_restart_dialog (GtkWindow *parent, const gchar *plugin_name) { GtkWidget *dialog; - gint response; + gint response; panel_return_val_if_fail (parent == NULL || GTK_IS_WINDOW (parent), FALSE); panel_return_val_if_fail (plugin_name != NULL, FALSE); @@ -389,8 +417,8 @@ panel_plugin_external_child_ask_restart_dialog (GtkWindow *parent, "the last %d seconds. If you press Execute the panel will try to restart " "the plugin otherwise it will be permanently removed from the panel."), PANEL_PLUGIN_AUTO_RESTART); - gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("_Execute"), GTK_RESPONSE_OK, - _("_Remove"), GTK_RESPONSE_CLOSE, NULL); + gtk_dialog_add_buttons ( + GTK_DIALOG (dialog), _("_Execute"), GTK_RESPONSE_OK, _("_Remove"), GTK_RESPONSE_CLOSE, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); @@ -431,7 +459,7 @@ panel_plugin_external_child_ask_restart (PanelPluginExternal *external) priv->unique_id); } else if (!panel_plugin_external_child_ask_restart_dialog (GTK_WINDOW (toplevel), - panel_module_get_display_name (priv->module))) + panel_module_get_display_name (priv->module))) { if (priv->watch_id != 0) { @@ -440,7 +468,7 @@ panel_plugin_external_child_ask_restart (PanelPluginExternal *external) priv->watch_id = 0; if (priv->pid != 0) g_child_watch_add (priv->pid, - (GChildWatchFunc) (void (*)(void)) g_spawn_close_pid, + (GChildWatchFunc) (void (*) (void)) g_spawn_close_pid, NULL); } @@ -466,14 +494,14 @@ static void panel_plugin_external_child_spawn (PanelPluginExternal *external) { PanelPluginExternalPrivate *priv = get_instance_private (external); - gchar **argv, **dbg_argv, **tmp_argv; - GError *error = NULL; - gboolean succeed; - GPid pid; - gchar *program, *cmd_line; - guint i; - gint tmp_argc; - gint64 timestamp; + gchar **argv, **dbg_argv, **tmp_argv; + GError *error = NULL; + gboolean succeed; + GPid pid; + gchar *program, *cmd_line; + guint i; + gint tmp_argc; + gint64 timestamp; panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external)); panel_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (external))); @@ -569,8 +597,8 @@ panel_plugin_external_child_spawn (PanelPluginExternal *external) /* watch the child */ priv->pid = pid; priv->watch_id = g_child_watch_add_full (G_PRIORITY_LOW, pid, - panel_plugin_external_child_watch, external, - panel_plugin_external_child_watch_destroyed); + panel_plugin_external_child_watch, external, + panel_plugin_external_child_watch_destroyed); } else { @@ -644,15 +672,15 @@ panel_plugin_external_child_respawn_schedule (PanelPluginExternal *external) /* schedule a restart timeout */ priv->spawn_timeout_id = g_timeout_add_full (G_PRIORITY_LOW, 100, panel_plugin_external_child_respawn, - external, panel_plugin_external_child_respawn_destroyed); + external, panel_plugin_external_child_respawn_destroyed); } } static void -panel_plugin_external_child_watch (GPid pid, - gint status, +panel_plugin_external_child_watch (GPid pid, + gint status, gpointer user_data) { PanelPluginExternal *external = PANEL_PLUGIN_EXTERNAL (user_data); @@ -799,7 +827,7 @@ panel_plugin_external_get_unique_id (XfcePanelPluginProvider *provider) static void panel_plugin_external_set_size (XfcePanelPluginProvider *provider, - gint size) + gint size) { GValue value = G_VALUE_INIT; @@ -819,7 +847,7 @@ panel_plugin_external_set_size (XfcePanelPluginProvider *provider, static void panel_plugin_external_set_icon_size (XfcePanelPluginProvider *provider, - gint icon_size) + gint icon_size) { GValue value = G_VALUE_INIT; @@ -839,7 +867,7 @@ panel_plugin_external_set_icon_size (XfcePanelPluginProvider *provider, static void panel_plugin_external_set_dark_mode (XfcePanelPluginProvider *provider, - gboolean dark_mode) + gboolean dark_mode) { GValue value = G_VALUE_INIT; @@ -859,7 +887,7 @@ panel_plugin_external_set_dark_mode (XfcePanelPluginProvider *provider, static void panel_plugin_external_set_mode (XfcePanelPluginProvider *provider, - XfcePanelPluginMode mode) + XfcePanelPluginMode mode) { GValue value = G_VALUE_INIT; @@ -885,7 +913,7 @@ panel_plugin_external_set_mode (XfcePanelPluginProvider *provider, static void panel_plugin_external_set_nrows (XfcePanelPluginProvider *provider, - guint rows) + guint rows) { GValue value = G_VALUE_INIT; @@ -905,7 +933,7 @@ panel_plugin_external_set_nrows (XfcePanelPluginProvider *provider, static void panel_plugin_external_set_screen_position (XfcePanelPluginProvider *provider, - XfceScreenPosition screen_position) + XfceScreenPosition screen_position) { GValue value = G_VALUE_INIT; @@ -995,9 +1023,9 @@ panel_plugin_external_removed (XfcePanelPluginProvider *provider) static gboolean panel_plugin_external_remote_event (XfcePanelPluginProvider *provider, - const gchar *name, - const GValue *value, - guint *handle) + const gchar *name, + const GValue *value, + guint *handle) { return (*PANEL_PLUGIN_EXTERNAL_GET_CLASS (provider)->remote_event) (PANEL_PLUGIN_EXTERNAL (provider), name, value, handle); @@ -1007,7 +1035,7 @@ panel_plugin_external_remote_event (XfcePanelPluginProvider *provider, static void panel_plugin_external_set_locked (XfcePanelPluginProvider *provider, - gboolean locked) + gboolean locked) { GValue value = G_VALUE_INIT; @@ -1056,9 +1084,9 @@ panel_plugin_external_set_sensitive (PanelPluginExternal *external) void -panel_plugin_external_queue_add (PanelPluginExternal *external, - XfcePanelPluginProviderPropType type, - const GValue *value) +panel_plugin_external_queue_add (PanelPluginExternal *external, + XfcePanelPluginProviderPropType type, + const GValue *value) { PanelPluginExternalPrivate *priv = get_instance_private (external); PluginProperty *prop; @@ -1080,8 +1108,8 @@ panel_plugin_external_queue_add (PanelPluginExternal *external, void -panel_plugin_external_queue_add_action (PanelPluginExternal *external, - XfcePanelPluginProviderPropType type) +panel_plugin_external_queue_add_action (PanelPluginExternal *external, + XfcePanelPluginProviderPropType type) { GValue value = G_VALUE_INIT; @@ -1122,7 +1150,7 @@ panel_plugin_external_restart (PanelPluginExternal *external) void panel_plugin_external_set_opacity (PanelPluginExternal *external, - gdouble opacity) + gdouble opacity) { GValue value = G_VALUE_INIT; @@ -1142,7 +1170,7 @@ panel_plugin_external_set_opacity (PanelPluginExternal *external, void panel_plugin_external_set_background_color (PanelPluginExternal *external, - const GdkRGBA *color) + const GdkRGBA *color) { panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external)); @@ -1153,7 +1181,7 @@ panel_plugin_external_set_background_color (PanelPluginExternal *external, void panel_plugin_external_set_background_image (PanelPluginExternal *external, - const gchar *image) + const gchar *image) { panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external)); @@ -1178,7 +1206,7 @@ panel_plugin_external_pointer_is_outside (PanelPluginExternal *external) { panel_return_val_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external), FALSE); - if (! get_instance_private (external)->embedded) + if (!get_instance_private (external)->embedded) return TRUE; return PANEL_PLUGIN_EXTERNAL_GET_CLASS (external)->pointer_is_outside (external); diff --git a/panel/panel-plugin-external.h b/panel/panel-plugin-external.h index 65b8d6ab6..c6d9cc724 100644 --- a/panel/panel-plugin-external.h +++ b/panel/panel-plugin-external.h @@ -36,78 +36,88 @@ struct _PanelPluginExternalClass GtkBoxClass __parent__; /* send panel values to the plugin or wrapper */ - void (*set_properties) (PanelPluginExternal *external, - GSList *properties); + void (*set_properties) (PanelPluginExternal *external, + GSList *properties); /* complete startup array for the plugin */ - gchar **(*get_argv) (PanelPluginExternal *external, - gchar **arguments); + gchar **(*get_argv) (PanelPluginExternal *external, + gchar **arguments); /* spawn wrapper process according to windowing environment */ - gboolean (*spawn) (PanelPluginExternal *external, - gchar **argv, - GPid *pid, - GError **error); + gboolean (*spawn) (PanelPluginExternal *external, + gchar **argv, + GPid *pid, + GError **error); /* handling of remote events */ - gboolean (*remote_event) (PanelPluginExternal *external, - const gchar *name, - const GValue *value, - guint *handle); + gboolean (*remote_event) (PanelPluginExternal *external, + const gchar *name, + const GValue *value, + guint *handle); /* some info received on plugin startup by the * implementations of the abstract object */ - gboolean (*get_show_configure) (PanelPluginExternal *external); - gboolean (*get_show_about) (PanelPluginExternal *external); + gboolean (*get_show_configure) (PanelPluginExternal *external); + gboolean (*get_show_about) (PanelPluginExternal *external); /* X11 only */ - void (*set_background_color) (PanelPluginExternal *external, - const GdkRGBA *color); - void (*set_background_image) (PanelPluginExternal *external, - const gchar *image); + void (*set_background_color) (PanelPluginExternal *external, + const GdkRGBA *color); + void (*set_background_image) (PanelPluginExternal *external, + const gchar *image); /* Wayland only */ - void (*set_geometry) (PanelPluginExternal *external, - PanelWindow *window); - gboolean (*pointer_is_outside) (PanelPluginExternal *external); + void (*set_geometry) (PanelPluginExternal *external, + PanelWindow *window); + gboolean (*pointer_is_outside) (PanelPluginExternal *external); }; typedef struct { XfcePanelPluginProviderPropType type; - GValue value; -} -PluginProperty; + GValue value; +} PluginProperty; -void panel_plugin_external_queue_add (PanelPluginExternal *external, - XfcePanelPluginProviderPropType type, - const GValue *value); +void +panel_plugin_external_queue_add (PanelPluginExternal *external, + XfcePanelPluginProviderPropType type, + const GValue *value); -void panel_plugin_external_queue_add_action (PanelPluginExternal *external, - XfcePanelPluginProviderPropType type); +void +panel_plugin_external_queue_add_action (PanelPluginExternal *external, + XfcePanelPluginProviderPropType type); -void panel_plugin_external_restart (PanelPluginExternal *external); +void +panel_plugin_external_restart (PanelPluginExternal *external); -void panel_plugin_external_set_opacity (PanelPluginExternal *external, - gdouble opacity); +void +panel_plugin_external_set_opacity (PanelPluginExternal *external, + gdouble opacity); -void panel_plugin_external_set_background_color (PanelPluginExternal *external, - const GdkRGBA *color); +void +panel_plugin_external_set_background_color (PanelPluginExternal *external, + const GdkRGBA *color); -void panel_plugin_external_set_background_image (PanelPluginExternal *external, - const gchar *image); +void +panel_plugin_external_set_background_image (PanelPluginExternal *external, + const gchar *image); -void panel_plugin_external_set_geometry (PanelPluginExternal *external, - PanelWindow *window); +void +panel_plugin_external_set_geometry (PanelPluginExternal *external, + PanelWindow *window); -gboolean panel_plugin_external_pointer_is_outside (PanelPluginExternal *external); +gboolean +panel_plugin_external_pointer_is_outside (PanelPluginExternal *external); -gboolean panel_plugin_external_get_embedded (PanelPluginExternal *external); +gboolean +panel_plugin_external_get_embedded (PanelPluginExternal *external); -void panel_plugin_external_set_embedded (PanelPluginExternal *external, - gboolean embedded); +void +panel_plugin_external_set_embedded (PanelPluginExternal *external, + gboolean embedded); -GPid panel_plugin_external_get_pid (PanelPluginExternal *external); +GPid +panel_plugin_external_get_pid (PanelPluginExternal *external); G_END_DECLS diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c index 99955c892..ec13a88ef 100644 --- a/panel/panel-preferences-dialog.c +++ b/panel/panel-preferences-dialog.c @@ -39,73 +39,104 @@ -static void panel_preferences_dialog_finalize (GObject *object); -static void panel_preferences_dialog_response (GtkWidget *window, - gint response_id, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_bindings_unbind (PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_bindings_add (PanelPreferencesDialog *dialog, - const gchar *property1, - const gchar *property2, - GBindingFlags flags); -static void panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_output_changed (GtkComboBox *combobox, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_autohide_changed (GtkComboBox *combobox, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_bg_style_changed (PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_bg_image_file_set (GtkFileChooserButton *button, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_bg_image_notified (PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_length_max_notified (PanelPreferencesDialog *dialog); -static gboolean panel_preferences_dialog_length_transform_to (GBinding *binding, - const GValue *from_value, - GValue *to_value, - gpointer user_data); -static gboolean panel_preferences_dialog_length_transform_from (GBinding *binding, - const GValue *from_value, - GValue *to_value, - gpointer user_data); -static void panel_preferences_dialog_panel_combobox_changed (GtkComboBox *combobox, - PanelPreferencesDialog *dialog); -static gboolean panel_preferences_dialog_panel_combobox_rebuild (PanelPreferencesDialog *dialog, - gint panel_id); -static void panel_preferences_dialog_panel_add (GtkWidget *widget, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_panel_remove (GtkWidget *widget, - PanelPreferencesDialog *dialog); -static gboolean panel_preferences_dialog_icon_size_state_set (GtkSwitch *widget, - gboolean state, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_icon_size_changed (GtkSpinButton *button, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_compositing_clicked (GtkButton *button, - gpointer user_data); -static void panel_preferences_dialog_panel_switch (GtkWidget *widget, - PanelPreferencesDialog *dialog); -static XfcePanelPluginProvider *panel_preferences_dialog_item_get_selected (PanelPreferencesDialog *dialog, - GtkTreeIter *return_iter); -static void panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_item_move (GtkWidget *button, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_item_remove (GtkWidget *button, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_item_add (GtkWidget *button, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_item_properties (GtkWidget *button, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_item_about (GtkWidget *button, - PanelPreferencesDialog *dialog); -static gboolean panel_preferences_dialog_treeview_clicked (GtkTreeView *treeview, - GdkEventButton *event, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_item_row_changed (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - PanelPreferencesDialog *dialog); -static void panel_preferences_dialog_item_selection_changed (GtkTreeSelection *selection, - PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_finalize (GObject *object); +static void +panel_preferences_dialog_response (GtkWidget *window, + gint response_id, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_bindings_unbind (PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_bindings_add (PanelPreferencesDialog *dialog, + const gchar *property1, + const gchar *property2, + GBindingFlags flags); +static void +panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_output_changed (GtkComboBox *combobox, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_autohide_changed (GtkComboBox *combobox, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_bg_style_changed (PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_bg_image_file_set (GtkFileChooserButton *button, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_bg_image_notified (PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_length_max_notified (PanelPreferencesDialog *dialog); +static gboolean +panel_preferences_dialog_length_transform_to (GBinding *binding, + const GValue *from_value, + GValue *to_value, + gpointer user_data); +static gboolean +panel_preferences_dialog_length_transform_from (GBinding *binding, + const GValue *from_value, + GValue *to_value, + gpointer user_data); +static void +panel_preferences_dialog_panel_combobox_changed (GtkComboBox *combobox, + PanelPreferencesDialog *dialog); +static gboolean +panel_preferences_dialog_panel_combobox_rebuild (PanelPreferencesDialog *dialog, + gint panel_id); +static void +panel_preferences_dialog_panel_add (GtkWidget *widget, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_panel_remove (GtkWidget *widget, + PanelPreferencesDialog *dialog); +static gboolean +panel_preferences_dialog_icon_size_state_set (GtkSwitch *widget, + gboolean state, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_icon_size_changed (GtkSpinButton *button, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_compositing_clicked (GtkButton *button, + gpointer user_data); +static void +panel_preferences_dialog_panel_switch (GtkWidget *widget, + PanelPreferencesDialog *dialog); +static XfcePanelPluginProvider * +panel_preferences_dialog_item_get_selected (PanelPreferencesDialog *dialog, + GtkTreeIter *return_iter); +static void +panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_item_move (GtkWidget *button, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_item_remove (GtkWidget *button, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_item_add (GtkWidget *button, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_item_properties (GtkWidget *button, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_item_about (GtkWidget *button, + PanelPreferencesDialog *dialog); +static gboolean +panel_preferences_dialog_treeview_clicked (GtkTreeView *treeview, + GdkEventButton *event, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_item_row_changed (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + PanelPreferencesDialog *dialog); +static void +panel_preferences_dialog_item_selection_changed (GtkTreeSelection *selection, + PanelPreferencesDialog *dialog); @@ -126,30 +157,30 @@ enum struct _PanelPreferencesDialog { - GtkBuilder __parent__; + GtkBuilder __parent__; PanelApplication *application; /* currently selected window in the selector */ - PanelWindow *active; + PanelWindow *active; /* GBinding's between dialog <-> window */ - GSList *bindings; + GSList *bindings; /* store for the items list */ - GtkListStore *store; + GtkListStore *store; /* changed signal for the active panel's itembar */ - gulong items_changed_handler_id; + gulong items_changed_handler_id; /* background image watch */ - gulong bg_image_notify_handler_id; + gulong bg_image_notify_handler_id; /* changed signal for the output selector */ - gulong output_changed_handler_id; + gulong output_changed_handler_id; /* plug in which the dialog is embedded */ - GtkWidget *socket_plug; + GtkWidget *socket_plug; }; @@ -176,16 +207,16 @@ panel_preferences_dialog_class_init (PanelPreferencesDialogClass *klass) static void panel_preferences_dialog_init (PanelPreferencesDialog *dialog) { - GObject *window; - GObject *object; - GObject *info; - GObject *treeview; + GObject *window; + GObject *object; + GObject *info; + GObject *treeview; GtkTreeViewColumn *column; - GtkCellRenderer *renderer; - GtkTreeSelection *selection; - gchar *path_old; - gchar *path_new; - gchar *xfwm4_tweaks; + GtkCellRenderer *renderer; + GtkTreeSelection *selection; + gchar *path_old; + gchar *path_new; + gchar *xfwm4_tweaks; dialog->bindings = NULL; dialog->application = panel_application_get (); @@ -202,9 +233,9 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog) window = gtk_builder_get_object (GTK_BUILDER (dialog), "dialog"); panel_return_if_fail (GTK_IS_WIDGET (window)); g_signal_connect (G_OBJECT (window), "response", - G_CALLBACK (panel_preferences_dialog_response), dialog); + G_CALLBACK (panel_preferences_dialog_response), dialog); -#define connect_signal(name,detail_signal,c_handler) \ +#define connect_signal(name, detail_signal, c_handler) \ object = gtk_builder_get_object (GTK_BUILDER (dialog), name); \ panel_return_if_fail (G_IS_OBJECT (object)); \ g_signal_connect (G_OBJECT (object), detail_signal, G_CALLBACK (c_handler), dialog); @@ -228,7 +259,7 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog) object = gtk_builder_get_object (GTK_BUILDER (dialog), "background-style"); panel_return_if_fail (G_IS_OBJECT (object)); g_signal_connect_swapped (G_OBJECT (object), "changed", - G_CALLBACK (panel_preferences_dialog_bg_style_changed), dialog); + G_CALLBACK (panel_preferences_dialog_bg_style_changed), dialog); /* icon size switch, handling enabling/disabling of custom icon sizes */ object = gtk_builder_get_object (GTK_BUILDER (dialog), "icon-size-spinbutton"); @@ -243,7 +274,7 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog) object = gtk_builder_get_object (GTK_BUILDER (dialog), "composited"); panel_return_if_fail (G_IS_OBJECT (object)); g_signal_connect_swapped (G_OBJECT (object), "notify::visible", - G_CALLBACK (panel_preferences_dialog_bg_style_changed), dialog); + G_CALLBACK (panel_preferences_dialog_bg_style_changed), dialog); info = gtk_builder_get_object (GTK_BUILDER (dialog), "composited-info"); panel_return_if_fail (G_IS_OBJECT (info)); @@ -262,7 +293,7 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog) object = gtk_builder_get_object (GTK_BUILDER (dialog), "background-image"); panel_return_if_fail (GTK_IS_FILE_CHOOSER_BUTTON (object)); g_signal_connect (G_OBJECT (object), "file-set", - G_CALLBACK (panel_preferences_dialog_bg_image_file_set), dialog); + G_CALLBACK (panel_preferences_dialog_bg_image_file_set), dialog); /* items treeview and buttons */ connect_signal ("item-up", "clicked", panel_preferences_dialog_item_move); @@ -285,17 +316,17 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog) gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (dialog->store)); gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (treeview), ITEM_COLUMN_TOOLTIP); g_signal_connect (G_OBJECT (treeview), "button-press-event", - G_CALLBACK (panel_preferences_dialog_treeview_clicked), dialog); + G_CALLBACK (panel_preferences_dialog_treeview_clicked), dialog); gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview), TRUE); g_signal_connect (G_OBJECT (dialog->store), "row-changed", - G_CALLBACK (panel_preferences_dialog_item_row_changed), dialog); + G_CALLBACK (panel_preferences_dialog_item_row_changed), dialog); /* setup tree selection */ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); g_signal_connect (G_OBJECT (selection), "changed", - G_CALLBACK (panel_preferences_dialog_item_selection_changed), dialog); + G_CALLBACK (panel_preferences_dialog_item_selection_changed), dialog); /* icon renderer */ renderer = gtk_cell_renderer_pixbuf_new (); @@ -315,16 +346,15 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog) /* connect the output changed signal */ object = gtk_builder_get_object (GTK_BUILDER (dialog), "output-name"); panel_return_if_fail (GTK_IS_COMBO_BOX (object)); - dialog->output_changed_handler_id = - g_signal_connect (G_OBJECT (object), "changed", - G_CALLBACK (panel_preferences_dialog_output_changed), - dialog); + dialog->output_changed_handler_id + = g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (panel_preferences_dialog_output_changed), dialog); /* connect the autohide behavior changed signal */ object = gtk_builder_get_object (GTK_BUILDER (dialog), "autohide-behavior"); panel_return_if_fail (GTK_IS_COMBO_BOX (object)); g_signal_connect (G_OBJECT (object), "changed", - G_CALLBACK (panel_preferences_dialog_autohide_changed), dialog); + G_CALLBACK (panel_preferences_dialog_autohide_changed), dialog); } @@ -333,7 +363,7 @@ static void panel_preferences_dialog_finalize (GObject *object) { PanelPreferencesDialog *dialog = PANEL_PREFERENCES_DIALOG (object); - GtkWidget *itembar; + GtkWidget *itembar; /* unblock autohide */ panel_application_windows_blocked (dialog->application, FALSE); @@ -352,13 +382,13 @@ panel_preferences_dialog_finalize (GObject *object) /* disconnect changed signal */ itembar = gtk_bin_get_child (GTK_BIN (dialog->active)); g_signal_handler_disconnect (G_OBJECT (itembar), - dialog->items_changed_handler_id); + dialog->items_changed_handler_id); } if (dialog->bg_image_notify_handler_id != 0) { g_signal_handler_disconnect (G_OBJECT (dialog->active), - dialog->bg_image_notify_handler_id); + dialog->bg_image_notify_handler_id); } } @@ -375,8 +405,8 @@ panel_preferences_dialog_finalize (GObject *object) static void -panel_preferences_dialog_response (GtkWidget *window, - gint response_id, +panel_preferences_dialog_response (GtkWidget *window, + gint response_id, PanelPreferencesDialog *dialog) { panel_return_if_fail (GTK_IS_DIALOG (window)); @@ -416,7 +446,7 @@ panel_preferences_dialog_bindings_unbind (PanelPreferencesDialog *dialog) if (dialog->active != NULL) { g_signal_handler_disconnect (G_OBJECT (dialog->active), - dialog->bg_image_notify_handler_id); + dialog->bg_image_notify_handler_id); } dialog->bg_image_notify_handler_id = 0; @@ -431,12 +461,12 @@ panel_preferences_dialog_bindings_unbind (PanelPreferencesDialog *dialog) static void panel_preferences_dialog_bindings_add (PanelPreferencesDialog *dialog, - const gchar *property1, - const gchar *property2, - GBindingFlags flags) + const gchar *property1, + const gchar *property2, + GBindingFlags flags) { GBinding *binding; - GObject *object; + GObject *object; /* get the object from the builder */ object = gtk_builder_get_object (GTK_BUILDER (dialog), property1); @@ -453,20 +483,20 @@ panel_preferences_dialog_bindings_add (PanelPreferencesDialog *dialog, static void panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog) { - GdkDisplay *display; - GdkMonitor *monitor; - gint n_monitors = 1; - GObject *object; - GObject *store; - GBinding *binding; - gchar *output_name = NULL; - gboolean selector_visible = TRUE; - GtkTreeIter iter; - gboolean output_selected = FALSE; - gint n = 0, i; - gchar *name, *title; - gboolean span_monitors_sensitive = FALSE; - gboolean icon_size_set; + GdkDisplay *display; + GdkMonitor *monitor; + gint n_monitors = 1; + GObject *object; + GObject *store; + GBinding *binding; + gchar *output_name = NULL; + gboolean selector_visible = TRUE; + GtkTreeIter iter; + gboolean output_selected = FALSE; + gint n = 0, i; + gchar *name, *title; + gboolean span_monitors_sensitive = FALSE; + gboolean icon_size_set; /* leave when there is no active panel */ panel_return_if_fail (G_IS_OBJECT (dialog->active)); @@ -492,8 +522,9 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog) panel_preferences_dialog_bindings_add (dialog, "border-width", "value", 0); /* watch image changes from the panel */ - dialog->bg_image_notify_handler_id = g_signal_connect_swapped (G_OBJECT (dialog->active), - "notify::background-image", G_CALLBACK (panel_preferences_dialog_bg_image_notified), dialog); + dialog->bg_image_notify_handler_id + = g_signal_connect_swapped (G_OBJECT (dialog->active), "notify::background-image", + G_CALLBACK (panel_preferences_dialog_bg_image_notified), dialog); panel_preferences_dialog_bg_image_notified (dialog); /* manage panel length */ @@ -530,8 +561,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog) gtk_list_store_insert_with_values (GTK_LIST_STORE (store), &iter, n++, OUTPUT_NAME, "Automatic", OUTPUT_TITLE, _("Automatic"), -1); - if (xfce_str_is_empty (output_name) || - g_strcmp0 (output_name, "Automatic") == 0) + if (xfce_str_is_empty (output_name) || g_strcmp0 (output_name, "Automatic") == 0) { gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter); output_selected = TRUE; @@ -551,8 +581,8 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog) { for (i = 0; i < n_monitors; i++) { - monitor = gdk_display_get_monitor(display, i); - name = g_strdup(gdk_monitor_get_model (monitor)); + monitor = gdk_display_get_monitor (display, i); + name = g_strdup (gdk_monitor_get_model (monitor)); if (xfce_str_is_empty (name)) { g_free (name); @@ -573,7 +603,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog) if (!output_selected && g_strcmp0 (name, output_name) == 0) { - gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter); + gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter); output_selected = TRUE; } @@ -588,7 +618,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog) gtk_list_store_insert_with_values (GTK_LIST_STORE (store), &iter, n++, OUTPUT_NAME, output_name, OUTPUT_TITLE, output_name, -1); - gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter); + gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter); } } else @@ -643,13 +673,13 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog) static void -panel_preferences_dialog_output_changed (GtkComboBox *combobox, +panel_preferences_dialog_output_changed (GtkComboBox *combobox, PanelPreferencesDialog *dialog) { - GtkTreeIter iter; + GtkTreeIter iter; GtkTreeModel *model; - gchar *output_name = NULL; - GObject *object; + gchar *output_name = NULL; + GObject *object; panel_return_if_fail (GTK_IS_COMBO_BOX (combobox)); panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); @@ -664,8 +694,7 @@ panel_preferences_dialog_output_changed (GtkComboBox *combobox, /* monitor spanning does not work when an output is selected */ object = gtk_builder_get_object (GTK_BUILDER (dialog), "span-monitors"); panel_return_if_fail (GTK_IS_WIDGET (object)); - if (output_name == NULL || - g_strcmp0 ("Automatic", output_name) == 0) + if (output_name == NULL || g_strcmp0 ("Automatic", output_name) == 0) gtk_widget_set_sensitive (GTK_WIDGET (object), TRUE); else gtk_widget_set_sensitive (GTK_WIDGET (object), FALSE); @@ -677,7 +706,7 @@ panel_preferences_dialog_output_changed (GtkComboBox *combobox, static void -panel_preferences_dialog_autohide_changed (GtkComboBox *combobox, +panel_preferences_dialog_autohide_changed (GtkComboBox *combobox, PanelPreferencesDialog *dialog) { GObject *object; @@ -701,9 +730,9 @@ panel_preferences_dialog_autohide_changed (GtkComboBox *combobox, static void panel_preferences_dialog_bg_style_changed (PanelPreferencesDialog *dialog) { - gint active; - GObject *object; - gboolean composited; + gint active; + GObject *object; + gboolean composited; panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); panel_return_if_fail (PANEL_WINDOW (dialog->active)); @@ -737,7 +766,7 @@ panel_preferences_dialog_bg_style_changed (PanelPreferencesDialog *dialog) static void -panel_preferences_dialog_bg_image_file_set (GtkFileChooserButton *button, +panel_preferences_dialog_bg_image_file_set (GtkFileChooserButton *button, PanelPreferencesDialog *dialog) { gchar *uri; @@ -746,15 +775,13 @@ panel_preferences_dialog_bg_image_file_set (GtkFileChooserButton *button, panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); panel_return_if_fail (PANEL_IS_WINDOW (dialog->active)); - g_signal_handler_block (G_OBJECT (dialog->active), - dialog->bg_image_notify_handler_id); + g_signal_handler_block (G_OBJECT (dialog->active), dialog->bg_image_notify_handler_id); uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (button)); g_object_set (G_OBJECT (dialog->active), "background-image", uri, NULL); g_free (uri); - g_signal_handler_unblock (G_OBJECT (dialog->active), - dialog->bg_image_notify_handler_id); + g_signal_handler_unblock (G_OBJECT (dialog->active), dialog->bg_image_notify_handler_id); } @@ -762,7 +789,7 @@ panel_preferences_dialog_bg_image_file_set (GtkFileChooserButton *button, static void panel_preferences_dialog_bg_image_notified (PanelPreferencesDialog *dialog) { - gchar *uri; + gchar *uri; GObject *button; panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); @@ -771,15 +798,15 @@ panel_preferences_dialog_bg_image_notified (PanelPreferencesDialog *dialog) button = gtk_builder_get_object (GTK_BUILDER (dialog), "background-image"); panel_return_if_fail (GTK_IS_FILE_CHOOSER_BUTTON (button)); - g_signal_handlers_block_by_func (G_OBJECT (button), - G_CALLBACK (panel_preferences_dialog_bg_image_file_set), dialog); + g_signal_handlers_block_by_func ( + G_OBJECT (button), G_CALLBACK (panel_preferences_dialog_bg_image_file_set), dialog); g_object_get (G_OBJECT (dialog->active), "background-image", &uri, NULL); gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (button), uri != NULL ? uri : ""); g_free (uri); - g_signal_handlers_unblock_by_func (G_OBJECT (button), - G_CALLBACK (panel_preferences_dialog_bg_image_file_set), dialog); + g_signal_handlers_unblock_by_func ( + G_OBJECT (button), G_CALLBACK (panel_preferences_dialog_bg_image_file_set), dialog); } @@ -788,8 +815,8 @@ static void panel_preferences_dialog_length_max_notified (PanelPreferencesDialog *dialog) { GObject *adjust; - gdouble length; - guint length_max; + gdouble length; + guint length_max; panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); panel_return_if_fail (PANEL_IS_WINDOW (dialog->active)); @@ -806,13 +833,13 @@ panel_preferences_dialog_length_max_notified (PanelPreferencesDialog *dialog) static gboolean -panel_preferences_dialog_length_transform_to (GBinding *binding, +panel_preferences_dialog_length_transform_to (GBinding *binding, const GValue *from_value, - GValue *to_value, - gpointer user_data) + GValue *to_value, + gpointer user_data) { GObject *adjust; - gdouble length, upper; + gdouble length, upper; panel_return_val_if_fail (PANEL_IS_PREFERENCES_DIALOG (user_data), FALSE); @@ -829,13 +856,13 @@ panel_preferences_dialog_length_transform_to (GBinding *binding, static gboolean -panel_preferences_dialog_length_transform_from (GBinding *binding, +panel_preferences_dialog_length_transform_from (GBinding *binding, const GValue *from_value, - GValue *to_value, - gpointer user_data) + GValue *to_value, + gpointer user_data) { GObject *adjust; - gdouble length, upper; + gdouble length, upper; panel_return_val_if_fail (PANEL_IS_PREFERENCES_DIALOG (user_data), FALSE); @@ -854,10 +881,9 @@ panel_preferences_dialog_length_transform_from (GBinding *binding, static void panel_preferences_dialog_panel_sensitive (PanelPreferencesDialog *dialog) { - - GObject *object; - gboolean locked = TRUE; - GSList *windows; + GObject *object; + gboolean locked = TRUE; + GSList *windows; panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); @@ -867,13 +893,11 @@ panel_preferences_dialog_panel_sensitive (PanelPreferencesDialog *dialog) object = gtk_builder_get_object (GTK_BUILDER (dialog), "panel-remove"); panel_return_if_fail (GTK_IS_WIDGET (object)); windows = panel_application_get_windows (dialog->application); - gtk_widget_set_sensitive (GTK_WIDGET (object), - !locked && g_slist_length (windows) > 1); + gtk_widget_set_sensitive (GTK_WIDGET (object), !locked && g_slist_length (windows) > 1); object = gtk_builder_get_object (GTK_BUILDER (dialog), "panel-add"); panel_return_if_fail (GTK_IS_WIDGET (object)); - gtk_widget_set_sensitive (GTK_WIDGET (object), - !panel_application_get_locked (dialog->application)); + gtk_widget_set_sensitive (GTK_WIDGET (object), !panel_application_get_locked (dialog->application)); object = gtk_builder_get_object (GTK_BUILDER (dialog), "notebook"); panel_return_if_fail (GTK_IS_WIDGET (object)); @@ -887,13 +911,13 @@ panel_preferences_dialog_panel_sensitive (PanelPreferencesDialog *dialog) static void -panel_preferences_dialog_panel_combobox_changed (GtkComboBox *combobox, +panel_preferences_dialog_panel_combobox_changed (GtkComboBox *combobox, PanelPreferencesDialog *dialog) { - gint panel_id; - GtkWidget *itembar; + gint panel_id; + GtkWidget *itembar; GtkTreeModel *model; - GtkTreeIter iter; + GtkTreeIter iter; panel_return_if_fail (GTK_IS_COMBO_BOX (combobox)); panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); @@ -926,10 +950,9 @@ panel_preferences_dialog_panel_combobox_changed (GtkComboBox *combobo if (G_LIKELY (dialog->active != NULL)) { itembar = gtk_bin_get_child (GTK_BIN (dialog->active)); - dialog->items_changed_handler_id = - g_signal_connect (G_OBJECT (itembar), "changed", - G_CALLBACK (panel_preferences_dialog_item_store_rebuild), - dialog); + dialog->items_changed_handler_id + = g_signal_connect (G_OBJECT (itembar), "changed", + G_CALLBACK (panel_preferences_dialog_item_store_rebuild), dialog); /* rebind the dialog bindings */ panel_preferences_dialog_bindings_update (dialog); @@ -945,15 +968,15 @@ panel_preferences_dialog_panel_combobox_changed (GtkComboBox *combobo static gboolean panel_preferences_dialog_panel_combobox_rebuild (PanelPreferencesDialog *dialog, - gint panel_id) + gint panel_id) { - GObject *store, *combo; - gint i; - GSList *windows, *li; - gchar *name; - gint id; - GtkTreeIter iter; - gboolean selected = FALSE; + GObject *store, *combo; + gint i; + GSList *windows, *li; + gchar *name; + gint id; + GtkTreeIter iter; + gboolean selected = FALSE; /* get the combo box and model */ store = gtk_builder_get_object (GTK_BUILDER (dialog), "panel-store"); @@ -962,8 +985,7 @@ panel_preferences_dialog_panel_combobox_rebuild (PanelPreferencesDialog *dialog, panel_return_val_if_fail (GTK_IS_COMBO_BOX (combo), FALSE); /* block signal */ - g_signal_handlers_block_by_func (combo, - panel_preferences_dialog_panel_combobox_changed, dialog); + g_signal_handlers_block_by_func (combo, panel_preferences_dialog_panel_combobox_changed, dialog); /* empty the combo box */ gtk_list_store_clear (GTK_LIST_STORE (store)); @@ -988,8 +1010,7 @@ panel_preferences_dialog_panel_combobox_rebuild (PanelPreferencesDialog *dialog, } /* unblock signal */ - g_signal_handlers_unblock_by_func (combo, - panel_preferences_dialog_panel_combobox_changed, dialog); + g_signal_handlers_unblock_by_func (combo, panel_preferences_dialog_panel_combobox_changed, dialog); if (selected) panel_preferences_dialog_panel_combobox_changed (GTK_COMBO_BOX (combo), dialog); @@ -1002,15 +1023,15 @@ panel_preferences_dialog_panel_combobox_rebuild (PanelPreferencesDialog *dialog, static void -panel_preferences_dialog_panel_add (GtkWidget *widget, +panel_preferences_dialog_panel_add (GtkWidget *widget, PanelPreferencesDialog *dialog) { PanelWindow *window; - gint panel_id; + gint panel_id; /* create new window */ window = panel_application_new_window (dialog->application, - gtk_widget_get_screen (widget), -1, TRUE); + gtk_widget_get_screen (widget), -1, TRUE); /* show window */ gtk_widget_show (GTK_WIDGET (window)); @@ -1023,22 +1044,23 @@ panel_preferences_dialog_panel_add (GtkWidget *widget, static void -panel_preferences_dialog_panel_remove (GtkWidget *widget, +panel_preferences_dialog_panel_remove (GtkWidget *widget, PanelPreferencesDialog *dialog) { - gint id; + gint id; GtkWidget *toplevel; - GSList *windows, *window; + GSList *windows, *window; + const gchar *text = _("The panel and plugin configurations will be permanently removed"); + const gchar *label = _("_Remove"); /* leave if the window is locked */ if (panel_window_get_locked (dialog->active)) return; toplevel = gtk_widget_get_toplevel (widget); - if (xfce_dialog_confirm (GTK_WINDOW (toplevel), "list-remove", _("_Remove"), - _("The panel and plugin configurations will be permanently removed"), - _("Are you sure you want to remove panel %d?"), - panel_window_get_id (dialog->active))) + if (xfce_dialog_confirm (GTK_WINDOW (toplevel), "list-remove", label, text, + _("Are you sure you want to remove panel %d?"), + panel_window_get_id (dialog->active))) { /* release the bindings */ panel_preferences_dialog_bindings_unbind (dialog); @@ -1064,11 +1086,11 @@ panel_preferences_dialog_panel_remove (GtkWidget *widget, static gboolean -panel_preferences_dialog_icon_size_state_set (GtkSwitch *widget, - gboolean state, +panel_preferences_dialog_icon_size_state_set (GtkSwitch *widget, + gboolean state, PanelPreferencesDialog *dialog) { - GObject *spinbutton, *revealer; + GObject *spinbutton, *revealer; panel_return_val_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog), FALSE); spinbutton = gtk_builder_get_object (GTK_BUILDER (dialog), "icon-size-spinbutton"); @@ -1097,10 +1119,10 @@ panel_preferences_dialog_icon_size_state_set (GtkSwitch *widget, static void -panel_preferences_dialog_icon_size_changed (GtkSpinButton *button, +panel_preferences_dialog_icon_size_changed (GtkSpinButton *button, PanelPreferencesDialog *dialog) { - GObject *object; + GObject *object; panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); object = gtk_builder_get_object (GTK_BUILDER (dialog), "icon-size-switch"); @@ -1110,7 +1132,7 @@ panel_preferences_dialog_icon_size_changed (GtkSpinButton *button, of the spinbutton has to be 0. however, we want to set 16px as the reasonable lower limit for icons. */ if (gtk_spin_button_get_value_as_int (button) < 16 && gtk_switch_get_state (GTK_SWITCH (object))) - gtk_spin_button_set_value (button, 16.0); + gtk_spin_button_set_value (button, 16.0); } @@ -1118,9 +1140,9 @@ panel_preferences_dialog_icon_size_changed (GtkSpinButton *button, static void panel_preferences_dialog_compositing_clicked (GtkButton *button, gpointer user_data) { - gchar *command; + gchar *command; GAppInfo *app_info = NULL; - GError *error = NULL; + GError *error = NULL; command = g_find_program_in_path ("xfwm4-tweaks-settings"); if (command != NULL) @@ -1165,13 +1187,13 @@ panel_preferences_dialog_panel_switch (GtkWidget *widget, PanelPreferencesDialog static XfcePanelPluginProvider * panel_preferences_dialog_item_get_selected (PanelPreferencesDialog *dialog, - GtkTreeIter *return_iter) + GtkTreeIter *return_iter) { - GObject *treeview; + GObject *treeview; XfcePanelPluginProvider *provider = NULL; - GtkTreeModel *model; - GtkTreeIter iter; - GtkTreeSelection *selection; + GtkTreeModel *model; + GtkTreeIter iter; + GtkTreeSelection *selection; panel_return_val_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog), NULL); @@ -1197,17 +1219,17 @@ panel_preferences_dialog_item_get_selected (PanelPreferencesDialog *dialog, static void -panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar, +panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar, PanelPreferencesDialog *dialog) { - GList *items, *li; - guint i; - PanelModule *module; - gchar *tooltip, *display_name; + GList *items, *li; + guint i; + PanelModule *module; + gchar *tooltip, *display_name; XfcePanelPluginProvider *selected_provider; - GtkTreeIter iter; - GtkTreePath *path; - GObject *treeview; + GtkTreeIter iter; + GtkTreePath *path; + GObject *treeview; panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); panel_return_if_fail (GTK_IS_LIST_STORE (dialog->store)); @@ -1219,7 +1241,7 @@ panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar, gtk_list_store_clear (dialog->store); g_signal_handlers_block_by_func (G_OBJECT (dialog->store), - G_CALLBACK (panel_preferences_dialog_item_row_changed), dialog); + G_CALLBACK (panel_preferences_dialog_item_row_changed), dialog); /* add items to the store */ items = gtk_container_get_children (GTK_CONTAINER (itembar)); @@ -1280,23 +1302,23 @@ panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar, g_list_free (items); g_signal_handlers_unblock_by_func (G_OBJECT (dialog->store), - G_CALLBACK (panel_preferences_dialog_item_row_changed), dialog); + G_CALLBACK (panel_preferences_dialog_item_row_changed), dialog); } static void -panel_preferences_dialog_item_move (GtkWidget *button, +panel_preferences_dialog_item_move (GtkWidget *button, PanelPreferencesDialog *dialog) { - GObject *treeview, *object; - GtkTreeSelection *selection; - GtkTreeIter iter_a, iter_b; + GObject *treeview, *object; + GtkTreeSelection *selection; + GtkTreeIter iter_a, iter_b; XfcePanelPluginProvider *provider; - GtkWidget *itembar; - gint position; - gint direction; - GtkTreePath *path; + GtkWidget *itembar; + gint position; + gint direction; + GtkTreePath *path; panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); @@ -1363,7 +1385,6 @@ panel_preferences_dialog_item_move (GtkWidget *button, /* make the new selected position visible if moved out of area */ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (treeview), path, NULL, FALSE, 0, 0); gtk_tree_view_set_cursor (GTK_TREE_VIEW (treeview), path, NULL, FALSE); - } gtk_tree_path_free (path); } @@ -1372,12 +1393,12 @@ panel_preferences_dialog_item_move (GtkWidget *button, static void -panel_preferences_dialog_item_remove (GtkWidget *button, +panel_preferences_dialog_item_remove (GtkWidget *button, PanelPreferencesDialog *dialog) { XfcePanelPluginProvider *provider; - GtkWidget *widget, *toplevel; - PanelModule *module; + GtkWidget *widget, *toplevel; + PanelModule *module; panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); @@ -1397,8 +1418,8 @@ panel_preferences_dialog_item_remove (GtkWidget *button, gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (widget), _("If you remove the item from the panel, " "it is permanently lost.")); - gtk_dialog_add_buttons (GTK_DIALOG (widget), _("_Cancel"), GTK_RESPONSE_NO, - _("_Remove"), GTK_RESPONSE_YES, NULL); + gtk_dialog_add_buttons ( + GTK_DIALOG (widget), _("_Cancel"), GTK_RESPONSE_NO, _("_Remove"), GTK_RESPONSE_YES, NULL); gtk_dialog_set_default_response (GTK_DIALOG (widget), GTK_RESPONSE_NO); /* run the dialog */ @@ -1415,7 +1436,7 @@ panel_preferences_dialog_item_remove (GtkWidget *button, static void -panel_preferences_dialog_item_add (GtkWidget *button, +panel_preferences_dialog_item_add (GtkWidget *button, PanelPreferencesDialog *dialog) { panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); @@ -1426,7 +1447,7 @@ panel_preferences_dialog_item_add (GtkWidget *button, static void -panel_preferences_dialog_item_properties (GtkWidget *button, +panel_preferences_dialog_item_properties (GtkWidget *button, PanelPreferencesDialog *dialog) { XfcePanelPluginProvider *provider; @@ -1441,7 +1462,7 @@ panel_preferences_dialog_item_properties (GtkWidget *button, static void -panel_preferences_dialog_item_about (GtkWidget *button, +panel_preferences_dialog_item_about (GtkWidget *button, PanelPreferencesDialog *dialog) { XfcePanelPluginProvider *provider; @@ -1456,8 +1477,8 @@ panel_preferences_dialog_item_about (GtkWidget *button, static gboolean -panel_preferences_dialog_treeview_clicked (GtkTreeView *treeview, - GdkEventButton *event, +panel_preferences_dialog_treeview_clicked (GtkTreeView *treeview, + GdkEventButton *event, PanelPreferencesDialog *dialog) { gint x, y; @@ -1484,15 +1505,15 @@ panel_preferences_dialog_treeview_clicked (GtkTreeView *treeview, static void -panel_preferences_dialog_item_row_changed (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, +panel_preferences_dialog_item_row_changed (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, PanelPreferencesDialog *dialog) { XfcePanelPluginProvider *provider = NULL; - gint position; - GtkWidget *itembar; - gint store_position; + gint position; + GtkWidget *itembar; + gint store_position; panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); panel_return_if_fail (GTK_TREE_MODEL (dialog->store) == model); @@ -1528,19 +1549,17 @@ panel_preferences_dialog_item_row_changed (GtkTreeModel *model, static void -panel_preferences_dialog_item_selection_changed (GtkTreeSelection *selection, +panel_preferences_dialog_item_selection_changed (GtkTreeSelection *selection, PanelPreferencesDialog *dialog) { XfcePanelPluginProvider *provider; - GtkWidget *itembar; - gint position; - gint items; - gboolean active; - GObject *object; - guint i; - const gchar *button_names[] = { "item-remove", "item-up", - "item-down", "item-about", - "item-properties" }; + GtkWidget *itembar; + gint position; + gint items; + gboolean active; + GObject *object; + guint i; + const gchar *button_names[] = { "item-remove", "item-up", "item-down", "item-about", "item-properties" }; panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog)); @@ -1598,7 +1617,7 @@ static void panel_preferences_dialog_plug_deleted (GtkWidget *plug) { g_signal_handlers_disconnect_by_func (G_OBJECT (plug), - G_CALLBACK (panel_preferences_dialog_plug_deleted), NULL); + G_CALLBACK (panel_preferences_dialog_plug_deleted), NULL); g_object_unref (G_OBJECT (dialog_singleton)); } @@ -1608,16 +1627,16 @@ panel_preferences_dialog_plug_deleted (GtkWidget *plug) static void panel_preferences_dialog_show_internal (PanelWindow *active, - Window socket_window) + Window socket_window) { - gint panel_id = 0; - GObject *window, *widget; - GdkScreen *screen; - GSList *windows; + gint panel_id = 0; + GObject *window, *widget; + GdkScreen *screen; + GSList *windows; #ifdef ENABLE_X11 - GtkWidget *plug; - GObject *plug_child; - GtkWidget *content_area; + GtkWidget *plug; + GObject *plug_child; + GtkWidget *content_area; #endif panel_return_if_fail (active == NULL || PANEL_IS_WINDOW (active)); @@ -1687,7 +1706,7 @@ panel_preferences_dialog_show_internal (PanelWindow *active, dialog_singleton->socket_plug = NULL; g_signal_handlers_disconnect_by_func (G_OBJECT (plug), - G_CALLBACK (panel_preferences_dialog_plug_deleted), NULL); + G_CALLBACK (panel_preferences_dialog_plug_deleted), NULL); gtk_widget_destroy (plug); } #endif @@ -1713,7 +1732,7 @@ panel_preferences_dialog_show_internal (PanelWindow *active, /* create a new plug */ plug = gtk_plug_new (socket_window); g_signal_connect (G_OBJECT (plug), "delete-event", - G_CALLBACK (panel_preferences_dialog_plug_deleted), NULL); + G_CALLBACK (panel_preferences_dialog_plug_deleted), NULL); dialog_singleton->socket_plug = plug; gtk_widget_show (plug); @@ -1736,11 +1755,11 @@ panel_preferences_dialog_show (PanelWindow *active) void -panel_preferences_dialog_show_from_id (gint panel_id, - Window socket_window) +panel_preferences_dialog_show_from_id (gint panel_id, + Window socket_window) { PanelApplication *application; - PanelWindow *window; + PanelWindow *window; application = panel_application_get (); window = panel_application_get_window (application, panel_id); diff --git a/panel/panel-preferences-dialog.h b/panel/panel-preferences-dialog.h index 47b16a9fa..999c05b7b 100644 --- a/panel/panel-preferences-dialog.h +++ b/panel/panel-preferences-dialog.h @@ -33,12 +33,15 @@ G_BEGIN_DECLS #define PANEL_TYPE_PREFERENCES_DIALOG (panel_preferences_dialog_get_type ()) G_DECLARE_FINAL_TYPE (PanelPreferencesDialog, panel_preferences_dialog, PANEL, PREFERENCES_DIALOG, GtkBuilder) -void panel_preferences_dialog_show (PanelWindow *active); +void +panel_preferences_dialog_show (PanelWindow *active); -void panel_preferences_dialog_show_from_id (gint panel_id, - Window socket_window); +void +panel_preferences_dialog_show_from_id (gint panel_id, + Window socket_window); -gboolean panel_preferences_dialog_visible (void); +gboolean +panel_preferences_dialog_visible (void); G_END_DECLS diff --git a/panel/panel-tic-tac-toe.c b/panel/panel-tic-tac-toe.c index 63b2e512f..01756fe7f 100644 --- a/panel/panel-tic-tac-toe.c +++ b/panel/panel-tic-tac-toe.c @@ -29,28 +29,30 @@ -static void panel_tic_tac_toe_response (GtkDialog *dialog, - gint response_id); -static void panel_tic_tac_toe_move (PanelTicTacToe *dialog); -static void panel_tic_tac_toe_button_clicked (GtkWidget *button, - PanelTicTacToe *dialog); -static void panel_tic_tac_toe_new_game (PanelTicTacToe *dialog); +static void +panel_tic_tac_toe_response (GtkDialog *dialog, + gint response_id); +static void +panel_tic_tac_toe_move (PanelTicTacToe *dialog); +static void +panel_tic_tac_toe_button_clicked (GtkWidget *button, + PanelTicTacToe *dialog); +static void +panel_tic_tac_toe_new_game (PanelTicTacToe *dialog); -#define cells_to_hex(c1,c2,c3,c4,c5,c6,c7,c8,c9) (c1 << 0 | c2 << 1 | c3 << 2 | \ - c4 << 3 | c5 << 4 | c6 << 5 | \ - c7 << 6 | c8 << 7 | c9 << 8) -#define cells_to_hex2(c1,c2,c3,c4,c5,c6,c7,c8,c9) (c1 << 0 | c2 << 2 | c3 << 4 | \ - c4 << 6 | c5 << 8 | c6 << 10 | \ - c7 << 12 | c8 << 14 | c9 << 16) -#define winner_hex(winner,state) ((((winner) - 1) << 18) | (state)) +#define cells_to_hex(c1, c2, c3, c4, c5, c6, c7, c8, c9) \ + (c1 << 0 | c2 << 1 | c3 << 2 | c4 << 3 | c5 << 4 | c6 << 5 | c7 << 6 | c8 << 7 | c9 << 8) +#define cells_to_hex2(c1, c2, c3, c4, c5, c6, c7, c8, c9) \ + (c1 << 0 | c2 << 2 | c3 << 4 | c4 << 6 | c5 << 8 | c6 << 10 | c7 << 12 | c8 << 14 | c9 << 16) +#define winner_hex(winner, state) ((((winner) - 1) << 18) | (state)) struct _PanelTicTacToe { - XfceTitledDialog __parent__; + XfceTitledDialog __parent__; GtkWidget *buttons[9]; GtkWidget *labels[9]; @@ -67,10 +69,10 @@ enum enum { - ONE = 1, + ONE = 1, PLAYER_O = 2, PLAYER_X = 3, - TIE = 4 + TIE = 4 }; @@ -96,9 +98,9 @@ panel_tic_tac_toe_init (PanelTicTacToe *dialog) GtkWidget *button; GtkWidget *grid; GtkWidget *separator; - guint i; + guint i; GtkWidget *label; - guint row, col; + guint row, col; GtkWidget *vbox; GtkWidget *combo; GtkWidget *hbox; @@ -107,7 +109,7 @@ panel_tic_tac_toe_init (PanelTicTacToe *dialog) gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gtk_window_set_icon_name (GTK_WINDOW (dialog), "applications-games"); -#if !LIBXFCE4UI_CHECK_VERSION (4, 19, 3) +#if !LIBXFCE4UI_CHECK_VERSION(4, 19, 3) xfce_titled_dialog_create_action_area (XFCE_TITLED_DIALOG (dialog)); #endif @@ -156,7 +158,7 @@ panel_tic_tac_toe_init (PanelTicTacToe *dialog) gtk_widget_set_can_default (button, FALSE); gtk_widget_set_can_focus (button, FALSE); g_signal_connect (G_OBJECT (button), "clicked", - G_CALLBACK (panel_tic_tac_toe_button_clicked), dialog); + G_CALLBACK (panel_tic_tac_toe_button_clicked), dialog); label = dialog->labels[i] = gtk_label_new (""); gtk_container_add (GTK_CONTAINER (button), label); @@ -176,7 +178,7 @@ panel_tic_tac_toe_init (PanelTicTacToe *dialog) static void panel_tic_tac_toe_response (GtkDialog *gtk_dialog, - gint response_id) + gint response_id) { panel_return_if_fail (PANEL_IS_TIC_TAC_TOE (gtk_dialog)); @@ -197,9 +199,8 @@ static gint panel_tic_tac_toe_has_winner (gint state) { guint i; - gint player_x, player_o, tie; - gint matches[] = - { + gint player_x, player_o, tie; + gint matches[] = { /* horizontal */ cells_to_hex2 (ONE, ONE, ONE, 0, 0, 0, 0, 0, 0), cells_to_hex2 (0, 0, 0, ONE, ONE, ONE, 0, 0, 0), @@ -251,9 +252,10 @@ panel_tic_tac_toe_best_opening (gint state, if (state == 0) return possible_initial_moves; - mask = state & cells_to_hex2 (PLAYER_O, PLAYER_O, PLAYER_O, - PLAYER_O, PLAYER_O, PLAYER_O, - PLAYER_O, PLAYER_O, PLAYER_O); + mask = state + & cells_to_hex2 (PLAYER_O, PLAYER_O, PLAYER_O, + PLAYER_O, PLAYER_O, PLAYER_O, + PLAYER_O, PLAYER_O, PLAYER_O); /* user took the center, pick a corner */ if (mask == cells_to_hex2 (0, 0, 0, 0, PLAYER_O, 0, 0, 0, 0)) @@ -428,21 +430,20 @@ panel_tic_tac_toe_get_move (gint state, rate = -999; for (i = 0; i < 9; i++) { - if ((legal_moves & (1 << i)) == 0) - continue; - - value = panel_tic_tac_toe_get_move_rate (state, i, player, player, 15, 1); - if (value > rate) - { - /* found a better game, reset moves */ - rate = value; - moves = 0; - } - - /* add the moves with the current rating */ - if (rate == value) - moves |= (1 << i); - + if ((legal_moves & (1 << i)) == 0) + continue; + + value = panel_tic_tac_toe_get_move_rate (state, i, player, player, 15, 1); + if (value > rate) + { + /* found a better game, reset moves */ + rate = value; + moves = 0; + } + + /* add the moves with the current rating */ + if (rate == value) + moves |= (1 << i); } break; @@ -483,10 +484,10 @@ panel_tic_tac_toe_get_move (gint state, static gint panel_tic_tac_toe_get_state (PanelTicTacToe *dialog) { - gint state = 0; - gint i; + gint state = 0; + gint i; const gchar *text; - gint value; + gint value; panel_return_val_if_fail (PANEL_IS_TIC_TAC_TOE (dialog), 0); @@ -526,20 +527,18 @@ panel_tic_tac_toe_move (PanelTicTacToe *dialog) gtk_widget_set_sensitive (dialog->buttons[move], FALSE); gtk_label_set_text (GTK_LABEL (dialog->labels[move]), "X"); } - - } static void panel_tic_tac_toe_highlight_winner (PanelTicTacToe *dialog, - gint winner) + gint winner) { PangoAttribute *attr; - PangoAttrList *attrs; - gint i; - gint tie; + PangoAttrList *attrs; + gint i; + gint tie; panel_return_if_fail (PANEL_IS_TIC_TAC_TOE (dialog)); @@ -579,12 +578,12 @@ panel_tic_tac_toe_highlight_winner (PanelTicTacToe *dialog, static void -panel_tic_tac_toe_button_clicked (GtkWidget *button, +panel_tic_tac_toe_button_clicked (GtkWidget *button, PanelTicTacToe *dialog) { GtkWidget *label; - gint state; - gint winner; + gint state; + gint winner; panel_return_if_fail (PANEL_IS_TIC_TAC_TOE (dialog)); @@ -605,9 +604,9 @@ panel_tic_tac_toe_button_clicked (GtkWidget *button, static void panel_tic_tac_toe_new_game (PanelTicTacToe *dialog) { - PangoAttrList *attrs, *attrs_dup; + PangoAttrList *attrs, *attrs_dup; PangoAttribute *attr; - gint i; + gint i; attrs = pango_attr_list_new (); attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD); diff --git a/panel/panel-tic-tac-toe.h b/panel/panel-tic-tac-toe.h index 17e7a740a..fc18d4c15 100644 --- a/panel/panel-tic-tac-toe.h +++ b/panel/panel-tic-tac-toe.h @@ -29,7 +29,8 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (XfceTitledDialog, g_object_unref) #endif G_DECLARE_FINAL_TYPE (PanelTicTacToe, panel_tic_tac_toe, PANEL, TIC_TAC_TOE, XfceTitledDialog) -void panel_tic_tac_toe_show (void); +void +panel_tic_tac_toe_show (void); G_END_DECLS diff --git a/panel/panel-window.c b/panel/panel-window.c index 771de62fc..564a8365e 100644 --- a/panel/panel-window.c +++ b/panel/panel-window.c @@ -51,146 +51,196 @@ -#define SNAP_DISTANCE (10) -#define DEFAULT_POPUP_DELAY (225) +#define SNAP_DISTANCE (10) +#define DEFAULT_POPUP_DELAY (225) #define DEFAULT_POPDOWN_DELAY (350) -#define MIN_AUTOHIDE_SIZE (1) +#define MIN_AUTOHIDE_SIZE (1) #define DEFAULT_AUTOHIDE_SIZE (3) #define DEFAULT_POPDOWN_SPEED (25) -#define HANDLE_SPACING (4) -#define HANDLE_DOTS (2) -#define HANDLE_PIXELS (2) -#define HANDLE_PIXEL_SPACE (1) -#define HANDLE_SIZE (HANDLE_DOTS * (HANDLE_PIXELS + \ - HANDLE_PIXEL_SPACE) - HANDLE_PIXEL_SPACE) -#define HANDLE_SIZE_TOTAL (2 * HANDLE_SPACING + HANDLE_SIZE) +#define HANDLE_SPACING (4) +#define HANDLE_DOTS (2) +#define HANDLE_PIXELS (2) +#define HANDLE_PIXEL_SPACE (1) +#define HANDLE_SIZE (HANDLE_DOTS * (HANDLE_PIXELS + HANDLE_PIXEL_SPACE) - HANDLE_PIXEL_SPACE) +#define HANDLE_SIZE_TOTAL (2 * HANDLE_SPACING + HANDLE_SIZE) #define IS_HORIZONTAL(window) ((window)->mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) -typedef enum _StrutsEgde StrutsEgde; +typedef enum _StrutsEgde StrutsEgde; typedef enum _AutohideBehavior AutohideBehavior; typedef enum _AutohideState AutohideState; -typedef enum _SnapPosition SnapPosition; -typedef enum _PluginProp PluginProp; - - - -static void panel_window_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void panel_window_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void panel_window_constructed (GObject *object); -static void panel_window_finalize (GObject *object); -static gboolean panel_window_draw (GtkWidget *widget, - cairo_t *cr); -static gboolean panel_window_delete_event (GtkWidget *widget, - GdkEventAny *event); -static gboolean panel_window_enter_notify_event (GtkWidget *widget, - GdkEventCrossing *event); -static gboolean panel_window_leave_notify_event (GtkWidget *widget, - GdkEventCrossing *event); -static gboolean panel_window_drag_motion (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint drag_time); -static void panel_window_drag_leave (GtkWidget *widget, - GdkDragContext *context, - guint drag_time); -static gboolean panel_window_motion_notify_event (GtkWidget *widget, - GdkEventMotion *event); -static gboolean panel_window_button_press_event (GtkWidget *widget, - GdkEventButton *event); -static gboolean panel_window_button_release_event (GtkWidget *widget, - GdkEventButton *event); -static void panel_window_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static void panel_window_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height); -static void panel_window_get_preferred_width_for_height (GtkWidget *widget, - gint height, - gint *minimum_width, - gint *natural_width); -static void panel_window_get_preferred_height_for_width (GtkWidget *widget, - gint width, - gint *minimum_height, - gint *natural_height); -static void panel_window_size_allocate (GtkWidget *widget, - GtkAllocation *alloc); -static void panel_window_size_allocate_set_xy (PanelWindow *window, - gint window_width, - gint window_height, - gint *return_x, - gint *return_y); -static void panel_window_move (PanelWindow *window, - GtkWindow *moved, - gint x, - gint y); -static void panel_window_get_position (PanelWindow *window, - gint *x, - gint *y); -static void panel_window_screen_changed (GtkWidget *widget, - GdkScreen *previous_screen); -static void panel_window_style_updated (GtkWidget *widget); -static void panel_window_realize (GtkWidget *widget); -static StrutsEgde panel_window_screen_struts_edge (PanelWindow *window); -static void panel_window_screen_struts_set (PanelWindow *window); -static void panel_window_screen_update_borders (PanelWindow *window); -static SnapPosition panel_window_snap_position (PanelWindow *window); -static void panel_window_layer_set_anchor (PanelWindow *window); -static void panel_window_display_layout_debug (GtkWidget *widget); -static void panel_window_screen_layout_changed (GdkScreen *screen, - PanelWindow *window); -static void panel_window_active_window_changed (XfwScreen *screen, - XfwWindow *previous_window, - PanelWindow *window); -static void panel_window_active_window_geometry_changed (XfwWindow *active_window, - PanelWindow *window); -static void panel_window_active_window_state_changed (XfwWindow *active_window, - XfwWindowState changed, - XfwWindowState new, - PanelWindow *window); -static void panel_window_active_window_monitors (XfwWindow *active_window, - GParamSpec *pspec, - PanelWindow *window); -static void panel_window_xfw_window_closed (XfwWindow *xfw_window, - PanelWindow *window); -static void panel_window_autohide_timeout_destroy (gpointer user_data); -static void panel_window_autohide_ease_out_timeout_destroy (gpointer user_data); -static void panel_window_autohide_queue (PanelWindow *window, - AutohideState new_state); -static void panel_window_opacity_enter_queue (PanelWindow *window, - gboolean enter); -static gboolean panel_window_autohide_ease_out (gpointer data); -static void panel_window_set_autohide_behavior (PanelWindow *window, - AutohideBehavior behavior); -static void panel_window_update_autohide_window (PanelWindow *window, - XfwScreen *screen, - XfwWindow *active_window); -static void panel_window_menu_popup (PanelWindow *window, - GdkEventButton *event, - gboolean show_tic_tac_toe); -static void panel_window_plugins_update (PanelWindow *window, - PluginProp prop); -static void panel_window_plugin_set_mode (GtkWidget *widget, - gpointer user_data); -static void panel_window_plugin_set_size (GtkWidget *widget, - gpointer user_data); -static void panel_window_plugin_set_icon_size (GtkWidget *widget, - gpointer user_data); -static void panel_window_plugin_set_dark_mode (GtkWidget *widget, - gpointer user_data); -static void panel_window_plugin_set_nrows (GtkWidget *widget, - gpointer user_data); -static void panel_window_plugin_set_screen_position (GtkWidget *widget, - gpointer user_data); +typedef enum _SnapPosition SnapPosition; +typedef enum _PluginProp PluginProp; + + + +static void +panel_window_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +panel_window_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +panel_window_constructed (GObject *object); +static void +panel_window_finalize (GObject *object); +static gboolean +panel_window_draw (GtkWidget *widget, + cairo_t *cr); +static gboolean +panel_window_delete_event (GtkWidget *widget, + GdkEventAny *event); +static gboolean +panel_window_enter_notify_event (GtkWidget *widget, + GdkEventCrossing *event); +static gboolean +panel_window_leave_notify_event (GtkWidget *widget, + GdkEventCrossing *event); +static gboolean +panel_window_drag_motion (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint drag_time); +static void +panel_window_drag_leave (GtkWidget *widget, + GdkDragContext *context, + guint drag_time); +static gboolean +panel_window_motion_notify_event (GtkWidget *widget, + GdkEventMotion *event); +static gboolean +panel_window_button_press_event (GtkWidget *widget, + GdkEventButton *event); +static gboolean +panel_window_button_release_event (GtkWidget *widget, + GdkEventButton *event); +static void +panel_window_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width); +static void +panel_window_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height); +static void +panel_window_get_preferred_width_for_height (GtkWidget *widget, + gint height, + gint *minimum_width, + gint *natural_width); +static void +panel_window_get_preferred_height_for_width (GtkWidget *widget, + gint width, + gint *minimum_height, + gint *natural_height); +static void +panel_window_size_allocate (GtkWidget *widget, + GtkAllocation *alloc); +static void +panel_window_size_allocate_set_xy (PanelWindow *window, + gint window_width, + gint window_height, + gint *return_x, + gint *return_y); +static void +panel_window_move (PanelWindow *window, + GtkWindow *moved, + gint x, + gint y); +static void +panel_window_get_position (PanelWindow *window, + gint *x, + gint *y); +static void +panel_window_screen_changed (GtkWidget *widget, + GdkScreen *previous_screen); +static void +panel_window_style_updated (GtkWidget *widget); +static void +panel_window_realize (GtkWidget *widget); +static StrutsEgde +panel_window_screen_struts_edge (PanelWindow *window); +static void +panel_window_screen_struts_set (PanelWindow *window); +static void +panel_window_screen_update_borders (PanelWindow *window); +static SnapPosition +panel_window_snap_position (PanelWindow *window); +static void +panel_window_layer_set_anchor (PanelWindow *window); +static void +panel_window_display_layout_debug (GtkWidget *widget); +static void +panel_window_screen_layout_changed (GdkScreen *screen, + PanelWindow *window); +static void +panel_window_active_window_changed (XfwScreen *screen, + XfwWindow *previous_window, + PanelWindow *window); +static void +panel_window_active_window_geometry_changed (XfwWindow *active_window, + PanelWindow *window); +static void +panel_window_active_window_state_changed (XfwWindow *active_window, + XfwWindowState changed, + XfwWindowState new, + PanelWindow *window); +static void +panel_window_active_window_monitors (XfwWindow *active_window, + GParamSpec *pspec, + PanelWindow *window); +static void +panel_window_xfw_window_closed (XfwWindow *xfw_window, + PanelWindow *window); +static void +panel_window_autohide_timeout_destroy (gpointer user_data); +static void +panel_window_autohide_ease_out_timeout_destroy (gpointer user_data); +static void +panel_window_autohide_queue (PanelWindow *window, + AutohideState new_state); +static void +panel_window_opacity_enter_queue (PanelWindow *window, + gboolean enter); +static gboolean +panel_window_autohide_ease_out (gpointer data); +static void +panel_window_set_autohide_behavior (PanelWindow *window, + AutohideBehavior behavior); +static void +panel_window_update_autohide_window (PanelWindow *window, + XfwScreen *screen, + XfwWindow *active_window); +static void +panel_window_menu_popup (PanelWindow *window, + GdkEventButton *event, + gboolean show_tic_tac_toe); +static void +panel_window_plugins_update (PanelWindow *window, + PluginProp prop); +static void +panel_window_plugin_set_mode (GtkWidget *widget, + gpointer user_data); +static void +panel_window_plugin_set_size (GtkWidget *widget, + gpointer user_data); +static void +panel_window_plugin_set_icon_size (GtkWidget *widget, + gpointer user_data); +static void +panel_window_plugin_set_dark_mode (GtkWidget *widget, + gpointer user_data); +static void +panel_window_plugin_set_nrows (GtkWidget *widget, + gpointer user_data); +static void +panel_window_plugin_set_screen_position (GtkWidget *widget, + gpointer user_data); @@ -234,11 +284,11 @@ enum _AutohideBehavior enum _AutohideState { - AUTOHIDE_VISIBLE, /* visible */ - AUTOHIDE_POPDOWN, /* visible, but hide timeout is running */ + AUTOHIDE_VISIBLE, /* visible */ + AUTOHIDE_POPDOWN, /* visible, but hide timeout is running */ AUTOHIDE_POPDOWN_SLOW, /* same as popdown, but timeout is 4x longer */ - AUTOHIDE_HIDDEN, /* invisible */ - AUTOHIDE_POPUP, /* invisible, but show timeout is running */ + AUTOHIDE_HIDDEN, /* invisible */ + AUTOHIDE_POPUP, /* invisible, but show timeout is running */ }; enum _SnapPosition @@ -247,30 +297,30 @@ enum _SnapPosition SNAP_POSITION_NONE, /* snapping */ /* right edge */ - SNAP_POSITION_E, /* right */ - SNAP_POSITION_NE, /* top right */ - SNAP_POSITION_EC, /* right center */ - SNAP_POSITION_SE, /* bottom right */ + SNAP_POSITION_E, /* right */ + SNAP_POSITION_NE, /* top right */ + SNAP_POSITION_EC, /* right center */ + SNAP_POSITION_SE, /* bottom right */ /* left edge */ - SNAP_POSITION_W, /* left */ - SNAP_POSITION_NW, /* top left */ - SNAP_POSITION_WC, /* left center */ - SNAP_POSITION_SW, /* bottom left */ + SNAP_POSITION_W, /* left */ + SNAP_POSITION_NW, /* top left */ + SNAP_POSITION_WC, /* left center */ + SNAP_POSITION_SW, /* bottom left */ /* top and bottom */ - SNAP_POSITION_NC, /* top center */ - SNAP_POSITION_SC, /* bottom center */ - SNAP_POSITION_N, /* top */ - SNAP_POSITION_S, /* bottom */ + SNAP_POSITION_NC, /* top center */ + SNAP_POSITION_SC, /* bottom center */ + SNAP_POSITION_N, /* top */ + SNAP_POSITION_S, /* bottom */ }; enum { - EDGE_GRAVITY_NONE = 0, - EDGE_GRAVITY_START = (SNAP_POSITION_NE - SNAP_POSITION_E), + EDGE_GRAVITY_NONE = 0, + EDGE_GRAVITY_START = (SNAP_POSITION_NE - SNAP_POSITION_E), EDGE_GRAVITY_CENTER = (SNAP_POSITION_EC - SNAP_POSITION_E), - EDGE_GRAVITY_END = (SNAP_POSITION_SE - SNAP_POSITION_E) + EDGE_GRAVITY_END = (SNAP_POSITION_SE - SNAP_POSITION_E) }; enum _StrutsEgde @@ -301,76 +351,76 @@ enum struct _PanelWindow { - PanelBaseWindow __parent__; + PanelBaseWindow __parent__; /* unique id of this panel */ - gint id; + gint id; /* whether the user is allowed to make * changes to this window */ - guint locked : 1; + guint locked : 1; /* screen and working area of this panel */ - GdkScreen *screen; - GdkDisplay *display; - GdkRectangle area; + GdkScreen *screen; + GdkDisplay *display; + GdkRectangle area; /* struts information */ - StrutsEgde struts_edge; - gulong struts[N_STRUTS]; - guint struts_enabled : 1; + StrutsEgde struts_edge; + gulong struts[N_STRUTS]; + guint struts_enabled : 1; /* dark mode */ - gboolean dark_mode; + gboolean dark_mode; /* window positioning */ - guint size; - guint icon_size; - gdouble length; - guint length_max; - guint length_adjust : 1; - XfcePanelPluginMode mode; - guint nrows; - SnapPosition snap_position; - gboolean floating; - guint span_monitors : 1; - gchar *output_name; + guint size; + guint icon_size; + gdouble length; + guint length_max; + guint length_adjust : 1; + XfcePanelPluginMode mode; + guint nrows; + SnapPosition snap_position; + gboolean floating; + guint span_monitors : 1; + gchar *output_name; /* allocated position of the panel */ - GdkRectangle alloc; + GdkRectangle alloc; /* autohiding */ - XfwScreen *xfw_screen; - XfwWindow *xfw_active_window; - GtkWidget *autohide_window; - AutohideBehavior autohide_behavior; - AutohideState autohide_state; - guint autohide_timeout_id; - guint autohide_ease_out_id; - guint opacity_timeout_id; - gint autohide_block; - guint autohide_size; - guint popdown_speed; - gint popdown_progress; + XfwScreen *xfw_screen; + XfwWindow *xfw_active_window; + GtkWidget *autohide_window; + AutohideBehavior autohide_behavior; + AutohideState autohide_state; + guint autohide_timeout_id; + guint autohide_ease_out_id; + guint opacity_timeout_id; + gint autohide_block; + guint autohide_size; + guint popdown_speed; + gint popdown_progress; /* popup/down delay from gtk style */ - guint popup_delay; - guint popdown_delay; + guint popup_delay; + guint popdown_delay; /* whether the window position is locked */ - guint position_locked : 1; + guint position_locked : 1; /* window base point */ - gint base_x; - gint base_y; + gint base_x; + gint base_y; /* window drag information */ - guint32 grab_time; - gint grab_x; - gint grab_y; + guint32 grab_time; + gint grab_x; + gint grab_y; /* Wayland */ - gboolean wl_active_is_maximized; + gboolean wl_active_is_maximized; }; /* @@ -378,7 +428,7 @@ struct _PanelWindow * Not great, but removing this breaks backwards compatibility for autohide related style * properties, so better to keep it until these properties are changed to real settings. */ -typedef PanelWindow XfcePanelWindow; +typedef PanelWindow XfcePanelWindow; typedef PanelWindowClass XfcePanelWindowClass; @@ -395,7 +445,7 @@ G_DEFINE_FINAL_TYPE (XfcePanelWindow, panel_window, PANEL_TYPE_BASE_WINDOW) static void panel_window_class_init (PanelWindowClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; GtkWidgetClass *gtkwidget_class; gobject_class = G_OBJECT_CLASS (klass); @@ -428,7 +478,7 @@ panel_window_class_init (PanelWindowClass *klass) g_param_spec_int ("id", NULL, NULL, 0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS - | G_PARAM_CONSTRUCT_ONLY)); + | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (gobject_class, PROP_MODE, @@ -543,7 +593,7 @@ panel_window_class_init (PanelWindowClass *klass) gtk_widget_class_install_style_property (gtkwidget_class, g_param_spec_uint ("autohide-size", NULL, - "Size of hidden panel", + "Size of hidden panel", MIN_AUTOHIDE_SIZE, G_MAXUINT, DEFAULT_AUTOHIDE_SIZE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); @@ -617,7 +667,7 @@ panel_window_init (PanelWindow *window) window->popup_delay = DEFAULT_POPUP_DELAY; window->popdown_delay = DEFAULT_POPDOWN_DELAY; window->popdown_speed = DEFAULT_POPDOWN_SPEED; - window->popdown_progress = - G_MAXINT; + window->popdown_progress = -G_MAXINT; window->base_x = -1; window->base_y = -1; window->grab_time = 0; @@ -657,13 +707,13 @@ panel_window_init (PanelWindow *window) static void -panel_window_get_property (GObject *object, - guint prop_id, - GValue *value, +panel_window_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { PanelWindow *window = PANEL_WINDOW (object); - gchar *position; + gchar *position; switch (prop_id) { @@ -744,19 +794,19 @@ panel_window_get_property (GObject *object, static void -panel_window_set_property (GObject *object, - guint prop_id, +panel_window_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { - PanelWindow *window = PANEL_WINDOW (object); - gboolean val_bool; - guint val_uint; - gdouble val_double; - const gchar *val_string; - gboolean update = FALSE; - gint x, y, snap_position; - XfcePanelPluginMode val_mode; + PanelWindow *window = PANEL_WINDOW (object); + gboolean val_bool; + guint val_uint; + gdouble val_double; + const gchar *val_string; + gboolean update = FALSE; + gint x, y, snap_position; + XfcePanelPluginMode val_mode; switch (prop_id) { @@ -946,9 +996,9 @@ panel_window_set_property (GObject *object, static void panel_window_constructed (GObject *object) { - PanelWindow *window = PANEL_WINDOW (object); + PanelWindow *window = PANEL_WINDOW (object); GtkStyleContext *context; - gchar *style_class; + gchar *style_class; context = gtk_widget_get_style_context (GTK_WIDGET (window)); style_class = g_strdup_printf ("%s-%d", "panel", window->id); @@ -993,15 +1043,15 @@ panel_window_finalize (GObject *object) static gboolean panel_window_draw (GtkWidget *widget, - cairo_t *cr) + cairo_t *cr) { - PanelWindow *window = PANEL_WINDOW (widget); - GdkRGBA fg_rgba; - GdkRGBA *dark_rgba; - guint xx, yy, i; - gint xs, xe, ys, ye; - gint handle_w, handle_h; - GtkStyleContext *ctx; + PanelWindow *window = PANEL_WINDOW (widget); + GdkRGBA fg_rgba; + GdkRGBA *dark_rgba; + guint xx, yy, i; + gint xs, xe, ys, ye; + gint handle_w, handle_h; + GtkStyleContext *ctx; /* expose the background and borders handled in PanelBaseWindow */ (*GTK_WIDGET_CLASS (panel_window_parent_class)->draw) (widget, cr); @@ -1033,7 +1083,7 @@ panel_window_draw (GtkWidget *widget, cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); ctx = gtk_widget_get_style_context (widget); - gtk_style_context_get_color (ctx, gtk_widget_get_state_flags(widget), &fg_rgba); + gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (widget), &fg_rgba); dark_rgba = gdk_rgba_copy (&fg_rgba); fg_rgba.alpha = 0.5; dark_rgba->alpha = 0.15; @@ -1065,7 +1115,7 @@ panel_window_draw (GtkWidget *widget, static gboolean -panel_window_delete_event (GtkWidget *widget, +panel_window_delete_event (GtkWidget *widget, GdkEventAny *event) { /* do not respond to alt-f4 or any other signals */ @@ -1075,7 +1125,7 @@ panel_window_delete_event (GtkWidget *widget, static gboolean -panel_window_enter_notify_event (GtkWidget *widget, +panel_window_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event) { PanelWindow *window = PANEL_WINDOW (widget); @@ -1095,7 +1145,7 @@ panel_window_enter_notify_event (GtkWidget *widget, static gboolean -panel_window_leave_notify_event (GtkWidget *widget, +panel_window_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event) { if (event->detail != GDK_NOTIFY_INFERIOR) @@ -1107,11 +1157,11 @@ panel_window_leave_notify_event (GtkWidget *widget, static gboolean -panel_window_drag_motion (GtkWidget *widget, +panel_window_drag_motion (GtkWidget *widget, GdkDragContext *context, - gint x, - gint y, - guint drag_time) + gint x, + gint y, + guint drag_time) { if ((*GTK_WIDGET_CLASS (panel_window_parent_class)->drag_motion) != NULL) (*GTK_WIDGET_CLASS (panel_window_parent_class)->drag_motion) (widget, context, x, y, drag_time); @@ -1122,9 +1172,9 @@ panel_window_drag_motion (GtkWidget *widget, static void -panel_window_drag_leave (GtkWidget *widget, +panel_window_drag_leave (GtkWidget *widget, GdkDragContext *context, - guint drag_time) + guint drag_time) { PanelWindow *window = PANEL_WINDOW (widget); @@ -1148,21 +1198,21 @@ panel_window_drag_leave (GtkWidget *widget, static gboolean -panel_window_motion_notify_event (GtkWidget *widget, +panel_window_motion_notify_event (GtkWidget *widget, GdkEventMotion *event) { - PanelWindow *window = PANEL_WINDOW (widget); + PanelWindow *window = PANEL_WINDOW (widget); PanelBaseWindow *base_window = PANEL_BASE_WINDOW (widget); - SnapPosition snap_position; - gint pointer_x, pointer_y; - gint window_x, window_y; - gint high; - GdkScreen *screen = NULL; - gboolean retval = TRUE; + SnapPosition snap_position; + gint pointer_x, pointer_y; + gint window_x, window_y; + gint high; + GdkScreen *screen = NULL; + gboolean retval = TRUE; /* sometimes the panel does not receive enter events so let's fill this gap here */ if (panel_base_window_is_composited (base_window) - && ! panel_base_window_opacity_is_enter (base_window)) + && !panel_base_window_opacity_is_enter (base_window)) panel_window_opacity_enter_queue (window, TRUE); /* leave when the pointer is not grabbed */ @@ -1250,14 +1300,14 @@ panel_window_motion_notify_event (GtkWidget *widget, static gboolean -panel_window_button_press_event (GtkWidget *widget, +panel_window_button_press_event (GtkWidget *widget, GdkEventButton *event) { - PanelWindow *window = PANEL_WINDOW (widget); - GdkSeat *seat; - GdkCursor *cursor; - GdkGrabStatus status; - guint modifiers; + PanelWindow *window = PANEL_WINDOW (widget); + GdkSeat *seat; + GdkCursor *cursor; + GdkGrabStatus status; + guint modifiers; /* leave if the event is not for this window */ if (event->window != gtk_widget_get_window (widget)) @@ -1281,7 +1331,7 @@ panel_window_button_press_event (GtkWidget *widget, seat = gdk_device_get_seat (event->device); status = gdk_seat_grab (seat, event->window, GDK_SEAT_CAPABILITY_ALL_POINTING, - FALSE, cursor, (GdkEvent*)event, NULL, NULL); + FALSE, cursor, (GdkEvent *) event, NULL, NULL); } else if (gtk_layer_is_supported ()) { @@ -1327,7 +1377,7 @@ end: static gboolean -panel_window_button_release_event (GtkWidget *widget, +panel_window_button_release_event (GtkWidget *widget, GdkEventButton *event) { PanelWindow *window = PANEL_WINDOW (widget); @@ -1364,15 +1414,15 @@ panel_window_button_release_event (GtkWidget *widget, static void panel_window_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) + gint *minimum_width, + gint *natural_width) { - PanelWindow *window = PANEL_WINDOW (widget); - gint m_width = 0; - gint n_width = 0; - gint length; - gint extra_width = 0; - PanelBorders borders; + PanelWindow *window = PANEL_WINDOW (widget); + gint m_width = 0; + gint n_width = 0; + gint length; + gint extra_width = 0; + PanelBorders borders; /* get the child requisition */ if (gtk_bin_get_child (GTK_BIN (widget)) != NULL) @@ -1419,15 +1469,15 @@ panel_window_get_preferred_width (GtkWidget *widget, static void panel_window_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) + gint *minimum_height, + gint *natural_height) { - PanelWindow *window = PANEL_WINDOW (widget); - gint m_height = 0; - gint n_height = 0; - gint length; - gint extra_height = 0; - PanelBorders borders; + PanelWindow *window = PANEL_WINDOW (widget); + gint m_height = 0; + gint n_height = 0; + gint length; + gint extra_height = 0; + PanelBorders borders; /* get the child requisition */ if (gtk_bin_get_child (GTK_BIN (widget)) != NULL) @@ -1490,9 +1540,9 @@ panel_window_get_preferred_height (GtkWidget *widget, static void panel_window_get_preferred_width_for_height (GtkWidget *widget, - gint height, - gint *minimum_width, - gint *natural_width) + gint height, + gint *minimum_width, + gint *natural_width) { panel_window_get_preferred_width (widget, minimum_width, natural_width); } @@ -1501,9 +1551,9 @@ panel_window_get_preferred_width_for_height (GtkWidget *widget, static void panel_window_get_preferred_height_for_width (GtkWidget *widget, - gint width, - gint *minimum_height, - gint *natural_height) + gint width, + gint *minimum_height, + gint *natural_height) { panel_window_get_preferred_height (widget, minimum_height, natural_height); } @@ -1511,14 +1561,14 @@ panel_window_get_preferred_height_for_width (GtkWidget *widget, static void -panel_window_size_allocate (GtkWidget *widget, +panel_window_size_allocate (GtkWidget *widget, GtkAllocation *alloc) { - PanelWindow *window = PANEL_WINDOW (widget); - GtkAllocation child_alloc; - gint w, h, x, y; - PanelBorders borders; - GtkWidget *child; + PanelWindow *window = PANEL_WINDOW (widget); + GtkAllocation child_alloc; + gint w, h, x, y; + PanelBorders borders; + GtkWidget *child; gtk_widget_set_allocation (widget, alloc); window->alloc = *alloc; @@ -1531,7 +1581,7 @@ panel_window_size_allocate (GtkWidget *widget, || window->autohide_state == AUTOHIDE_POPUP)) { /* autohide timeout is already running, so let's wait with hiding the panel */ - if (window->autohide_timeout_id != 0 || window->popdown_progress != - G_MAXINT) + if (window->autohide_timeout_id != 0 || window->popdown_progress != -G_MAXINT) return; /* window is invisible */ @@ -1581,14 +1631,14 @@ panel_window_size_allocate (GtkWidget *widget, at are at the same time between two monitors) */ if (IS_HORIZONTAL (window) && (((y + h) == panel_screen_get_height (window->screen)) - || (y == 0))) + || (y == 0))) { window->popdown_progress = window->alloc.height; window->floating = FALSE; } else if (!IS_HORIZONTAL (window) && (((x + w) == panel_screen_get_width (window->screen)) - || (x == 0))) + || (x == 0))) { window->popdown_progress = window->alloc.width; window->floating = FALSE; @@ -1614,8 +1664,8 @@ panel_window_size_allocate (GtkWidget *widget, g_source_remove (window->autohide_ease_out_id); /* update the allocation */ - panel_window_size_allocate_set_xy (window, alloc->width, - alloc->height, &window->alloc.x, &window->alloc.y); + panel_window_size_allocate_set_xy (window, alloc->width, alloc->height, + &window->alloc.x, &window->alloc.y); /* update the struts if needed, leave when nothing changed */ if (window->struts_edge != STRUTS_EDGE_NONE @@ -1678,10 +1728,10 @@ panel_window_size_allocate (GtkWidget *widget, static void panel_window_size_allocate_set_xy (PanelWindow *window, - gint window_width, - gint window_height, - gint *return_x, - gint *return_y) + gint window_width, + gint window_height, + gint *return_x, + gint *return_y) { gint value, hight; @@ -1817,11 +1867,9 @@ panel_window_get_position (PanelWindow *window, if (gtk_layer_is_supported ()) { if (x != NULL) - *x = window->area.x + gtk_layer_get_margin (GTK_WINDOW (window), - GTK_LAYER_SHELL_EDGE_LEFT); + *x = window->area.x + gtk_layer_get_margin (GTK_WINDOW (window), GTK_LAYER_SHELL_EDGE_LEFT); if (y != NULL) - *y = window->area.y + gtk_layer_get_margin (GTK_WINDOW (window), - GTK_LAYER_SHELL_EDGE_TOP); + *y = window->area.y + gtk_layer_get_margin (GTK_WINDOW (window), GTK_LAYER_SHELL_EDGE_TOP); } else #endif @@ -1835,9 +1883,9 @@ panel_window_screen_changed (GtkWidget *widget, GdkScreen *previous_screen) { PanelWindow *window = PANEL_WINDOW (widget); - XfwWindow *xfw_window; - XfwScreen *xfw_screen; - GdkScreen *screen; + XfwWindow *xfw_window; + XfwScreen *xfw_screen; + GdkScreen *screen; if (G_LIKELY (GTK_WIDGET_CLASS (panel_window_parent_class)->screen_changed != NULL)) GTK_WIDGET_CLASS (panel_window_parent_class)->screen_changed (widget, previous_screen); @@ -1851,15 +1899,15 @@ panel_window_screen_changed (GtkWidget *widget, /* disconnect from previous screen */ if (G_UNLIKELY (window->screen != NULL)) g_signal_handlers_disconnect_by_func (G_OBJECT (window->screen), - panel_window_screen_layout_changed, window); + panel_window_screen_layout_changed, window); /* set the new screen */ window->screen = screen; window->display = gdk_screen_get_display (screen); g_signal_connect_object (G_OBJECT (window->screen), "monitors-changed", - G_CALLBACK (panel_window_screen_layout_changed), window, 0); + G_CALLBACK (panel_window_screen_layout_changed), window, 0); g_signal_connect_object (G_OBJECT (window->screen), "size-changed", - G_CALLBACK (panel_window_screen_layout_changed), window, 0); + G_CALLBACK (panel_window_screen_layout_changed), window, 0); /* update the screen layout */ panel_window_screen_layout_changed (screen, window); @@ -1900,16 +1948,16 @@ panel_window_style_updated (GtkWidget *widget) static GdkFilterReturn panel_window_filter (GdkXEvent *xev, - GdkEvent *gev, - gpointer data) + GdkEvent *gev, + gpointer data) { #ifdef ENABLE_X11 - PanelWindow *window = data; + PanelWindow *window = data; GdkEventButton *event = (GdkEventButton *) gev; - XEvent *xevent = (XEvent *) xev; - XButtonEvent *xbutton_event = (XButtonEvent *) xev; - GdkDevice *device; - gint position, limit, scale_factor; + XEvent *xevent = (XEvent *) xev; + XButtonEvent *xbutton_event = (XButtonEvent *) xev; + GdkDevice *device; + gint position, limit, scale_factor; panel_return_val_if_fail (PANEL_IS_WINDOW (window), GDK_FILTER_CONTINUE); @@ -1964,7 +2012,7 @@ static void panel_window_realize (GtkWidget *widget) { PanelWindow *window = PANEL_WINDOW (widget); - GdkWindow *gdkwindow; + GdkWindow *gdkwindow; (*GTK_WIDGET_CLASS (panel_window_parent_class)->realize) (widget); @@ -1989,7 +2037,7 @@ panel_window_screen_struts_edge (PanelWindow *window) /* no struts when autohide is active or they are disabled by the user */ if (window->autohide_behavior != AUTOHIDE_BEHAVIOR_NEVER - || ! window->struts_enabled) + || !window->struts_enabled) return STRUTS_EDGE_NONE; /* return the screen edge on which the window is @@ -2036,13 +2084,13 @@ panel_window_screen_struts_edge (PanelWindow *window) static void panel_window_screen_struts_set (PanelWindow *window) { - gulong struts[N_STRUTS] = { 0 }; - GdkRectangle *alloc = &window->alloc; - guint i; - gboolean update_struts = FALSE; - gint n, scale_factor; - const gchar *strut_border[] = { "left", "right", "top", "bottom" }; - const gchar *strut_xy[] = { "y", "y", "x", "x" }; + gulong struts[N_STRUTS] = { 0 }; + GdkRectangle *alloc = &window->alloc; + guint i; + gboolean update_struts = FALSE; + gint n, scale_factor; + const gchar *strut_border[] = { "left", "right", "top", "bottom" }; + const gchar *strut_xy[] = { "y", "y", "x", "x" }; panel_return_if_fail (PANEL_IS_WINDOW (window)); panel_return_if_fail (cardinal_atom != 0 && net_wm_strut_partial_atom != 0); @@ -2297,9 +2345,9 @@ panel_window_snap_position (PanelWindow *window) /* get the snap offsets */ snap_horz = panel_window_snap_edge_gravity (alloc.x, window->area.x, - window->area.x + window->area.width - alloc.width); + window->area.x + window->area.width - alloc.width); snap_vert = panel_window_snap_edge_gravity (alloc.y, window->area.y, - window->area.y + window->area.height - alloc.height); + window->area.y + window->area.height - alloc.height); /* detect the snap mode */ if (snap_horz == EDGE_GRAVITY_START) @@ -2455,15 +2503,15 @@ panel_window_layer_set_anchor (PanelWindow *window) static void panel_window_display_layout_debug (GtkWidget *widget) { - GdkDisplay *display; - GdkScreen *screen; - GdkMonitor *monitor; - gint m, n_monitors; - gint w, h; - GdkRectangle rect; - GString *str; - const gchar *name; - gboolean composite = FALSE; + GdkDisplay *display; + GdkScreen *screen; + GdkMonitor *monitor; + gint m, n_monitors; + gint w, h; + GdkRectangle rect; + GString *str; + const gchar *name; + gboolean composite = FALSE; panel_return_if_fail (GTK_IS_WIDGET (widget)); panel_return_if_fail (panel_debug_has_domain (PANEL_DEBUG_YES)); @@ -2471,7 +2519,7 @@ panel_window_display_layout_debug (GtkWidget *widget) str = g_string_new (NULL); display = gtk_widget_get_display (widget); - screen = gtk_widget_get_screen(widget); + screen = gtk_widget_get_screen (widget); w = panel_screen_get_width (screen); h = panel_screen_get_height (screen); @@ -2481,9 +2529,9 @@ panel_window_display_layout_debug (GtkWidget *widget) if (panel_debug_has_domain (PANEL_DEBUG_DISPLAY_LAYOUT)) { g_string_append_printf (str, "{comp=%s, sys=%p, rgba=%p}", - PANEL_DEBUG_BOOL (gdk_screen_is_composited (screen)), - gdk_screen_get_system_visual (screen), - gdk_screen_get_rgba_visual (screen)); + PANEL_DEBUG_BOOL (gdk_screen_is_composited (screen)), + gdk_screen_get_system_visual (screen), + gdk_screen_get_rgba_visual (screen)); } str = g_string_append (str, " ("); @@ -2498,7 +2546,7 @@ panel_window_display_layout_debug (GtkWidget *widget) gdk_monitor_get_geometry (monitor, &rect); g_string_append_printf (str, "%s=[%d,%d;%d,%d]", name, - rect.x, rect.y, rect.width, rect.height); + rect.x, rect.y, rect.width, rect.height); if (m < n_monitors - 1) g_string_append (str, ", "); @@ -2506,9 +2554,9 @@ panel_window_display_layout_debug (GtkWidget *widget) g_string_append (str, ")"); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS composite = gdk_display_supports_composite (display); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS panel_debug (PANEL_DEBUG_DISPLAY_LAYOUT, "%p: display=%s{comp=%s}, %s", widget, @@ -2522,15 +2570,15 @@ G_GNUC_END_IGNORE_DEPRECATIONS static void -panel_window_screen_layout_changed (GdkScreen *screen, +panel_window_screen_layout_changed (GdkScreen *screen, PanelWindow *window) { - GdkRectangle a = { 0 }, b; - gint n_monitors, n; - const gchar *name; - GdkMonitor *monitor = NULL; - StrutsEgde struts_edge; - gboolean force_struts_update = FALSE; + GdkRectangle a = { 0 }, b; + gint n_monitors, n; + const gchar *name; + GdkMonitor *monitor = NULL; + StrutsEgde struts_edge; + gboolean force_struts_update = FALSE; panel_return_if_fail (PANEL_IS_WINDOW (window)); panel_return_if_fail (GDK_IS_SCREEN (screen)); @@ -2568,7 +2616,7 @@ panel_window_screen_layout_changed (GdkScreen *screen, { /* get the screen geometry we also use this if there is only * one monitor and no output is choosen, as a fast-path */ - monitor = gdk_display_get_monitor(window->display, 0); + monitor = gdk_display_get_monitor (window->display, 0); gdk_monitor_get_geometry (monitor, &a); a.width += a.x; @@ -2576,7 +2624,7 @@ panel_window_screen_layout_changed (GdkScreen *screen, for (n = 1; n < n_monitors; n++) { - gdk_monitor_get_geometry (gdk_display_get_monitor(window->display, n), &b); + gdk_monitor_get_geometry (gdk_display_get_monitor (window->display, n), &b); a.x = MIN (a.x, b.x); a.y = MIN (a.y, b.y); @@ -2618,7 +2666,7 @@ panel_window_screen_layout_changed (GdkScreen *screen, && sscanf (window->output_name, "monitor-%d", &n) == 1) { /* check if extracted monitor number is out of range */ - monitor = gdk_display_get_monitor(window->display, n); + monitor = gdk_display_get_monitor (window->display, n); if (monitor != NULL) { gdk_monitor_get_geometry (monitor, &a); @@ -2630,7 +2678,7 @@ panel_window_screen_layout_changed (GdkScreen *screen, /* detect the monitor number by output name */ for (n = 0; n < n_monitors; n++) { - monitor = gdk_display_get_monitor(window->display, n); + monitor = gdk_display_get_monitor (window->display, n); name = gdk_monitor_get_model (monitor); /* check if this is the monitor we're looking for */ @@ -2693,8 +2741,8 @@ panel_window_screen_layout_changed (GdkScreen *screen, static void -panel_window_active_window_changed (XfwScreen *screen, - XfwWindow *previous_window, +panel_window_active_window_changed (XfwScreen *screen, + XfwWindow *previous_window, PanelWindow *window) { XfwWindow *active_window; @@ -2722,8 +2770,9 @@ panel_window_pointer_is_outside (PanelWindow *window) if (device != NULL) { gdkwindow = gdk_device_get_window_at_position (device, NULL, NULL); - is_outside = gdkwindow == NULL || gdk_window_get_effective_toplevel (gdkwindow) - != gtk_widget_get_window (GTK_WIDGET (window)); + is_outside = gdkwindow == NULL + || gdk_window_get_effective_toplevel (gdkwindow) + != gtk_widget_get_window (GTK_WIDGET (window)); /* * Besides the fact that the above check has to be done for each external plugin @@ -2746,7 +2795,7 @@ panel_window_pointer_is_outside (PanelWindow *window) for (lp = plugins; lp != NULL; lp = lp->next) if (PANEL_IS_PLUGIN_EXTERNAL (lp->data) - && ! panel_plugin_external_pointer_is_outside (lp->data)) + && !panel_plugin_external_pointer_is_outside (lp->data)) break; g_list_free (plugins); @@ -2762,12 +2811,12 @@ panel_window_pointer_is_outside (PanelWindow *window) static void -panel_window_active_window_geometry_changed (XfwWindow *active_window, +panel_window_active_window_geometry_changed (XfwWindow *active_window, PanelWindow *window) { GdkRectangle panel_area; GdkRectangle window_area; - gint scale_factor; + gint scale_factor; panel_return_if_fail (active_window == NULL || XFW_IS_WINDOW (active_window)); panel_return_if_fail (PANEL_IS_WINDOW (window)); @@ -2800,7 +2849,7 @@ panel_window_active_window_geometry_changed (XfwWindow *active_window, #ifdef ENABLE_X11 GdkWindow *gdkwindow; GtkBorder extents; - gboolean geometry_fixed = FALSE; + gboolean geometry_fixed = FALSE; /* obtain position and dimensions from the active window */ window_area = *(xfw_window_get_geometry (active_window)); @@ -2826,28 +2875,29 @@ panel_window_active_window_geometry_changed (XfwWindow *active_window, /* if a window is shaded, check the height of the window's * decoration as exposed through the _NET_FRAME_EXTENTS application * window property */ - if (! geometry_fixed && xfw_window_is_shaded (active_window)) - { - Display *display; - Atom real_type; - int real_format; - unsigned long items_read, items_left; - guint32 *data; - - display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); - if (XGetWindowProperty (display, xfw_window_x11_get_xid (active_window), - XInternAtom(display, "_NET_FRAME_EXTENTS", True), - 0, 4, FALSE, AnyPropertyType, - &real_type, &real_format, &items_read, &items_left, - (unsigned char **) &data) == Success - && (items_read >= 4)) - window_area.height = data[2] + data[3]; - - if (data) + if (!geometry_fixed && xfw_window_is_shaded (active_window)) { - XFree (data); + Display *display; + Atom real_type; + int real_format; + unsigned long items_read, items_left; + guint32 *data; + + display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + if (XGetWindowProperty (display, xfw_window_x11_get_xid (active_window), + XInternAtom (display, "_NET_FRAME_EXTENTS", True), + 0, 4, FALSE, AnyPropertyType, + &real_type, &real_format, &items_read, &items_left, + (unsigned char **) &data) + == Success + && (items_read >= 4)) + window_area.height = data[2] + data[3]; + + if (data) + { + XFree (data); + } } - } #endif /* apply scale factor */ @@ -2871,7 +2921,7 @@ panel_window_active_window_geometry_changed (XfwWindow *active_window, * with its coordinates */ if (window->autohide_state != AUTOHIDE_HIDDEN) { - if (gdk_rectangle_intersect (&panel_area, &window_area, NULL) + if (gdk_rectangle_intersect (&panel_area, &window_area, NULL) && panel_window_pointer_is_outside (window)) panel_window_autohide_queue (window, AUTOHIDE_POPDOWN); } @@ -2968,7 +3018,7 @@ panel_window_active_window_state_changed (XfwWindow *active_window, return; } - maximized = new & XFW_WINDOW_STATE_MAXIMIZED; + maximized = XFW_WINDOW_STATE_MAXIMIZED & new; if (maximized != window->wl_active_is_maximized && panel_window_xfw_window_on_panel_monitor (window, active_window)) { @@ -3001,7 +3051,7 @@ panel_window_xfw_window_closed (XfwWindow *xfw_window, panel_return_if_fail (XFW_IS_WINDOW (xfw_window)); - if (! window->wl_active_is_maximized) + if (!window->wl_active_is_maximized) return; /* see if there is a maximized window left on a monitor of interest */ @@ -3034,7 +3084,7 @@ panel_window_plugins_get_embedded (PanelWindow *window) for (lp = plugins; lp != NULL; lp = lp->next) if (PANEL_IS_PLUGIN_EXTERNAL (lp->data) - && ! panel_plugin_external_get_embedded (lp->data)) + && !panel_plugin_external_get_embedded (lp->data)) break; g_list_free (plugins); @@ -3053,7 +3103,7 @@ panel_window_autohide_timeout (gpointer user_data) /* wait for all external plugins to be embedded on Wayland, othewise there may be a crash * when remapping panel window in autohide_queue() */ - if (gtk_layer_is_supported () && ! panel_window_plugins_get_embedded (window)) + if (gtk_layer_is_supported () && !panel_window_plugins_get_embedded (window)) return TRUE; /* update the status */ @@ -3065,7 +3115,7 @@ panel_window_autohide_timeout (gpointer user_data) /* needs a recheck when timeout is over on Wayland, see panel_window_pointer_is_outside() */ if (gtk_layer_is_supported () && window->autohide_state == AUTOHIDE_HIDDEN - && ! panel_window_pointer_is_outside (window)) + && !panel_window_pointer_is_outside (window)) { window->autohide_state = AUTOHIDE_VISIBLE; return FALSE; @@ -3087,11 +3137,10 @@ panel_window_autohide_timeout (gpointer user_data) gtk_widget_queue_resize (GTK_WIDGET (window)); /* check whether the panel should be animated on autohide */ - if (! window->floating || window->popdown_speed > 0) - window->autohide_ease_out_id = - g_timeout_add_full (G_PRIORITY_LOW, 25, - panel_window_autohide_ease_out, window, - panel_window_autohide_ease_out_timeout_destroy); + if (!window->floating || window->popdown_speed > 0) + window->autohide_ease_out_id = g_timeout_add_full (G_PRIORITY_LOW, 25, + panel_window_autohide_ease_out, window, + panel_window_autohide_ease_out_timeout_destroy); return FALSE; } @@ -3104,7 +3153,7 @@ panel_window_autohide_timeout_destroy (gpointer user_data) PanelWindow *window = user_data; window->autohide_timeout_id = 0; - window->popdown_progress = - G_MAXINT; + window->popdown_progress = -G_MAXINT; } @@ -3124,9 +3173,9 @@ panel_window_cubic_ease_out (guint p) static gboolean panel_window_autohide_ease_out (gpointer data) { - PanelWindow *window = PANEL_WINDOW (data); - gint x, y, w, h, progress; - gboolean ret = TRUE; + PanelWindow *window = PANEL_WINDOW (data); + gint x, y, w, h, progress; + gboolean ret = TRUE; if (window->autohide_ease_out_id == 0) return FALSE; @@ -3190,14 +3239,14 @@ panel_window_autohide_ease_out_timeout_destroy (gpointer user_data) PanelWindow *window = user_data; window->autohide_ease_out_id = 0; - window->popdown_progress = - G_MAXINT; + window->popdown_progress = -G_MAXINT; } static void -panel_window_autohide_queue (PanelWindow *window, - AutohideState new_state) +panel_window_autohide_queue (PanelWindow *window, + AutohideState new_state) { AutohideState old_state = window->autohide_state; guint delay; @@ -3246,10 +3295,9 @@ panel_window_autohide_queue (PanelWindow *window, delay = window->popup_delay; /* start a new timeout to hide the panel */ - window->autohide_timeout_id = - g_timeout_add_full (G_PRIORITY_LOW, delay, - panel_window_autohide_timeout, window, - panel_window_autohide_timeout_destroy); + window->autohide_timeout_id = g_timeout_add_full (G_PRIORITY_LOW, delay, + panel_window_autohide_timeout, window, + panel_window_autohide_timeout_destroy); } } @@ -3270,7 +3318,7 @@ panel_window_opacity_enter_timeout (gpointer data) static void panel_window_opacity_enter_queue (PanelWindow *window, - gboolean enter) + gboolean enter) { if (window->opacity_timeout_id != 0) { @@ -3282,19 +3330,19 @@ panel_window_opacity_enter_queue (PanelWindow *window, if (enter) panel_base_window_opacity_enter (PANEL_BASE_WINDOW (window), TRUE); else - window->opacity_timeout_id = - g_timeout_add (DEFAULT_POPDOWN_DELAY, panel_window_opacity_enter_timeout, window); + window->opacity_timeout_id + = g_timeout_add (DEFAULT_POPDOWN_DELAY, panel_window_opacity_enter_timeout, window); } static gboolean -panel_window_autohide_drag_motion (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint drag_time, - PanelWindow *window) +panel_window_autohide_drag_motion (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint drag_time, + PanelWindow *window) { panel_return_val_if_fail (PANEL_IS_WINDOW (window), TRUE); panel_return_val_if_fail (window->autohide_window == widget, TRUE); @@ -3309,10 +3357,10 @@ panel_window_autohide_drag_motion (GtkWidget *widget, static void -panel_window_autohide_drag_leave (GtkWidget *widget, +panel_window_autohide_drag_leave (GtkWidget *widget, GdkDragContext *drag_context, - guint drag_time, - PanelWindow *window) + guint drag_time, + PanelWindow *window) { panel_return_if_fail (PANEL_IS_WINDOW (window)); panel_return_if_fail (window->autohide_window == widget); @@ -3324,9 +3372,9 @@ panel_window_autohide_drag_leave (GtkWidget *widget, static gboolean -panel_window_autohide_event (GtkWidget *widget, +panel_window_autohide_event (GtkWidget *widget, GdkEventCrossing *event, - PanelWindow *window) + PanelWindow *window) { panel_return_val_if_fail (PANEL_IS_WINDOW (window), FALSE); panel_return_val_if_fail (window->autohide_window == widget, FALSE); @@ -3345,8 +3393,8 @@ static void panel_window_set_autohide_behavior (PanelWindow *window, AutohideBehavior behavior) { - GtkWidget *popup; - guint i; + GtkWidget *popup; + guint i; const gchar *properties[] = { "enter-opacity", "leave-opacity", "borders", "background-style", "background-rgba", @@ -3370,7 +3418,7 @@ panel_window_set_autohide_behavior (PanelWindow *window, if (window->autohide_window == NULL) { GtkStyleContext *context; - gchar *style_class; + gchar *style_class; /* create the window */ panel_return_if_fail (window->autohide_window == NULL); @@ -3425,17 +3473,17 @@ panel_window_set_autohide_behavior (PanelWindow *window, /* signals for pointer enter/leave events */ g_signal_connect (G_OBJECT (popup), "enter-notify-event", - G_CALLBACK (panel_window_autohide_event), window); + G_CALLBACK (panel_window_autohide_event), window); g_signal_connect (G_OBJECT (popup), "leave-notify-event", - G_CALLBACK (panel_window_autohide_event), window); + G_CALLBACK (panel_window_autohide_event), window); /* show/hide the panel on drag events */ gtk_drag_dest_set (popup, 0, NULL, 0, 0); gtk_drag_dest_set_track_motion (popup, TRUE); g_signal_connect (G_OBJECT (popup), "drag-motion", - G_CALLBACK (panel_window_autohide_drag_motion), window); + G_CALLBACK (panel_window_autohide_drag_motion), window); g_signal_connect (G_OBJECT (popup), "drag-leave", - G_CALLBACK (panel_window_autohide_drag_leave), window); + G_CALLBACK (panel_window_autohide_drag_leave), window); /* show the window */ if (WINDOWING_IS_X11 () || gtk_layer_is_supported ()) @@ -3446,10 +3494,10 @@ panel_window_set_autohide_behavior (PanelWindow *window, { /* start autohide by hiding the panel straight away */ if (window->autohide_state != AUTOHIDE_HIDDEN) - { - panel_window_autohide_queue (window, - window->autohide_block == 0 ? AUTOHIDE_POPDOWN_SLOW : AUTOHIDE_VISIBLE); - } + { + panel_window_autohide_queue ( + window, window->autohide_block == 0 ? AUTOHIDE_POPDOWN_SLOW : AUTOHIDE_VISIBLE); + } } else if (window->autohide_behavior == AUTOHIDE_BEHAVIOR_INTELLIGENTLY) { @@ -3486,8 +3534,8 @@ panel_window_active_window_monitors_idle (gpointer data) static void panel_window_update_autohide_window (PanelWindow *window, - XfwScreen *screen, - XfwWindow *active_window) + XfwScreen *screen, + XfwWindow *active_window) { panel_return_if_fail (PANEL_IS_WINDOW (window)); panel_return_if_fail (screen == NULL || XFW_IS_SCREEN (screen)); @@ -3500,12 +3548,12 @@ panel_window_update_autohide_window (PanelWindow *window, if (G_LIKELY (window->xfw_active_window != NULL)) { g_signal_handlers_disconnect_by_func (window->xfw_active_window, - panel_window_active_window_geometry_changed, window); + panel_window_active_window_geometry_changed, window); g_signal_handlers_disconnect_by_func (window->xfw_active_window, - panel_window_active_window_state_changed, window); + panel_window_active_window_state_changed, window); if (gtk_layer_is_supported ()) g_signal_handlers_disconnect_by_func (window->xfw_active_window, - panel_window_active_window_monitors, window); + panel_window_active_window_monitors, window); } /* remember the new window */ @@ -3515,13 +3563,13 @@ panel_window_update_autohide_window (PanelWindow *window, if (active_window != NULL) { g_signal_connect (G_OBJECT (active_window), "geometry-changed", - G_CALLBACK (panel_window_active_window_geometry_changed), window); + G_CALLBACK (panel_window_active_window_geometry_changed), window); g_signal_connect (G_OBJECT (active_window), "state-changed", - G_CALLBACK (panel_window_active_window_state_changed), window); + G_CALLBACK (panel_window_active_window_state_changed), window); if (gtk_layer_is_supported ()) { g_signal_connect (G_OBJECT (active_window), "notify::monitors", - G_CALLBACK (panel_window_active_window_monitors), window); + G_CALLBACK (panel_window_active_window_monitors), window); /* wait for panel position to be initialized */ if (window->base_x == -1 && window->base_y == -1) @@ -3532,9 +3580,9 @@ panel_window_update_autohide_window (PanelWindow *window, /* stay connected even if the window is not active anymore, because * closing it can impact intellihide on Wayland */ g_signal_handlers_disconnect_by_func (active_window, - panel_window_xfw_window_closed, window); + panel_window_xfw_window_closed, window); g_signal_connect_object (G_OBJECT (active_window), "closed", - G_CALLBACK (panel_window_xfw_window_closed), window, 0); + G_CALLBACK (panel_window_xfw_window_closed), window, 0); } else /* simulate a geometry change for immediate hiding when the new active @@ -3550,7 +3598,7 @@ panel_window_update_autohide_window (PanelWindow *window, if (G_LIKELY (window->xfw_screen != NULL)) { g_signal_handlers_disconnect_by_func (window->xfw_screen, - panel_window_active_window_changed, window); + panel_window_active_window_changed, window); g_object_unref (window->xfw_screen); } @@ -3561,7 +3609,7 @@ panel_window_update_autohide_window (PanelWindow *window, if (screen != NULL) { g_signal_connect (G_OBJECT (screen), "active-window-changed", - G_CALLBACK (panel_window_active_window_changed), window); + G_CALLBACK (panel_window_active_window_changed), window); } } } @@ -3570,13 +3618,13 @@ panel_window_update_autohide_window (PanelWindow *window, static void panel_window_menu_toggle_locked (GtkCheckMenuItem *item, - PanelWindow *window) + PanelWindow *window) { panel_return_if_fail (GTK_IS_CHECK_MENU_ITEM (item)); panel_return_if_fail (PANEL_IS_WINDOW (window)); g_object_set (G_OBJECT (window), "position-locked", - gtk_check_menu_item_get_active (item), NULL); + gtk_check_menu_item_get_active (item), NULL); } @@ -3590,7 +3638,7 @@ panel_window_menu_help (void) static void -panel_window_menu_deactivate (GtkMenu *menu, +panel_window_menu_deactivate (GtkMenu *menu, PanelWindow *window) { panel_return_if_fail (GTK_IS_MENU (menu)); @@ -3605,9 +3653,9 @@ panel_window_menu_deactivate (GtkMenu *menu, static void -panel_window_menu_popup (PanelWindow *window, +panel_window_menu_popup (PanelWindow *window, GdkEventButton *event, - gboolean show_tic_tac_toe) + gboolean show_tic_tac_toe) { GtkWidget *menu; GtkWidget *item; @@ -3620,11 +3668,10 @@ panel_window_menu_popup (PanelWindow *window, /* create menu */ menu = gtk_menu_new (); - gtk_menu_set_screen (GTK_MENU (menu), - gtk_window_get_screen (GTK_WINDOW (window))); + gtk_menu_set_screen (GTK_MENU (menu), gtk_window_get_screen (GTK_WINDOW (window))); g_object_ref_sink (G_OBJECT (menu)); g_signal_connect (G_OBJECT (menu), "deactivate", - G_CALLBACK (panel_window_menu_deactivate), window); + G_CALLBACK (panel_window_menu_deactivate), window); item = gtk_menu_item_new_with_label (_("Panel")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); @@ -3640,7 +3687,7 @@ panel_window_menu_popup (PanelWindow *window, /* add new items */ item = panel_image_menu_item_new_with_mnemonic (_("Add _New Items...")); g_signal_connect_swapped (G_OBJECT (item), "activate", - G_CALLBACK (panel_item_dialog_show), window); + G_CALLBACK (panel_item_dialog_show), window); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); @@ -3651,7 +3698,7 @@ panel_window_menu_popup (PanelWindow *window, /* customize panel */ item = panel_image_menu_item_new_with_mnemonic (_("Panel Pr_eferences...")); g_signal_connect_swapped (G_OBJECT (item), "activate", - G_CALLBACK (panel_preferences_dialog_show), window); + G_CALLBACK (panel_preferences_dialog_show), window); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); @@ -3665,10 +3712,9 @@ panel_window_menu_popup (PanelWindow *window, item = gtk_check_menu_item_new_with_mnemonic (_("_Lock Panel")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), - window->position_locked); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), window->position_locked); g_signal_connect (G_OBJECT (item), "toggled", - G_CALLBACK (panel_window_menu_toggle_locked), window); + G_CALLBACK (panel_window_menu_toggle_locked), window); gtk_widget_show (item); item = gtk_separator_menu_item_new (); @@ -3679,7 +3725,7 @@ panel_window_menu_popup (PanelWindow *window, /* logout item */ item = panel_image_menu_item_new_with_mnemonic (_("Log _Out")); g_signal_connect_swapped (G_OBJECT (item), "activate", - G_CALLBACK (panel_application_logout), NULL); + G_CALLBACK (panel_application_logout), NULL); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); @@ -3696,7 +3742,7 @@ panel_window_menu_popup (PanelWindow *window, item = panel_image_menu_item_new_with_mnemonic (_("_Help")); panel_image_menu_item_set_image (item, image); g_signal_connect (G_OBJECT (item), "activate", - G_CALLBACK (panel_window_menu_help), NULL); + G_CALLBACK (panel_window_menu_help), NULL); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); @@ -3705,7 +3751,7 @@ panel_window_menu_popup (PanelWindow *window, item = panel_image_menu_item_new_with_mnemonic (_("_About")); panel_image_menu_item_set_image (item, image); g_signal_connect (G_OBJECT (item), "activate", - G_CALLBACK (panel_dialogs_show_about), NULL); + G_CALLBACK (panel_dialogs_show_about), NULL); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); @@ -3757,10 +3803,10 @@ panel_window_menu_popup (PanelWindow *window, static void panel_window_plugins_update (PanelWindow *window, - PluginProp prop) + PluginProp prop) { - GtkWidget *itembar; - GtkCallback func; + GtkWidget *itembar; + GtkCallback func; panel_return_if_fail (PANEL_IS_WINDOW (window)); @@ -3807,7 +3853,7 @@ panel_window_plugins_update (PanelWindow *window, static void panel_window_plugin_set_mode (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget)); panel_return_if_fail (PANEL_IS_WINDOW (user_data)); @@ -3820,7 +3866,7 @@ panel_window_plugin_set_mode (GtkWidget *widget, static void panel_window_plugin_set_size (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget)); panel_return_if_fail (PANEL_IS_WINDOW (user_data)); @@ -3833,7 +3879,7 @@ panel_window_plugin_set_size (GtkWidget *widget, static void panel_window_plugin_set_icon_size (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget)); panel_return_if_fail (PANEL_IS_WINDOW (user_data)); @@ -3846,7 +3892,7 @@ panel_window_plugin_set_icon_size (GtkWidget *widget, static void panel_window_plugin_set_dark_mode (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget)); panel_return_if_fail (PANEL_IS_WINDOW (user_data)); @@ -3859,7 +3905,7 @@ panel_window_plugin_set_dark_mode (GtkWidget *widget, static void panel_window_plugin_set_nrows (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget)); panel_return_if_fail (PANEL_IS_WINDOW (user_data)); @@ -3872,10 +3918,10 @@ panel_window_plugin_set_nrows (GtkWidget *widget, static void panel_window_plugin_set_screen_position (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { - PanelWindow *window = PANEL_WINDOW (user_data); - XfceScreenPosition position; + PanelWindow *window = PANEL_WINDOW (user_data); + XfceScreenPosition position; panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget)); panel_return_if_fail (PANEL_IS_WINDOW (user_data)); @@ -3883,52 +3929,43 @@ panel_window_plugin_set_screen_position (GtkWidget *widget, switch (window->snap_position) { case SNAP_POSITION_NONE: - position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_FLOATING_H : - XFCE_SCREEN_POSITION_FLOATING_V; + position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_FLOATING_H : XFCE_SCREEN_POSITION_FLOATING_V; break; case SNAP_POSITION_NW: - position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_NW_H : - XFCE_SCREEN_POSITION_NW_V; + position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_NW_H : XFCE_SCREEN_POSITION_NW_V; break; case SNAP_POSITION_NE: - position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_NE_H : - XFCE_SCREEN_POSITION_NE_V; + position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_NE_H : XFCE_SCREEN_POSITION_NE_V; break; case SNAP_POSITION_SW: - position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_SW_H : - XFCE_SCREEN_POSITION_SW_V; + position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_SW_H : XFCE_SCREEN_POSITION_SW_V; break; case SNAP_POSITION_SE: - position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_SE_H : - XFCE_SCREEN_POSITION_SE_V; + position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_SE_H : XFCE_SCREEN_POSITION_SE_V; break; case SNAP_POSITION_W: case SNAP_POSITION_WC: - position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_FLOATING_H : - XFCE_SCREEN_POSITION_W; + position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_FLOATING_H : XFCE_SCREEN_POSITION_W; break; case SNAP_POSITION_E: case SNAP_POSITION_EC: - position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_FLOATING_H : - XFCE_SCREEN_POSITION_E; + position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_FLOATING_H : XFCE_SCREEN_POSITION_E; break; case SNAP_POSITION_S: case SNAP_POSITION_SC: - position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_S : - XFCE_SCREEN_POSITION_FLOATING_V; + position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_S : XFCE_SCREEN_POSITION_FLOATING_V; break; case SNAP_POSITION_N: case SNAP_POSITION_NC: - position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_N : - XFCE_SCREEN_POSITION_FLOATING_V; + position = IS_HORIZONTAL (window) ? XFCE_SCREEN_POSITION_N : XFCE_SCREEN_POSITION_FLOATING_V; break; default: @@ -3944,8 +3981,8 @@ panel_window_plugin_set_screen_position (GtkWidget *widget, GtkWidget * panel_window_new (GdkScreen *screen, - gint id, - gint autohide_block) + gint id, + gint autohide_block) { PanelWindow *window; @@ -3991,8 +4028,8 @@ panel_window_has_position (PanelWindow *window) void panel_window_set_provider_info (PanelWindow *window, - GtkWidget *provider, - gboolean moving_to_other_panel) + GtkWidget *provider, + gboolean moving_to_other_panel) { PanelBaseWindow *base_window = PANEL_BASE_WINDOW (window); @@ -4007,13 +4044,15 @@ panel_window_set_provider_info (PanelWindow *window, PanelBgStyle style = panel_base_window_get_background_style (base_window); if (style == PANEL_BG_STYLE_COLOR) { - panel_plugin_external_set_background_color (PANEL_PLUGIN_EXTERNAL (provider), - panel_base_window_get_background_rgba (base_window)); + panel_plugin_external_set_background_color ( + PANEL_PLUGIN_EXTERNAL (provider), + panel_base_window_get_background_rgba (base_window)); } else if (style == PANEL_BG_STYLE_IMAGE) { - panel_plugin_external_set_background_image (PANEL_PLUGIN_EXTERNAL (provider), - panel_base_window_get_background_image (base_window)); + panel_plugin_external_set_background_image ( + PANEL_PLUGIN_EXTERNAL (provider), + panel_base_window_get_background_image (base_window)); } else if (moving_to_other_panel) { @@ -4088,7 +4127,7 @@ panel_window_thaw_autohide (PanelWindow *window) void panel_window_set_locked (PanelWindow *window, - gboolean locked) + gboolean locked) { panel_return_if_fail (PANEL_IS_WINDOW (window)); @@ -4174,7 +4213,7 @@ panel_window_migrate_old_properties (PanelWindow *window, { /* no old property: nothing to do */ old_property = g_strdup_printf ("%s/%s", property_base, old_properties[i].property); - if (! xfconf_channel_has_property (xfconf, old_property)) + if (!xfconf_channel_has_property (xfconf, old_property)) { g_free (old_property); continue; @@ -4211,7 +4250,7 @@ panel_window_migrate_old_properties (PanelWindow *window, { case G_TYPE_BOOLEAN: if (g_strcmp0 (new_properties[i].property, "enable-struts") == 0) - new_bool = ! old_bool; + new_bool = !old_bool; else { g_warning ("Unrecognized new property '%s'", new_properties[i].property); diff --git a/panel/panel-window.h b/panel/panel-window.h index bce87a82d..9f002419a 100644 --- a/panel/panel-window.h +++ b/panel/panel-window.h @@ -43,36 +43,47 @@ G_BEGIN_DECLS #define PANEL_TYPE_WINDOW (panel_window_get_type ()) G_DECLARE_FINAL_TYPE (PanelWindow, panel_window, PANEL, WINDOW, PanelBaseWindow) -GtkWidget *panel_window_new (GdkScreen *screen, - gint id, - gint autohide_block) G_GNUC_MALLOC; +GtkWidget * +panel_window_new (GdkScreen *screen, + gint id, + gint autohide_block) G_GNUC_MALLOC; -gint panel_window_get_id (PanelWindow *window); +gint +panel_window_get_id (PanelWindow *window); -gboolean panel_window_has_position (PanelWindow *window); +gboolean +panel_window_has_position (PanelWindow *window); -void panel_window_set_provider_info (PanelWindow *window, - GtkWidget *provider, - gboolean moving_to_other_panel); +void +panel_window_set_provider_info (PanelWindow *window, + GtkWidget *provider, + gboolean moving_to_other_panel); -void panel_window_freeze_autohide (PanelWindow *window); +void +panel_window_freeze_autohide (PanelWindow *window); -void panel_window_thaw_autohide (PanelWindow *window); +void +panel_window_thaw_autohide (PanelWindow *window); -void panel_window_set_locked (PanelWindow *window, - gboolean locked); +void +panel_window_set_locked (PanelWindow *window, + gboolean locked); -gboolean panel_window_get_locked (PanelWindow *window); +gboolean +panel_window_get_locked (PanelWindow *window); -void panel_window_focus (PanelWindow *window); +void +panel_window_focus (PanelWindow *window); -void panel_window_migrate_old_properties (PanelWindow *window, - XfconfChannel *xfconf, - const gchar *property_base, - const PanelProperty *old_properties, - const PanelProperty *new_properties); +void +panel_window_migrate_old_properties (PanelWindow *window, + XfconfChannel *xfconf, + const gchar *property_base, + const PanelProperty *old_properties, + const PanelProperty *new_properties); -gboolean panel_window_pointer_is_outside (PanelWindow *window); +gboolean +panel_window_pointer_is_outside (PanelWindow *window); G_END_DECLS diff --git a/plugins/actions/actions.c b/plugins/actions/actions.c index 67633eb53..bb96bdca1 100644 --- a/plugins/actions/actions.c +++ b/plugins/actions/actions.c @@ -34,32 +34,43 @@ -#define DEFAULT_TITLE _("Session Menu") -#define DEFAULT_TIMEOUT (30) - - - -static void actions_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void actions_plugin_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void actions_plugin_construct (XfcePanelPlugin *panel_plugin); -static void actions_plugin_free_data (XfcePanelPlugin *panel_plugin); -static gboolean actions_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); -static void actions_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); -static void actions_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode); -static void actions_plugin_nrows_changed (XfcePanelPlugin *panel_plugin, - guint rows); -static void actions_plugin_pack (ActionsPlugin *plugin); -static GPtrArray *actions_plugin_default_array (void); -static void actions_plugin_menu (GtkWidget *button, - ActionsPlugin *plugin); +#define DEFAULT_TITLE _("Session Menu") +#define DEFAULT_TIMEOUT (30) + + + +static void +actions_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +actions_plugin_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +actions_plugin_construct (XfcePanelPlugin *panel_plugin); +static void +actions_plugin_free_data (XfcePanelPlugin *panel_plugin); +static gboolean +actions_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); +static void +actions_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); +static void +actions_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode); +static void +actions_plugin_nrows_changed (XfcePanelPlugin *panel_plugin, + guint rows); +static void +actions_plugin_pack (ActionsPlugin *plugin); +static GPtrArray * +actions_plugin_default_array (void); +static void +actions_plugin_menu (GtkWidget *button, + ActionsPlugin *plugin); @@ -67,8 +78,7 @@ typedef enum { APPEARANCE_TYPE_BUTTONS, APPEARANCE_TYPE_MENU -} -AppearanceType; +} AppearanceType; typedef enum { @@ -76,8 +86,7 @@ typedef enum BUTTON_TITLE_TYPE_USERNAME, BUTTON_TITLE_TYPE_USERID, BUTTON_TITLE_TYPE_CUSTOM -} -ButtonTitleType; +} ButtonTitleType; enum { @@ -101,37 +110,36 @@ struct _ActionsPlugin { XfcePanelPlugin __parent__; - AppearanceType type; + AppearanceType type; ButtonTitleType button_title; - gchar *custom_title; - GPtrArray *items; - GtkWidget *menu; - guint ask_confirmation : 1; - guint pack_idle_id; - guint watch_id; - GDBusProxy *proxy; - const gchar *switch_user_cmd; - const gchar *lock_session_cmd; + gchar *custom_title; + GPtrArray *items; + GtkWidget *menu; + guint ask_confirmation : 1; + guint pack_idle_id; + guint watch_id; + GDBusProxy *proxy; + const gchar *switch_user_cmd; + const gchar *lock_session_cmd; }; typedef enum { - ACTION_TYPE_SEPARATOR = 1 << 1, - ACTION_TYPE_LOGOUT = 1 << 2, + ACTION_TYPE_SEPARATOR = 1 << 1, + ACTION_TYPE_LOGOUT = 1 << 2, ACTION_TYPE_LOGOUT_DIALOG = 1 << 3, - ACTION_TYPE_SWITCH_USER = 1 << 4, - ACTION_TYPE_LOCK_SCREEN = 1 << 5, - ACTION_TYPE_HIBERNATE = 1 << 6, - ACTION_TYPE_HYBRID_SLEEP = 1 << 7, - ACTION_TYPE_SUSPEND = 1 << 8, - ACTION_TYPE_RESTART = 1 << 9, - ACTION_TYPE_SHUTDOWN = 1 << 10 -} -ActionType; + ACTION_TYPE_SWITCH_USER = 1 << 4, + ACTION_TYPE_LOCK_SCREEN = 1 << 5, + ACTION_TYPE_HIBERNATE = 1 << 6, + ACTION_TYPE_HYBRID_SLEEP = 1 << 7, + ACTION_TYPE_SUSPEND = 1 << 8, + ACTION_TYPE_RESTART = 1 << 9, + ACTION_TYPE_SHUTDOWN = 1 << 10 +} ActionType; typedef struct { - ActionType type; + ActionType type; const gchar *name; const gchar *display_name; const gchar *mnemonic; @@ -139,102 +147,89 @@ typedef struct const gchar *status; const gchar *icon_name; const gchar *fallback_icon_name; -} -ActionEntry; +} ActionEntry; typedef struct { ActionEntry *entry; - GtkWidget *dialog; - gint time_left; - guint unattended : 1; -} -ActionTimeout; + GtkWidget *dialog; + gint time_left; + guint unattended : 1; +} ActionTimeout; -static ActionEntry action_entries[] = -{ +static ActionEntry action_entries[] = { { ACTION_TYPE_SEPARATOR, "separator", - NULL, NULL, NULL, NULL, NULL, NULL /* not needed */ - }, + NULL, NULL, NULL, NULL, NULL, NULL /* not needed */ }, { ACTION_TYPE_LOGOUT, "logout-dialog", - N_("Log Out"), - N_("_Log Out"), - N_("Are you sure you want to log out?"), - N_("Logging out in %d seconds."), + N_ ("Log Out"), + N_ ("_Log Out"), + N_ ("Are you sure you want to log out?"), + N_ ("Logging out in %d seconds."), "xfsm-logout", - "system-log-out" - }, + "system-log-out" }, { ACTION_TYPE_LOGOUT_DIALOG, "logout", - N_("Log Out..."), - N_("Log _Out..."), + N_ ("Log Out..."), + N_ ("Log _Out..."), NULL, NULL, /* already shows a dialog */ "xfsm-logout", - "system-log-out" - }, + "system-log-out" }, { ACTION_TYPE_SWITCH_USER, "switch-user", - N_("Switch User"), - N_("_Switch User"), + N_ ("Switch User"), + N_ ("_Switch User"), NULL, NULL, /* not needed */ "xfsm-switch-user", - "system-users" - }, + "system-users" }, { ACTION_TYPE_LOCK_SCREEN, "lock-screen", - N_("Lock Screen"), - N_("Loc_k Screen"), + N_ ("Lock Screen"), + N_ ("Loc_k Screen"), NULL, NULL, /* not needed */ "xfsm-lock", - "system-lock-screen" - }, + "system-lock-screen" }, { ACTION_TYPE_HIBERNATE, "hibernate", - N_("Hibernate"), - N_("_Hibernate"), - N_("Do you want to suspend to disk?"), - N_("Hibernating computer in %d seconds."), + N_ ("Hibernate"), + N_ ("_Hibernate"), + N_ ("Do you want to suspend to disk?"), + N_ ("Hibernating computer in %d seconds."), "xfsm-hibernate", - "system-hibernate" - }, + "system-hibernate" }, { ACTION_TYPE_HYBRID_SLEEP, "hybrid-sleep", - N_("Hybrid Sleep"), - N_("_Hybrid Sleep"), - N_("Do you want to hibernate and suspend the system?"), - N_("Hibernating and Suspending computer in %d seconds."), + N_ ("Hybrid Sleep"), + N_ ("_Hybrid Sleep"), + N_ ("Do you want to hibernate and suspend the system?"), + N_ ("Hibernating and Suspending computer in %d seconds."), "xfsm-hibernate", - "system-hibernate" - }, + "system-hibernate" }, { ACTION_TYPE_SUSPEND, "suspend", - N_("Suspend"), - N_("Sus_pend"), - N_("Do you want to suspend to RAM?"), - N_("Suspending computer in %d seconds."), + N_ ("Suspend"), + N_ ("Sus_pend"), + N_ ("Do you want to suspend to RAM?"), + N_ ("Suspending computer in %d seconds."), "xfsm-suspend", - "system-suspend" - }, + "system-suspend" }, { ACTION_TYPE_RESTART, "restart", - N_("Restart"), - N_("_Restart"), - N_("Are you sure you want to restart?"), - N_("Restarting computer in %d seconds."), + N_ ("Restart"), + N_ ("_Restart"), + N_ ("Are you sure you want to restart?"), + N_ ("Restarting computer in %d seconds."), "xfsm-reboot", - "system-reboot" - }, + "system-reboot" }, { ACTION_TYPE_SHUTDOWN, "shutdown", - N_("Shut Down"), - N_("Shut _Down"), - N_("Are you sure you want to shut down?"), - N_("Turning off computer in %d seconds."), + N_ ("Shut Down"), + N_ ("Shut _Down"), + N_ ("Are you sure you want to shut down?"), + N_ ("Turning off computer in %d seconds."), "xfsm-shutdown", - "system-shutdown" - } + "system-shutdown" } }; @@ -244,7 +239,7 @@ XFCE_PANEL_DEFINE_PLUGIN (ActionsPlugin, actions_plugin) -static GQuark action_quark = 0; +static GQuark action_quark = 0; @@ -252,7 +247,7 @@ static void actions_plugin_class_init (ActionsPluginClass *klass) { XfcePanelPluginClass *plugin_class; - GObjectClass *gobject_class; + GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->set_property = actions_plugin_set_property; @@ -374,7 +369,7 @@ actions_plugin_init (ActionsPlugin *plugin) static void actions_plugin_free_array_element (gpointer data) { - GValue *value = (GValue *)data; + GValue *value = (GValue *) data; g_value_unset (value); g_free (value); @@ -383,9 +378,9 @@ actions_plugin_free_array_element (gpointer data) static void -actions_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, +actions_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { ActionsPlugin *plugin = ACTIONS_PLUGIN (object); @@ -405,8 +400,7 @@ actions_plugin_get_property (GObject *object, break; case PROP_CUSTOM_TITLE: - g_value_set_string (value, plugin->custom_title == NULL ? - DEFAULT_TITLE : plugin->custom_title); + g_value_set_string (value, plugin->custom_title == NULL ? DEFAULT_TITLE : plugin->custom_title); break; case PROP_ASK_CONFIRMATION: @@ -422,19 +416,20 @@ actions_plugin_get_property (GObject *object, static void -actions_plugin_set_property (GObject *object, - guint prop_id, +actions_plugin_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { ActionsPlugin *plugin = ACTIONS_PLUGIN (object); switch (prop_id) { case PROP_ITEMS: - if (plugin->items != NULL) { - g_ptr_array_unref (plugin->items); - } + if (plugin->items != NULL) + { + g_ptr_array_unref (plugin->items); + } plugin->items = g_value_dup_boxed (value); actions_plugin_pack (plugin); break; @@ -470,9 +465,8 @@ actions_plugin_set_property (GObject *object, static void actions_plugin_construct (XfcePanelPlugin *panel_plugin) { - ActionsPlugin *plugin = ACTIONS_PLUGIN (panel_plugin); - const PanelProperty properties[] = - { + ActionsPlugin *plugin = ACTIONS_PLUGIN (panel_plugin); + const PanelProperty properties[] = { { "items", G_TYPE_PTR_ARRAY }, { "appearance", G_TYPE_UINT }, { "button-title", G_TYPE_UINT }, @@ -492,8 +486,7 @@ actions_plugin_construct (XfcePanelPlugin *panel_plugin) actions_plugin_pack (plugin); /* set orientation and size */ - actions_plugin_mode_changed (panel_plugin, - xfce_panel_plugin_get_mode (panel_plugin)); + actions_plugin_mode_changed (panel_plugin, xfce_panel_plugin_get_mode (panel_plugin)); } @@ -522,14 +515,14 @@ actions_plugin_free_data (XfcePanelPlugin *panel_plugin) static gboolean actions_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { ActionsPlugin *plugin = ACTIONS_PLUGIN (panel_plugin); - GtkWidget *box; - GList *children, *li; - gint max_size; - GtkImage *icon; - gint icon_size; + GtkWidget *box; + GList *children, *li; + gint max_size; + GtkImage *icon; + gint icon_size; if (plugin->type == APPEARANCE_TYPE_BUTTONS) { @@ -564,13 +557,13 @@ static gboolean actions_plugin_configure_store (gpointer data) { ActionsPlugin *plugin = ACTIONS_PLUGIN (data); - GtkTreeModel *model; - GtkTreeIter iter; - GPtrArray *array; - gboolean visible; - gchar *name; - GValue *val; - gchar save_name[32]; + GtkTreeModel *model; + GtkTreeIter iter; + GPtrArray *array; + gboolean visible; + gchar *name; + GValue *val; + gchar save_name[32]; model = g_object_get_data (G_OBJECT (plugin), "items-store"); panel_return_val_if_fail (GTK_IS_LIST_STORE (model), FALSE); @@ -619,11 +612,11 @@ actions_plugin_configure_store_idle (ActionsPlugin *plugin) static void actions_plugin_configure_visible_toggled (GtkCellRendererToggle *renderer, - const gchar *path_string, - ActionsPlugin *plugin) + const gchar *path_string, + ActionsPlugin *plugin) { - GtkTreeIter iter; - gboolean visible; + GtkTreeIter iter; + gboolean visible; GtkTreeModel *model; panel_return_if_fail (ACTIONS_IS_PLUGIN (plugin)); @@ -658,7 +651,7 @@ actions_plugin_lookup_entry (const gchar *name) static void actions_plugin_combo_title_changed_cb (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { GtkBuilder *builder = GTK_BUILDER (user_data); @@ -674,20 +667,20 @@ static void actions_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) { ActionsPlugin *plugin = ACTIONS_PLUGIN (panel_plugin); - GtkBuilder *builder; - GObject *dialog; - GObject *object; - GObject *combo; - ActionEntry *entry; - guint i; - const GValue *val; - const gchar *name; - guint n; - GObject *store; - gboolean found; - GtkTreeIter iter; - gchar *sep_str; - const gchar *display_name; + GtkBuilder *builder; + GObject *dialog; + GObject *object; + GObject *combo; + ActionEntry *entry; + guint i; + const GValue *val; + const gchar *name; + guint n; + GObject *store; + gboolean found; + GtkTreeIter iter; + gchar *sep_str; + const gchar *display_name; panel_return_if_fail (ACTIONS_IS_PLUGIN (plugin)); panel_return_if_fail (plugin->items != NULL); @@ -733,7 +726,7 @@ actions_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) object = gtk_builder_get_object (builder, "visible-toggle"); panel_return_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (object)); g_signal_connect (G_OBJECT (object), "toggled", - G_CALLBACK (actions_plugin_configure_visible_toggled), plugin); + G_CALLBACK (actions_plugin_configure_visible_toggled), plugin); sep_str = g_markup_printf_escaped ("<span color='grey' style='italic'>%s</span>", _("Separator")); @@ -798,7 +791,7 @@ actions_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) /* save on dnd changes */ g_signal_connect_swapped (G_OBJECT (store), "row-inserted", - G_CALLBACK (actions_plugin_configure_store_idle), plugin); + G_CALLBACK (actions_plugin_configure_store_idle), plugin); gtk_widget_show (GTK_WIDGET (dialog)); } @@ -806,8 +799,8 @@ actions_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) static void -actions_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode) +actions_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode) { actions_plugin_pack (ACTIONS_PLUGIN (panel_plugin)); } @@ -816,7 +809,7 @@ actions_plugin_mode_changed (XfcePanelPlugin *panel_plugin, static void actions_plugin_nrows_changed (XfcePanelPlugin *panel_plugin, - guint rows) + guint rows) { actions_plugin_pack (ACTIONS_PLUGIN (panel_plugin)); } @@ -852,15 +845,15 @@ actions_plugin_action_confirmation_time (gpointer data) static gboolean actions_plugin_action_confirmation (ActionsPlugin *plugin, - ActionEntry *entry, - gboolean *unattended) + ActionEntry *entry, + gboolean *unattended) { - GtkWidget *dialog; - GtkWidget *button; - gint result; - GtkWidget *image; + GtkWidget *dialog; + GtkWidget *button; + gint result; + GtkWidget *image; ActionTimeout *timeout; - guint timeout_id; + guint timeout_id; panel_return_val_if_fail (entry->question != NULL, FALSE); panel_return_val_if_fail (entry->status != NULL, FALSE); @@ -909,10 +902,10 @@ actions_plugin_action_confirmation (ActionsPlugin *plugin, static gboolean actions_plugin_action_dbus_xfsm (ActionsPlugin *plugin, - const gchar *method, - gboolean show_dialog, - gboolean allow_save, - GError **error) + const gchar *method, + gboolean show_dialog, + gboolean allow_save, + GError **error) { if (G_LIKELY (plugin->proxy != NULL)) { @@ -985,7 +978,7 @@ actions_plugin_action_dbus_xfsm (ActionsPlugin *plugin, static gboolean -actions_plugin_action_dbus_can (GDBusProxy *proxy, +actions_plugin_action_dbus_can (GDBusProxy *proxy, const gchar *method) { GVariant *retval; @@ -1068,14 +1061,14 @@ actions_plugin_actions_allowed (ActionsPlugin *plugin) plugin->switch_user_cmd = "dm-tool switch-to-greeter"; } else - { - path = g_find_program_in_path ("gdmflexiserver"); - if (path != NULL) - { - PANEL_SET_FLAG (allow_mask, ACTION_TYPE_SWITCH_USER); - plugin->switch_user_cmd = "gdmflexiserver"; - } - } + { + path = g_find_program_in_path ("gdmflexiserver"); + if (path != NULL) + { + PANEL_SET_FLAG (allow_mask, ACTION_TYPE_SWITCH_USER); + plugin->switch_user_cmd = "gdmflexiserver"; + } + } g_free (path); path = g_find_program_in_path ("shutdown"); @@ -1098,14 +1091,14 @@ actions_plugin_actions_allowed (ActionsPlugin *plugin) static void -actions_plugin_action_activate (GtkWidget *widget, - ActionsPlugin *plugin) +actions_plugin_action_activate (GtkWidget *widget, + ActionsPlugin *plugin) { - ActionEntry *entry; + ActionEntry *entry; /* unattended shutdown, don't save the session to avoid blocking the logout */ - gboolean unattended = FALSE; - GError *error = NULL; - gboolean succeed = FALSE; + gboolean unattended = FALSE; + GError *error = NULL; + gboolean succeed = FALSE; entry = g_object_get_qdata (G_OBJECT (widget), action_quark); panel_return_if_fail (entry != NULL); @@ -1169,22 +1162,20 @@ actions_plugin_action_activate (GtkWidget *widget, if (!succeed) { - xfce_dialog_show_error (NULL, error, - _("Failed to run action \"%s\""), - _(entry->display_name)); + xfce_dialog_show_error (NULL, error, _("Failed to run action \"%s\""), _(entry->display_name)); } } static GtkWidget * -actions_plugin_action_button (ActionsPlugin *plugin, - const gchar *name, - GtkOrientation orientation, - ActionType *type) +actions_plugin_action_button (ActionsPlugin *plugin, + const gchar *name, + GtkOrientation orientation, + ActionType *type) { - GtkWidget *widget; - GtkWidget *image; + GtkWidget *widget; + GtkWidget *image; ActionEntry *entry; /* lookup the action entry */ @@ -1206,7 +1197,7 @@ actions_plugin_action_button (ActionsPlugin *plugin, g_object_set_qdata (G_OBJECT (widget), action_quark, entry); gtk_widget_set_tooltip_text (widget, _(entry->display_name)); g_signal_connect (G_OBJECT (widget), "clicked", - G_CALLBACK (actions_plugin_action_activate), plugin); + G_CALLBACK (actions_plugin_action_activate), plugin); if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), entry->icon_name)) image = gtk_image_new_from_icon_name (entry->icon_name, GTK_ICON_SIZE_BUTTON); @@ -1226,11 +1217,11 @@ actions_plugin_action_button (ActionsPlugin *plugin, static GtkWidget * actions_plugin_action_menu_item (ActionsPlugin *plugin, - const gchar *name, - ActionType *type) + const gchar *name, + ActionType *type) { - GtkWidget *mi; - GtkWidget *image; + GtkWidget *mi; + GtkWidget *image; ActionEntry *entry; /* lookup the action entry */ @@ -1247,7 +1238,7 @@ actions_plugin_action_menu_item (ActionsPlugin *plugin, mi = panel_image_menu_item_new_with_mnemonic (_(entry->mnemonic)); g_object_set_qdata (G_OBJECT (mi), action_quark, entry); g_signal_connect (G_OBJECT (mi), "activate", - G_CALLBACK (actions_plugin_action_activate), plugin); + G_CALLBACK (actions_plugin_action_activate), plugin); if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), entry->icon_name)) image = gtk_image_new_from_icon_name (entry->icon_name, GTK_ICON_SIZE_MENU); @@ -1265,23 +1256,23 @@ actions_plugin_action_menu_item (ActionsPlugin *plugin, static gboolean actions_plugin_pack_idle (gpointer data) { - ActionsPlugin *plugin = ACTIONS_PLUGIN (data); - GtkWidget *label; - GtkWidget *button; - GtkWidget *widget; - const gchar *button_title; - GtkWidget *child; - GtkWidget *box; - guint i; - const GValue *val; - const gchar *name; - GtkOrientation orientation; - ActionType allowed_types; - ActionType type; - XfcePanelPluginMode mode; - guint panel_rows; - guint left; - guint top; + ActionsPlugin *plugin = ACTIONS_PLUGIN (data); + GtkWidget *label; + GtkWidget *button; + GtkWidget *widget; + const gchar *button_title; + GtkWidget *child; + GtkWidget *box; + guint i; + const GValue *val; + const gchar *name; + GtkOrientation orientation; + ActionType allowed_types; + ActionType type; + XfcePanelPluginMode mode; + guint panel_rows; + guint left; + guint top; child = gtk_bin_get_child (GTK_BIN (plugin)); if (child != NULL) @@ -1360,44 +1351,43 @@ actions_plugin_pack_idle (gpointer data) } actions_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin), - xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); + xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); } else { switch (plugin->button_title) { - case BUTTON_TITLE_TYPE_FULLNAME: - /* get a decent username, not the glib defaults */ - button_title = g_get_real_name (); - if (xfce_str_is_empty (button_title) - || strcmp (button_title, "Unknown") == 0) - { - button_title = g_get_user_name (); - if (xfce_str_is_empty (button_title) - || strcmp (button_title, "username") == 0) - button_title = _("Little Mouse"); - } - break; - - case BUTTON_TITLE_TYPE_USERNAME: - button_title = g_get_user_name (); - if (xfce_str_is_empty (button_title)) - button_title = "username"; - break; - - case BUTTON_TITLE_TYPE_USERID: + case BUTTON_TITLE_TYPE_FULLNAME: + /* get a decent username, not the glib defaults */ + button_title = g_get_real_name (); + if (xfce_str_is_empty (button_title) + || strcmp (button_title, "Unknown") == 0) { - char buf[16]; - snprintf(buf, sizeof(buf), "%u", (unsigned)getuid()); - button_title = buf; + button_title = g_get_user_name (); + if (xfce_str_is_empty (button_title) + || strcmp (button_title, "username") == 0) + button_title = _("Little Mouse"); } - break; + break; - default: - case BUTTON_TITLE_TYPE_CUSTOM: - button_title = (plugin->custom_title == NULL? - DEFAULT_TITLE : plugin->custom_title); - break; + case BUTTON_TITLE_TYPE_USERNAME: + button_title = g_get_user_name (); + if (xfce_str_is_empty (button_title)) + button_title = "username"; + break; + + case BUTTON_TITLE_TYPE_USERID: + { + char buf[16]; + snprintf (buf, sizeof (buf), "%u", (unsigned) getuid ()); + button_title = buf; + } + break; + + default: + case BUTTON_TITLE_TYPE_CUSTOM: + button_title = (plugin->custom_title == NULL ? DEFAULT_TITLE : plugin->custom_title); + break; } button = xfce_arrow_button_new (GTK_ARROW_NONE); @@ -1406,17 +1396,16 @@ actions_plugin_pack_idle (gpointer data) xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (plugin), button); gtk_container_add (GTK_CONTAINER (plugin), button); g_signal_connect (G_OBJECT (button), "toggled", - G_CALLBACK (actions_plugin_menu), plugin); + G_CALLBACK (actions_plugin_menu), plugin); gtk_widget_show (button); label = gtk_label_new (button_title); gtk_container_add (GTK_CONTAINER (button), label); mode = xfce_panel_plugin_get_mode (XFCE_PANEL_PLUGIN (plugin)); - gtk_label_set_angle (GTK_LABEL (label), - (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? 270 : 0); - gtk_label_set_ellipsize (GTK_LABEL (label), - (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) ? - PANGO_ELLIPSIZE_END : PANGO_ELLIPSIZE_NONE); + gtk_label_set_angle (GTK_LABEL (label), (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? 270 : 0); + gtk_label_set_ellipsize ( + GTK_LABEL (label), + (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) ? PANGO_ELLIPSIZE_END : PANGO_ELLIPSIZE_NONE); gtk_widget_show (label); } @@ -1448,23 +1437,22 @@ actions_plugin_pack (ActionsPlugin *plugin) static GPtrArray * actions_plugin_default_array (void) { - GPtrArray *array; - GValue *val; - guint i; - const gchar *defaults[] = - { - "+lock-screen", - "+switch-user", - "+separator", - "+suspend", - "-hibernate", - "-hybrid-sleep", - "-separator", - "+shutdown", - "-restart", - "+separator", - "+logout" - }; + GPtrArray *array; + GValue *val; + guint i; + const gchar *defaults[] = { + "+lock-screen", + "+switch-user", + "+separator", + "+suspend", + "-hibernate", + "-hybrid-sleep", + "-separator", + "+shutdown", + "-restart", + "+separator", + "+logout" + }; array = g_ptr_array_new_full (G_N_ELEMENTS (defaults), actions_plugin_free_array_element); for (i = 0; i < G_N_ELEMENTS (defaults); i++) @@ -1481,7 +1469,7 @@ actions_plugin_default_array (void) static void -actions_plugin_menu_deactivate (GtkWidget *menu, +actions_plugin_menu_deactivate (GtkWidget *menu, ActionsPlugin *plugin) { GtkWidget *button; @@ -1498,15 +1486,15 @@ actions_plugin_menu_deactivate (GtkWidget *menu, static void -actions_plugin_menu (GtkWidget *button, +actions_plugin_menu (GtkWidget *button, ActionsPlugin *plugin) { - guint i; + guint i; const GValue *val; - const gchar *name; - GtkWidget *mi; - ActionType type; - ActionType allowed_types; + const gchar *name; + GtkWidget *mi; + ActionType type; + ActionType allowed_types; panel_return_if_fail (ACTIONS_IS_PLUGIN (plugin)); panel_return_if_fail (button != NULL); @@ -1519,7 +1507,7 @@ actions_plugin_menu (GtkWidget *button, { plugin->menu = gtk_menu_new (); g_signal_connect (G_OBJECT (plugin->menu), "deactivate", - G_CALLBACK (actions_plugin_menu_deactivate), plugin); + G_CALLBACK (actions_plugin_menu_deactivate), plugin); g_object_add_weak_pointer (G_OBJECT (plugin->menu), (gpointer) &plugin->menu); allowed_types = actions_plugin_actions_allowed (plugin); diff --git a/plugins/actions/actions.h b/plugins/actions/actions.h index 5f92e38f4..88f3552b3 100644 --- a/plugins/actions/actions.h +++ b/plugins/actions/actions.h @@ -26,7 +26,8 @@ G_BEGIN_DECLS #define ACTIONS_TYPE_PLUGIN (actions_plugin_get_type ()) G_DECLARE_FINAL_TYPE (ActionsPlugin, actions_plugin, ACTIONS, PLUGIN, XfcePanelPlugin) -void actions_plugin_register_type (XfcePanelTypeModule *type_module); +void +actions_plugin_register_type (XfcePanelTypeModule *type_module); G_END_DECLS diff --git a/plugins/applicationsmenu/applicationsmenu.c b/plugins/applicationsmenu/applicationsmenu.c index 44b66877a..d004d34d2 100644 --- a/plugins/applicationsmenu/applicationsmenu.c +++ b/plugins/applicationsmenu/applicationsmenu.c @@ -35,11 +35,11 @@ /* I18N: default tooltip of the application menu */ -#define DEFAULT_TITLE _("Applications") +#define DEFAULT_TITLE _("Applications") #define DEFAULT_ICON_NAME "org.xfce.panel.applicationsmenu" #define DEFAULT_ICON_SIZE (16) -#define DIALOG_ICON_SIZE (48) -#define DEFAULT_EDITOR "menulibre" +#define DIALOG_ICON_SIZE (48) +#define DEFAULT_EDITOR "menulibre" @@ -47,25 +47,25 @@ struct _ApplicationsMenuPlugin { XfcePanelPlugin __parent__; - GtkWidget *button; - GtkWidget *box; - GtkWidget *image; - GtkWidget *label; - GtkWidget *menu; - - guint is_constructed : 1; - - guint show_button_title : 1; - guint small : 1; - gchar *button_title; - gchar *button_icon; - gboolean custom_menu; - gchar *custom_menu_file; - gchar *menu_editor; - - gulong style_updated_id; - gulong screen_changed_id; - gulong theme_changed_id; + GtkWidget *button; + GtkWidget *box; + GtkWidget *image; + GtkWidget *label; + GtkWidget *menu; + + guint is_constructed : 1; + + guint show_button_title : 1; + guint small : 1; + gchar *button_title; + gchar *button_icon; + gboolean custom_menu; + gchar *custom_menu_file; + gchar *menu_editor; + + gulong style_updated_id; + gulong screen_changed_id; + gulong theme_changed_id; }; enum @@ -85,31 +85,43 @@ enum -static void applications_menu_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void applications_menu_plugin_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void applications_menu_plugin_construct (XfcePanelPlugin *panel_plugin); -static void applications_menu_plugin_free_data (XfcePanelPlugin *panel_plugin); -static gboolean applications_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); -static void applications_menu_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode); -static void applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); -static gboolean applications_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, - const gchar *name, - const GValue *value); -static gboolean applications_menu_plugin_menu (GtkWidget *button, - GdkEventButton *event, - ApplicationsMenuPlugin *plugin); -static void applications_menu_plugin_menu_popdown (GtkMenuShell *menu, - ApplicationsMenuPlugin *plugin); -static void applications_menu_plugin_set_garcon_menu (ApplicationsMenuPlugin *plugin); -static void applications_menu_button_theme_changed (ApplicationsMenuPlugin *plugin); +static void +applications_menu_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +applications_menu_plugin_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +applications_menu_plugin_construct (XfcePanelPlugin *panel_plugin); +static void +applications_menu_plugin_free_data (XfcePanelPlugin *panel_plugin); +static gboolean +applications_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); +static void +applications_menu_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode); +static void +applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); +static gboolean +applications_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, + const gchar *name, + const GValue *value); +static gboolean +applications_menu_plugin_menu (GtkWidget *button, + GdkEventButton *event, + ApplicationsMenuPlugin *plugin); +static void +applications_menu_plugin_menu_popdown (GtkMenuShell *menu, + ApplicationsMenuPlugin *plugin); +static void +applications_menu_plugin_set_garcon_menu (ApplicationsMenuPlugin *plugin); +static void +applications_menu_button_theme_changed (ApplicationsMenuPlugin *plugin); @@ -122,7 +134,7 @@ static void applications_menu_plugin_class_init (ApplicationsMenuPluginClass *klass) { XfcePanelPluginClass *plugin_class; - GObjectClass *gobject_class; + GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->get_property = applications_menu_plugin_get_property; @@ -225,7 +237,7 @@ applications_menu_plugin_init (ApplicationsMenuPlugin *plugin) gtk_button_set_relief (GTK_BUTTON (plugin->button), GTK_RELIEF_NONE); gtk_widget_set_tooltip_text (plugin->button, DEFAULT_TITLE); g_signal_connect (G_OBJECT (plugin->button), "button-press-event", - G_CALLBACK (applications_menu_plugin_menu), plugin); + G_CALLBACK (applications_menu_plugin_menu), plugin); plugin->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_container_set_border_width (GTK_CONTAINER (plugin->box), 0); @@ -256,9 +268,9 @@ applications_menu_plugin_init (ApplicationsMenuPlugin *plugin) static void -applications_menu_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, +applications_menu_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { ApplicationsMenuPlugin *plugin = APPLICATIONS_MENU_PLUGIN (object); @@ -266,18 +278,15 @@ applications_menu_plugin_get_property (GObject *object, switch (prop_id) { case PROP_SHOW_GENERIC_NAMES: - g_value_set_boolean (value, - garcon_gtk_menu_get_show_generic_names (GARCON_GTK_MENU (plugin->menu))); + g_value_set_boolean (value, garcon_gtk_menu_get_show_generic_names (GARCON_GTK_MENU (plugin->menu))); break; case PROP_SHOW_MENU_ICONS: - g_value_set_boolean (value, - garcon_gtk_menu_get_show_menu_icons (GARCON_GTK_MENU (plugin->menu))); + g_value_set_boolean (value, garcon_gtk_menu_get_show_menu_icons (GARCON_GTK_MENU (plugin->menu))); break; case PROP_SHOW_TOOLTIPS: - g_value_set_boolean (value, - garcon_gtk_menu_get_show_tooltips (GARCON_GTK_MENU (plugin->menu))); + g_value_set_boolean (value, garcon_gtk_menu_get_show_tooltips (GARCON_GTK_MENU (plugin->menu))); break; case PROP_SHOW_BUTTON_TITLE: @@ -289,8 +298,7 @@ applications_menu_plugin_get_property (GObject *object, break; case PROP_BUTTON_TITLE: - g_value_set_string (value, plugin->button_title == NULL ? - DEFAULT_TITLE : plugin->button_title); + g_value_set_string (value, plugin->button_title == NULL ? DEFAULT_TITLE : plugin->button_title); break; case PROP_BUTTON_ICON: @@ -318,13 +326,13 @@ applications_menu_plugin_get_property (GObject *object, static void -applications_menu_plugin_set_property (GObject *object, - guint prop_id, +applications_menu_plugin_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { ApplicationsMenuPlugin *plugin = APPLICATIONS_MENU_PLUGIN (object); - gboolean force_a_resize = FALSE; + gboolean force_a_resize = FALSE; switch (prop_id) { @@ -336,7 +344,7 @@ applications_menu_plugin_set_property (GObject *object, case PROP_SHOW_MENU_ICONS: garcon_gtk_menu_set_show_menu_icons (GARCON_GTK_MENU (plugin->menu), g_value_get_boolean (value)); - break; + break; case PROP_SHOW_TOOLTIPS: garcon_gtk_menu_set_show_tooltips (GARCON_GTK_MENU (plugin->menu), @@ -350,23 +358,23 @@ applications_menu_plugin_set_property (GObject *object, else gtk_widget_hide (plugin->label); applications_menu_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin), - xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); + xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); return; case PROP_SMALL: plugin->small = g_value_get_boolean (value); xfce_panel_plugin_set_small (XFCE_PANEL_PLUGIN (plugin), plugin->small); applications_menu_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin), - xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); + xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); break; case PROP_BUTTON_TITLE: g_free (plugin->button_title); plugin->button_title = g_value_dup_string (value); gtk_label_set_text (GTK_LABEL (plugin->label), - plugin->button_title != NULL ? plugin->button_title : ""); + plugin->button_title != NULL ? plugin->button_title : ""); gtk_widget_set_tooltip_text (plugin->button, - xfce_str_is_empty (plugin->button_title) ? NULL : plugin->button_title); + xfce_str_is_empty (plugin->button_title) ? NULL : plugin->button_title); /* check if the label still fits */ if (xfce_panel_plugin_get_mode (XFCE_PANEL_PLUGIN (plugin)) == XFCE_PANEL_PLUGIN_MODE_DESKBAR @@ -378,9 +386,8 @@ applications_menu_plugin_set_property (GObject *object, case PROP_BUTTON_ICON: g_free (plugin->button_icon); - plugin->button_icon = - xfce_str_is_empty (g_value_get_string (value)) ? g_strdup (DEFAULT_ICON_NAME) - : g_value_dup_string (value); + plugin->button_icon = xfce_str_is_empty (g_value_get_string (value)) ? g_strdup (DEFAULT_ICON_NAME) + : g_value_dup_string (value); force_a_resize = TRUE; break; @@ -412,7 +419,7 @@ applications_menu_plugin_set_property (GObject *object, if (force_a_resize) { applications_menu_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin), - xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); + xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); } } @@ -422,8 +429,7 @@ static void applications_menu_plugin_construct (XfcePanelPlugin *panel_plugin) { ApplicationsMenuPlugin *plugin = APPLICATIONS_MENU_PLUGIN (panel_plugin); - const PanelProperty properties[] = - { + const PanelProperty properties[] = { { "show-generic-names", G_TYPE_BOOLEAN }, { "show-menu-icons", G_TYPE_BOOLEAN }, { "show-button-title", G_TYPE_BOOLEAN }, @@ -448,12 +454,11 @@ applications_menu_plugin_construct (XfcePanelPlugin *panel_plugin) applications_menu_plugin_set_garcon_menu (plugin); if (!plugin->menu_editor) - plugin->menu_editor = DEFAULT_EDITOR; + plugin->menu_editor = DEFAULT_EDITOR; gtk_widget_show (plugin->button); - applications_menu_plugin_size_changed (panel_plugin, - xfce_panel_plugin_get_size (panel_plugin)); + applications_menu_plugin_size_changed (panel_plugin, xfce_panel_plugin_get_size (panel_plugin)); plugin->is_constructed = TRUE; } @@ -463,7 +468,7 @@ static void applications_menu_plugin_free_data (XfcePanelPlugin *panel_plugin) { ApplicationsMenuPlugin *plugin = APPLICATIONS_MENU_PLUGIN (panel_plugin); - GtkIconTheme *icon_theme; + GtkIconTheme *icon_theme; if (plugin->menu != NULL) gtk_widget_destroy (plugin->menu); @@ -497,18 +502,18 @@ applications_menu_plugin_free_data (XfcePanelPlugin *panel_plugin) static gboolean applications_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { ApplicationsMenuPlugin *plugin = APPLICATIONS_MENU_PLUGIN (panel_plugin); - XfcePanelPluginMode mode; - GtkRequisition label_size; - GtkOrientation orientation; - gint border_thickness; - gint icon_size; - GdkScreen *screen; - GtkIconTheme *icon_theme = NULL; - GtkStyleContext *ctx; - GtkBorder padding, border; + XfcePanelPluginMode mode; + GtkRequisition label_size; + GtkOrientation orientation; + gint border_thickness; + gint icon_size; + GdkScreen *screen; + GtkIconTheme *icon_theme = NULL; + GtkStyleContext *ctx; + GtkBorder padding, border; gtk_box_set_child_packing (GTK_BOX (plugin->box), plugin->image, !plugin->show_button_title, @@ -530,7 +535,7 @@ applications_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, padding.top + padding.bottom + border.top + border.bottom); icon_size = xfce_panel_plugin_get_icon_size (panel_plugin); - if (! plugin->small) + if (!plugin->small) icon_size *= xfce_panel_plugin_get_nrows (panel_plugin); screen = gtk_widget_get_screen (GTK_WIDGET (plugin)); @@ -541,8 +546,7 @@ applications_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, icon_theme, icon_size, gtk_widget_get_scale_factor (GTK_WIDGET (plugin))); - if (plugin->show_button_title && - mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) + if (plugin->show_button_title && mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) { /* check if the label (minimum size) fits next to the icon */ gtk_widget_get_preferred_size (GTK_WIDGET (plugin->label), &label_size, NULL); @@ -558,23 +562,22 @@ applications_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, static void -applications_menu_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode) +applications_menu_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode) { ApplicationsMenuPlugin *plugin = APPLICATIONS_MENU_PLUGIN (panel_plugin); - gint angle; + gint angle; angle = (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? 270 : 0; gtk_label_set_angle (GTK_LABEL (plugin->label), angle); - applications_menu_plugin_size_changed (panel_plugin, - xfce_panel_plugin_get_size (panel_plugin)); + 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, +applications_menu_plugin_configure_plugin_file_set (GtkFileChooserButton *button, ApplicationsMenuPlugin *plugin) { gchar *filename; @@ -590,19 +593,17 @@ applications_menu_plugin_configure_plugin_file_set (GtkFileChooserButton *butt static void -applications_menu_plugin_configure_plugin_icon_chooser (GtkWidget *button, +applications_menu_plugin_configure_plugin_icon_chooser (GtkWidget *button, ApplicationsMenuPlugin *plugin) { + GtkWindow *parent = GTK_WINDOW (gtk_widget_get_toplevel (button)); GtkWidget *chooser, *image; - gchar *icon; + gchar *icon; panel_return_if_fail (APPLICATIONS_MENU_IS_PLUGIN (plugin)); - chooser = exo_icon_chooser_dialog_new (_("Select An Icon"), - GTK_WINDOW (gtk_widget_get_toplevel (button)), - _("_Cancel"), GTK_RESPONSE_CANCEL, - _("_OK"), GTK_RESPONSE_ACCEPT, - NULL); + chooser = exo_icon_chooser_dialog_new ( + _("Select An Icon"), parent, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_OK"), GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_ACCEPT); exo_icon_chooser_dialog_set_icon (EXO_ICON_CHOOSER_DIALOG (chooser), plugin->button_icon); @@ -628,10 +629,10 @@ applications_menu_plugin_configure_plugin_icon_chooser (GtkWidget * static void -applications_menu_plugin_configure_plugin_edit (GtkWidget *button, +applications_menu_plugin_configure_plugin_edit (GtkWidget *button, ApplicationsMenuPlugin *plugin) { - GError *error = NULL; + GError *error = NULL; panel_return_if_fail (APPLICATIONS_MENU_IS_PLUGIN (plugin)); panel_return_if_fail (GTK_IS_WIDGET (button)); @@ -650,13 +651,13 @@ static void applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) { ApplicationsMenuPlugin *plugin = APPLICATIONS_MENU_PLUGIN (panel_plugin); - GtkBuilder *builder; - GtkWidget *image; - GObject *dialog, *object, *object2; - guint i; - gchar *path; - const gchar *check_names[] = { "show-generic-names", "show-menu-icons", - "show-tooltips", "show-button-title", "small" }; + GtkBuilder *builder; + GtkWidget *image; + GObject *dialog, *object, *object2; + guint i; + gchar *path; + const gchar *check_names[] = { "show-generic-names", "show-menu-icons", + "show-tooltips", "show-button-title", "small" }; /* setup the dialog */ builder = panel_utils_builder_new (panel_plugin, applicationsmenu_dialog_ui, @@ -682,7 +683,7 @@ applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) object = gtk_builder_get_object (builder, "icon-button"); panel_return_if_fail (GTK_IS_BUTTON (object)); g_signal_connect (G_OBJECT (object), "clicked", - G_CALLBACK (applications_menu_plugin_configure_plugin_icon_chooser), plugin); + G_CALLBACK (applications_menu_plugin_configure_plugin_icon_chooser), plugin); image = gtk_image_new (); xfce_panel_set_image_from_source (GTK_IMAGE (image), plugin->button_icon, @@ -703,7 +704,7 @@ applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) G_OBJECT (object), "sensitive", G_BINDING_SYNC_CREATE); g_signal_connect (G_OBJECT (object), "clicked", - G_CALLBACK (applications_menu_plugin_configure_plugin_edit), plugin); + G_CALLBACK (applications_menu_plugin_configure_plugin_edit), plugin); } else { @@ -729,7 +730,7 @@ applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) if (!xfce_str_is_empty (plugin->custom_menu_file)) gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (object), plugin->custom_menu_file); g_signal_connect (G_OBJECT (object), "file-set", - G_CALLBACK (applications_menu_plugin_configure_plugin_file_set), plugin); + G_CALLBACK (applications_menu_plugin_configure_plugin_file_set), plugin); gtk_widget_show (GTK_WIDGET (dialog)); } @@ -738,8 +739,8 @@ applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) static gboolean applications_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, - const gchar *name, - const GValue *value) + const gchar *name, + const GValue *value) { ApplicationsMenuPlugin *plugin = APPLICATIONS_MENU_PLUGIN (panel_plugin); GtkWidget *invisible; @@ -748,7 +749,7 @@ applications_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, /* try next plugin or indicate that it failed */ if (strcmp (name, "popup") != 0 - || ! gtk_widget_get_visible (GTK_WIDGET (panel_plugin))) + || !gtk_widget_get_visible (GTK_WIDGET (panel_plugin))) return FALSE; invisible = gtk_invisible_new (); @@ -756,7 +757,7 @@ applications_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, /* a menu is already shown, don't popup another one */ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button)) - || ! panel_utils_device_grab (invisible)) + || !panel_utils_device_grab (invisible)) { gtk_widget_destroy (invisible); return TRUE; @@ -789,7 +790,7 @@ applications_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, static void -applications_menu_plugin_menu_popdown (GtkMenuShell *menu, +applications_menu_plugin_menu_popdown (GtkMenuShell *menu, ApplicationsMenuPlugin *plugin) { panel_return_if_fail (plugin->button == NULL || GTK_IS_TOGGLE_BUTTON (plugin->button)); @@ -831,8 +832,8 @@ applications_menu_plugin_set_garcon_menu (ApplicationsMenuPlugin *plugin) static gboolean -applications_menu_plugin_menu (GtkWidget *button, - GdkEventButton *event, +applications_menu_plugin_menu (GtkWidget *button, + GdkEventButton *event, ApplicationsMenuPlugin *plugin) { GdkEvent *free_event = NULL; @@ -857,15 +858,15 @@ applications_menu_plugin_menu (GtkWidget *button, free_event = gdk_event_new (GDK_BUTTON_PRESS); free_event->button.window = g_object_ref (gdk_get_default_root_window ()); gdk_event_set_device (free_event, gdk_seat_get_pointer (seat)); - event = (GdkEventButton *)free_event; + event = (GdkEventButton *) free_event; } /* when cancelling a dnd only "selection-done" is emitted, whereas "deactivate" is more * generic and it is the only signal emitted on Wayland when clicking outside the menu */ g_signal_connect (G_OBJECT (plugin->menu), "deactivate", - G_CALLBACK (applications_menu_plugin_menu_popdown), plugin); + G_CALLBACK (applications_menu_plugin_menu_popdown), plugin); g_signal_connect (G_OBJECT (plugin->menu), "selection-done", - G_CALLBACK (applications_menu_plugin_menu_popdown), plugin); + G_CALLBACK (applications_menu_plugin_menu_popdown), plugin); /* do not block panel autohide if popup-command at pointer */ if (button == NULL) @@ -887,6 +888,5 @@ applications_menu_button_theme_changed (ApplicationsMenuPlugin *plugin) { XfcePanelPlugin *panel_plugin = XFCE_PANEL_PLUGIN (plugin); - applications_menu_plugin_size_changed (panel_plugin, - xfce_panel_plugin_get_size (panel_plugin)); + applications_menu_plugin_size_changed (panel_plugin, xfce_panel_plugin_get_size (panel_plugin)); } diff --git a/plugins/applicationsmenu/applicationsmenu.h b/plugins/applicationsmenu/applicationsmenu.h index 6dec43a20..d5afba1ac 100644 --- a/plugins/applicationsmenu/applicationsmenu.h +++ b/plugins/applicationsmenu/applicationsmenu.h @@ -26,7 +26,8 @@ G_BEGIN_DECLS #define APPLICATIONS_MENU_TYPE_PLUGIN (applications_menu_plugin_get_type ()) G_DECLARE_FINAL_TYPE (ApplicationsMenuPlugin, applications_menu_plugin, APPLICATIONS_MENU, PLUGIN, XfcePanelPlugin) -void applications_menu_plugin_register_type (XfcePanelTypeModule *type_module); +void +applications_menu_plugin_register_type (XfcePanelTypeModule *type_module); G_END_DECLS diff --git a/plugins/clock/clock-analog.c b/plugins/clock/clock-analog.c index 342a86f97..ae4ae21f4 100644 --- a/plugins/clock/clock-analog.c +++ b/plugins/clock/clock-analog.c @@ -28,38 +28,44 @@ #include <cairo/cairo.h> #define CLOCK_SCALE 0.08 -#define TICKS_TO_RADIANS(x) (G_PI - (G_PI / 30.0) * (x)) -#define HOURS_TO_RADIANS(x,y) (G_PI - (G_PI / 6.0) * (((x) > 12 ? (x) - 12 : (x)) + (y) / 60.0)) - - - -static void xfce_clock_analog_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void xfce_clock_analog_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void xfce_clock_analog_finalize (GObject *object); -static gboolean xfce_clock_analog_draw (GtkWidget *widget, - cairo_t *cr); -static void xfce_clock_analog_draw_ticks (cairo_t *cr, - gdouble xc, - gdouble yc, - gdouble radius); -static void xfce_clock_analog_draw_pointer (cairo_t *cr, - gdouble xc, - gdouble yc, - gdouble radius, - gdouble angle, - gdouble scale, - gboolean line); -static gboolean xfce_clock_analog_update (XfceClockAnalog *analog, - ClockTime *time); +#define TICKS_TO_RADIANS(x) (G_PI - (G_PI / 30.0) * (x)) +#define HOURS_TO_RADIANS(x, y) (G_PI - (G_PI / 6.0) * (((x) > 12 ? (x) - 12 : (x)) + (y) / 60.0)) +static void +xfce_clock_analog_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +xfce_clock_analog_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +xfce_clock_analog_finalize (GObject *object); +static gboolean +xfce_clock_analog_draw (GtkWidget *widget, + cairo_t *cr); +static void +xfce_clock_analog_draw_ticks (cairo_t *cr, + gdouble xc, + gdouble yc, + gdouble radius); +static void +xfce_clock_analog_draw_pointer (cairo_t *cr, + gdouble xc, + gdouble yc, + gdouble radius, + gdouble angle, + gdouble scale, + gboolean line); +static gboolean +xfce_clock_analog_update (XfceClockAnalog *analog, + ClockTime *time); + + enum { @@ -73,10 +79,10 @@ struct _XfceClockAnalog { GtkImage __parent__; - ClockTimeTimeout *timeout; + ClockTimeTimeout *timeout; - guint show_seconds : 1; - ClockTime *time; + guint show_seconds : 1; + ClockTime *time; }; @@ -88,7 +94,7 @@ G_DEFINE_FINAL_TYPE (XfceClockAnalog, xfce_clock_analog, GTK_TYPE_IMAGE) static void xfce_clock_analog_class_init (XfceClockAnalogClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; GtkWidgetClass *gtkwidget_class; gobject_class = G_OBJECT_CLASS (klass); @@ -104,7 +110,7 @@ xfce_clock_analog_class_init (XfceClockAnalogClass *klass) g_param_spec_double ("size-ratio", NULL, NULL, -1, G_MAXDOUBLE, 1.0, G_PARAM_READABLE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ORIENTATION, @@ -112,14 +118,14 @@ xfce_clock_analog_class_init (XfceClockAnalogClass *klass) GTK_TYPE_ORIENTATION, GTK_ORIENTATION_HORIZONTAL, G_PARAM_WRITABLE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SHOW_SECONDS, g_param_spec_boolean ("show-seconds", NULL, NULL, FALSE, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); } @@ -133,10 +139,10 @@ xfce_clock_analog_init (XfceClockAnalog *analog) static void -xfce_clock_analog_set_property (GObject *object, - guint prop_id, +xfce_clock_analog_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { XfceClockAnalog *analog = XFCE_CLOCK_ANALOG (object); @@ -156,16 +162,16 @@ xfce_clock_analog_set_property (GObject *object, /* reschedule the timeout and redraw */ clock_time_timeout_set_interval (analog->timeout, - analog->show_seconds ? CLOCK_INTERVAL_SECOND : CLOCK_INTERVAL_MINUTE); + analog->show_seconds ? CLOCK_INTERVAL_SECOND : CLOCK_INTERVAL_MINUTE); xfce_clock_analog_update (analog, analog->time); } static void -xfce_clock_analog_get_property (GObject *object, - guint prop_id, - GValue *value, +xfce_clock_analog_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { XfceClockAnalog *analog = XFCE_CLOCK_ANALOG (object); @@ -201,15 +207,15 @@ xfce_clock_analog_finalize (GObject *object) static gboolean xfce_clock_analog_draw (GtkWidget *widget, - cairo_t *cr) + cairo_t *cr) { XfceClockAnalog *analog = XFCE_CLOCK_ANALOG (widget); - gdouble xc, yc; - gdouble angle, radius; - GDateTime *time; - GtkAllocation allocation; + gdouble xc, yc; + gdouble angle, radius; + GDateTime *time; + GtkAllocation allocation; GtkStyleContext *ctx; - GdkRGBA fg_rgba; + GdkRGBA fg_rgba; panel_return_val_if_fail (XFCE_CLOCK_IS_ANALOG (analog), FALSE); panel_return_val_if_fail (cr != NULL, FALSE); @@ -257,11 +263,11 @@ xfce_clock_analog_draw (GtkWidget *widget, static void xfce_clock_analog_draw_ticks (cairo_t *cr, - gdouble xc, - gdouble yc, - gdouble radius) + gdouble xc, + gdouble yc, + gdouble radius) { - gint i; + gint i; gdouble x, y, angle; for (i = 0; i < 12; i++) @@ -313,11 +319,11 @@ xfce_clock_analog_draw_ticks (cairo_t *cr, static void xfce_clock_analog_draw_pointer (cairo_t *cr, - gdouble xc, - gdouble yc, - gdouble radius, - gdouble angle, - gdouble scale, + gdouble xc, + gdouble yc, + gdouble radius, + gdouble angle, + gdouble scale, gboolean line) { gdouble xs, ys; @@ -357,7 +363,7 @@ xfce_clock_analog_draw_pointer (cairo_t *cr, static gboolean xfce_clock_analog_update (XfceClockAnalog *analog, - ClockTime *time) + ClockTime *time) { GtkWidget *widget = GTK_WIDGET (analog); diff --git a/plugins/clock/clock-analog.h b/plugins/clock/clock-analog.h index 454e9598d..64f018bbd 100644 --- a/plugins/clock/clock-analog.h +++ b/plugins/clock/clock-analog.h @@ -30,10 +30,12 @@ G_BEGIN_DECLS #define XFCE_CLOCK_TYPE_ANALOG (xfce_clock_analog_get_type ()) G_DECLARE_FINAL_TYPE (XfceClockAnalog, xfce_clock_analog, XFCE_CLOCK, ANALOG, GtkImage) -void xfce_clock_analog_register_type (XfcePanelTypeModule *type_module); +void +xfce_clock_analog_register_type (XfcePanelTypeModule *type_module); -GtkWidget *xfce_clock_analog_new (ClockTime *time, - ClockSleepMonitor *sleep_monitor) G_GNUC_MALLOC; +GtkWidget * +xfce_clock_analog_new (ClockTime *time, + ClockSleepMonitor *sleep_monitor) G_GNUC_MALLOC; G_END_DECLS diff --git a/plugins/clock/clock-binary.c b/plugins/clock/clock-binary.c index 4deea1bd6..5ac4151af 100644 --- a/plugins/clock/clock-binary.c +++ b/plugins/clock/clock-binary.c @@ -29,20 +29,24 @@ -static void xfce_clock_binary_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void xfce_clock_binary_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void xfce_clock_binary_finalize (GObject *object); -static gboolean xfce_clock_binary_draw (GtkWidget *widget, - cairo_t *cr); -static gboolean xfce_clock_binary_update (XfceClockBinary *binary, - ClockTime *time); - +static void +xfce_clock_binary_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +xfce_clock_binary_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +xfce_clock_binary_finalize (GObject *object); +static gboolean +xfce_clock_binary_draw (GtkWidget *widget, + cairo_t *cr); +static gboolean +xfce_clock_binary_update (XfceClockBinary *binary, + ClockTime *time); @@ -66,14 +70,14 @@ enum struct _XfceClockBinary { - GtkImage __parent__; + GtkImage __parent__; ClockTimeTimeout *timeout; - guint show_seconds : 1; - guint mode; - guint show_inactive : 1; - guint show_grid : 1; + guint show_seconds : 1; + guint mode; + guint show_inactive : 1; + guint show_grid : 1; ClockTime *time; }; @@ -87,7 +91,7 @@ G_DEFINE_FINAL_TYPE (XfceClockBinary, xfce_clock_binary, GTK_TYPE_IMAGE) static void xfce_clock_binary_class_init (XfceClockBinaryClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; GtkWidgetClass *gtkwidget_class; gobject_class = G_OBJECT_CLASS (klass); @@ -103,7 +107,7 @@ xfce_clock_binary_class_init (XfceClockBinaryClass *klass) g_param_spec_double ("size-ratio", NULL, NULL, -1, G_MAXDOUBLE, 1.0, G_PARAM_READABLE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ORIENTATION, @@ -111,35 +115,35 @@ xfce_clock_binary_class_init (XfceClockBinaryClass *klass) GTK_TYPE_ORIENTATION, GTK_ORIENTATION_HORIZONTAL, G_PARAM_WRITABLE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SHOW_SECONDS, g_param_spec_boolean ("show-seconds", NULL, NULL, FALSE, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_MODE, g_param_spec_uint ("binary-mode", NULL, NULL, MODE_DECIMAL, MODE_BINARY_TIME, MODE_DECIMAL, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SHOW_INACTIVE, g_param_spec_boolean ("show-inactive", NULL, NULL, TRUE, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SHOW_GRID, g_param_spec_boolean ("show-grid", NULL, NULL, FALSE, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); } @@ -151,16 +155,15 @@ xfce_clock_binary_init (XfceClockBinary *binary) binary->mode = MODE_DECIMAL; binary->show_inactive = TRUE; binary->show_grid = FALSE; - } static void -xfce_clock_binary_set_property (GObject *object, - guint prop_id, +xfce_clock_binary_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { XfceClockBinary *binary = XFCE_CLOCK_BINARY (object); @@ -194,20 +197,20 @@ xfce_clock_binary_set_property (GObject *object, /* reschedule the timeout and resize */ clock_time_timeout_set_interval (binary->timeout, - binary->show_seconds ? CLOCK_INTERVAL_SECOND : CLOCK_INTERVAL_MINUTE); + binary->show_seconds ? CLOCK_INTERVAL_SECOND : CLOCK_INTERVAL_MINUTE); gtk_widget_queue_resize (GTK_WIDGET (binary)); } static void -xfce_clock_binary_get_property (GObject *object, - guint prop_id, - GValue *value, +xfce_clock_binary_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { XfceClockBinary *binary = XFCE_CLOCK_BINARY (object); - gdouble ratio; + gdouble ratio; switch (prop_id) { @@ -265,7 +268,7 @@ xfce_clock_binary_finalize (GObject *object) static guint xfce_clock_binary_algo_value (GDateTime *time, - gboolean seconds) + gboolean seconds) { guint n; @@ -278,13 +281,13 @@ xfce_clock_binary_algo_value (GDateTime *time, } static void -xfce_clock_binary_draw_true_binary (gulong *table, +xfce_clock_binary_draw_true_binary (gulong *table, GDateTime *time, - gboolean seconds, - gint rows, - gint cols) + gboolean seconds, + gint rows, + gint cols) { - gint row, ticks; + gint row, ticks; guint n, p; n = xfce_clock_binary_algo_value (time, seconds); @@ -299,13 +302,13 @@ xfce_clock_binary_draw_true_binary (gulong *table, static void -xfce_clock_binary_draw_binary (gulong *table, +xfce_clock_binary_draw_binary (gulong *table, GDateTime *time, - gboolean seconds, - gint rows, - gint cols) + gboolean seconds, + gint rows, + gint cols) { - gint row, col, ticks; + gint row, col, ticks; guint n, p; n = xfce_clock_binary_algo_value (time, seconds); @@ -324,15 +327,15 @@ xfce_clock_binary_draw_binary (gulong *table, static void -xfce_clock_binary_draw_binary_time (gulong *table, +xfce_clock_binary_draw_binary_time (gulong *table, GDateTime *time, - gboolean seconds) + gboolean seconds) { guint n; - n = g_date_time_get_hour (time) * 60 * 60 + - g_date_time_get_minute (time) * 60 + - g_date_time_get_second (time); + n = g_date_time_get_hour (time) * 60 * 60 + + g_date_time_get_minute (time) * 60 + + g_date_time_get_second (time); *table = (n * 512) / 675; // 2 ** 16 / (24 * 60 * 60) @@ -344,23 +347,23 @@ xfce_clock_binary_draw_binary_time (gulong *table, static gboolean xfce_clock_binary_draw (GtkWidget *widget, - cairo_t *cr) + cairo_t *cr) { - XfceClockBinary *binary = XFCE_CLOCK_BINARY (widget); - gint col, cols; - gint row, rows; - GtkAllocation alloc; - gdouble x; - gdouble y; - gint w, h; - gint pad_x, pad_y; - gint diff; - GtkStyleContext *ctx; - GtkStateFlags state_flags; - GdkRGBA active_rgba, inactive_rgba, grid_rgba; - GtkBorder padding; - gulong table = 0; - GDateTime *time; + XfceClockBinary *binary = XFCE_CLOCK_BINARY (widget); + gint col, cols; + gint row, rows; + GtkAllocation alloc; + gdouble x; + gdouble y; + gint w, h; + gint pad_x, pad_y; + gint diff; + GtkStyleContext *ctx; + GtkStateFlags state_flags; + GdkRGBA active_rgba, inactive_rgba, grid_rgba; + GtkBorder padding; + gulong table = 0; + GDateTime *time; panel_return_val_if_fail (XFCE_CLOCK_IS_BINARY (binary), FALSE); panel_return_val_if_fail (cr != NULL, FALSE); @@ -488,8 +491,8 @@ xfce_clock_binary_draw (GtkWidget *widget, static gboolean -xfce_clock_binary_update (XfceClockBinary *binary, - ClockTime *time) +xfce_clock_binary_update (XfceClockBinary *binary, + ClockTime *time) { GtkWidget *widget = GTK_WIDGET (binary); diff --git a/plugins/clock/clock-binary.h b/plugins/clock/clock-binary.h index 26e06e9a6..effa1caae 100644 --- a/plugins/clock/clock-binary.h +++ b/plugins/clock/clock-binary.h @@ -30,10 +30,12 @@ G_BEGIN_DECLS #define XFCE_CLOCK_TYPE_BINARY (xfce_clock_binary_get_type ()) G_DECLARE_FINAL_TYPE (XfceClockBinary, xfce_clock_binary, XFCE_CLOCK, BINARY, GtkImage) -void xfce_clock_binary_register_type (XfcePanelTypeModule *type_module); +void +xfce_clock_binary_register_type (XfcePanelTypeModule *type_module); -GtkWidget *xfce_clock_binary_new (ClockTime *time, - ClockSleepMonitor *sleep_monitor) G_GNUC_MALLOC; +GtkWidget * +xfce_clock_binary_new (ClockTime *time, + ClockSleepMonitor *sleep_monitor) G_GNUC_MALLOC; G_END_DECLS diff --git a/plugins/clock/clock-digital.c b/plugins/clock/clock-digital.c index f2b521bda..c3253f45e 100644 --- a/plugins/clock/clock-digital.c +++ b/plugins/clock/clock-digital.c @@ -28,19 +28,23 @@ -static void xfce_clock_digital_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void xfce_clock_digital_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void xfce_clock_digital_finalize (GObject *object); -static void xfce_clock_digital_update (XfceClockDigital *digital, - ClockTime *time); -static void xfce_clock_digital_update_layout (XfceClockDigital *digital); - +static void +xfce_clock_digital_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +xfce_clock_digital_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +xfce_clock_digital_finalize (GObject *object); +static void +xfce_clock_digital_update (XfceClockDigital *digital, + ClockTime *time); +static void +xfce_clock_digital_update_layout (XfceClockDigital *digital); @@ -64,8 +68,8 @@ struct _XfceClockDigital GtkWidget *time_label; GtkWidget *date_label; - ClockTime *time; - ClockTimeTimeout *timeout; + ClockTime *time; + ClockTimeTimeout *timeout; ClockPluginDigitalFormat layout; @@ -100,7 +104,7 @@ xfce_clock_digital_class_init (XfceClockDigitalClass *klass) g_param_spec_double ("size-ratio", NULL, NULL, -1, G_MAXDOUBLE, 0.0, G_PARAM_READABLE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_DIGITAL_LAYOUT, @@ -117,35 +121,35 @@ xfce_clock_digital_class_init (XfceClockDigitalClass *klass) GTK_TYPE_ORIENTATION, GTK_ORIENTATION_HORIZONTAL, G_PARAM_WRITABLE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_DIGITAL_DATE_FONT, g_param_spec_string ("digital-date-font", NULL, NULL, DEFAULT_FONT, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_DIGITAL_DATE_FORMAT, g_param_spec_string ("digital-date-format", NULL, NULL, DEFAULT_DIGITAL_DATE_FORMAT, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_DIGITAL_TIME_FONT, g_param_spec_string ("digital-time-font", NULL, NULL, DEFAULT_FONT, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_DIGITAL_TIME_FORMAT, g_param_spec_string ("digital-time-format", NULL, NULL, DEFAULT_DIGITAL_TIME_FORMAT, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); } @@ -177,10 +181,10 @@ xfce_clock_digital_init (XfceClockDigital *digital) static void -xfce_clock_digital_set_property (GObject *object, - guint prop_id, +xfce_clock_digital_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { XfceClockDigital *digital = XFCE_CLOCK_DIGITAL (object); @@ -188,11 +192,9 @@ xfce_clock_digital_set_property (GObject *object, { case PROP_ORIENTATION: gtk_label_set_angle (GTK_LABEL (digital->time_label), - g_value_get_enum (value) == GTK_ORIENTATION_HORIZONTAL ? - 0 : 270); + g_value_get_enum (value) == GTK_ORIENTATION_HORIZONTAL ? 0 : 270); gtk_label_set_angle (GTK_LABEL (digital->date_label), - g_value_get_enum (value) == GTK_ORIENTATION_HORIZONTAL ? - 0 : 270); + g_value_get_enum (value) == GTK_ORIENTATION_HORIZONTAL ? 0 : 270); break; case PROP_DIGITAL_LAYOUT: @@ -227,16 +229,16 @@ xfce_clock_digital_set_property (GObject *object, /* reschedule the timeout and redraw */ clock_time_timeout_set_interval (digital->timeout, - clock_time_interval_from_format (digital->time_format)); + clock_time_interval_from_format (digital->time_format)); xfce_clock_digital_update (digital, digital->time); } static void -xfce_clock_digital_get_property (GObject *object, - guint prop_id, - GValue *value, +xfce_clock_digital_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { XfceClockDigital *digital = XFCE_CLOCK_DIGITAL (object); @@ -244,12 +246,12 @@ xfce_clock_digital_get_property (GObject *object, switch (prop_id) { case PROP_DIGITAL_LAYOUT: - g_value_set_uint (value, digital->layout); - break; + g_value_set_uint (value, digital->layout); + break; case PROP_DIGITAL_DATE_FORMAT: - g_value_set_string (value, digital->date_format); - break; + g_value_set_string (value, digital->date_format); + break; case PROP_DIGITAL_DATE_FONT: g_value_set_string (value, digital->date_font); @@ -295,7 +297,7 @@ xfce_clock_digital_finalize (GObject *object) static void xfce_clock_digital_update (XfceClockDigital *digital, - ClockTime *time) + ClockTime *time) { PangoAttrList *attr_list; PangoAttribute *attr; @@ -373,12 +375,12 @@ static void xfce_clock_digital_anchored (XfceClockDigital *digital) { XfconfChannel *channel; - GtkWidget *plugin; - gchar *prop, *format; - const gchar *prop_base; - gboolean has_prop; - const gchar *props[] = { "digital-layout", "digital-time-font", "digital-time-format", - "digital-date-font", "digital-date-format" }; + GtkWidget *plugin; + gchar *prop, *format; + const gchar *prop_base; + gboolean has_prop; + const gchar *props[] = { "digital-layout", "digital-time-font", "digital-time-format", + "digital-date-font", "digital-date-format" }; g_signal_handlers_disconnect_by_func (digital, xfce_clock_digital_anchored, NULL); @@ -400,7 +402,7 @@ xfce_clock_digital_anchored (XfceClockDigital *digital) /* new user, see if he has an old format */ prop = g_strdup_printf ("%s/%s", prop_base, "digital-format"); has_prop = xfconf_channel_has_property (channel, prop); - if (! has_prop) + if (!has_prop) { g_free (prop); return; diff --git a/plugins/clock/clock-digital.h b/plugins/clock/clock-digital.h index 59c9450de..eee61f56f 100644 --- a/plugins/clock/clock-digital.h +++ b/plugins/clock/clock-digital.h @@ -27,8 +27,8 @@ G_BEGIN_DECLS -#define DEFAULT_DIGITAL_TIME_FORMAT NC_("Time", "%R") -#define DEFAULT_DIGITAL_DATE_FORMAT NC_("Date", "%Y-%m-%d") +#define DEFAULT_DIGITAL_TIME_FORMAT NC_ ("Time", "%R") +#define DEFAULT_DIGITAL_DATE_FORMAT NC_ ("Date", "%Y-%m-%d") typedef enum { @@ -41,16 +41,17 @@ typedef enum CLOCK_PLUGIN_DIGITAL_FORMAT_MIN = CLOCK_PLUGIN_DIGITAL_FORMAT_DATE_TIME, CLOCK_PLUGIN_DIGITAL_FORMAT_MAX = CLOCK_PLUGIN_DIGITAL_FORMAT_TIME, CLOCK_PLUGIN_DIGITAL_FORMAT_DEFAULT = CLOCK_PLUGIN_DIGITAL_FORMAT_DATE_TIME, -} -ClockPluginDigitalFormat; +} ClockPluginDigitalFormat; #define XFCE_CLOCK_TYPE_DIGITAL (xfce_clock_digital_get_type ()) G_DECLARE_FINAL_TYPE (XfceClockDigital, xfce_clock_digital, XFCE_CLOCK, DIGITAL, GtkBox) -void xfce_clock_digital_register_type (XfcePanelTypeModule *type_module); +void +xfce_clock_digital_register_type (XfcePanelTypeModule *type_module); -GtkWidget *xfce_clock_digital_new (ClockTime *time, - ClockSleepMonitor *sleep_monitor) G_GNUC_MALLOC; +GtkWidget * +xfce_clock_digital_new (ClockTime *time, + ClockSleepMonitor *sleep_monitor) G_GNUC_MALLOC; G_END_DECLS diff --git a/plugins/clock/clock-fuzzy.c b/plugins/clock/clock-fuzzy.c index caaf43ab8..7b1559839 100644 --- a/plugins/clock/clock-fuzzy.c +++ b/plugins/clock/clock-fuzzy.c @@ -27,18 +27,21 @@ -static void xfce_clock_fuzzy_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void xfce_clock_fuzzy_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void xfce_clock_fuzzy_finalize (GObject *object); -static gboolean xfce_clock_fuzzy_update (XfceClockFuzzy *fuzzy, - ClockTime *time); - +static void +xfce_clock_fuzzy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +xfce_clock_fuzzy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +xfce_clock_fuzzy_finalize (GObject *object); +static gboolean +xfce_clock_fuzzy_update (XfceClockFuzzy *fuzzy, + ClockTime *time); @@ -65,95 +68,90 @@ struct _XfceClockFuzzy { GtkLabel __parent__; - ClockTimeTimeout *timeout; + ClockTimeTimeout *timeout; - guint fuzziness; + guint fuzziness; - ClockTime *time; + ClockTime *time; }; -static const gchar *i18n_day_sectors[] = -{ - N_("Night"), - N_("Early morning"), - N_("Morning"), - N_("Almost noon"), - N_("Noon"), - N_("Afternoon"), - N_("Evening"), - N_("Late evening") +static const gchar *i18n_day_sectors[] = { + N_ ("Night"), + N_ ("Early morning"), + N_ ("Morning"), + N_ ("Almost noon"), + N_ ("Noon"), + N_ ("Afternoon"), + N_ ("Evening"), + N_ ("Late evening") }; -static const gchar *i18n_hour_sectors[] = -{ +static const gchar *i18n_hour_sectors[] = { /* I18N: %0 will be replaced with the preceding hour, %1 with * the comming hour */ - /* xgettext:no-c-format */ N_("%0 o'clock"), - /* xgettext:no-c-format */ N_("five past %0"), - /* xgettext:no-c-format */ N_("ten past %0"), - /* xgettext:no-c-format */ N_("quarter past %0"), - /* xgettext:no-c-format */ N_("twenty past %0"), - /* xgettext:no-c-format */ N_("twenty five past %0"), - /* xgettext:no-c-format */ N_("half past %0"), - /* xgettext:no-c-format */ N_("twenty five to %1"), - /* xgettext:no-c-format */ N_("twenty to %1"), - /* xgettext:no-c-format */ N_("quarter to %1"), - /* xgettext:no-c-format */ N_("ten to %1"), - /* xgettext:no-c-format */ N_("five to %1"), - /* xgettext:no-c-format */ N_("%1 o'clock") + /* xgettext:no-c-format */ N_ ("%0 o'clock"), + /* xgettext:no-c-format */ N_ ("five past %0"), + /* xgettext:no-c-format */ N_ ("ten past %0"), + /* xgettext:no-c-format */ N_ ("quarter past %0"), + /* xgettext:no-c-format */ N_ ("twenty past %0"), + /* xgettext:no-c-format */ N_ ("twenty five past %0"), + /* xgettext:no-c-format */ N_ ("half past %0"), + /* xgettext:no-c-format */ N_ ("twenty five to %1"), + /* xgettext:no-c-format */ N_ ("twenty to %1"), + /* xgettext:no-c-format */ N_ ("quarter to %1"), + /* xgettext:no-c-format */ N_ ("ten to %1"), + /* xgettext:no-c-format */ N_ ("five to %1"), + /* xgettext:no-c-format */ N_ ("%1 o'clock") }; -static const gchar *i18n_hour_sectors_one[] = -{ +static const gchar *i18n_hour_sectors_one[] = { /* I18N: some languages have a singular form for the first hour, * other languages should just use the same strings as above */ - /* xgettext:no-c-format */ NC_("one", "%0 o'clock"), - /* xgettext:no-c-format */ NC_("one", "five past %0"), - /* xgettext:no-c-format */ NC_("one", "ten past %0"), - /* xgettext:no-c-format */ NC_("one", "quarter past %0"), - /* xgettext:no-c-format */ NC_("one", "twenty past %0"), - /* xgettext:no-c-format */ NC_("one", "twenty five past %0"), - /* xgettext:no-c-format */ NC_("one", "half past %0"), - /* xgettext:no-c-format */ NC_("one", "twenty five to %1"), - /* xgettext:no-c-format */ NC_("one", "twenty to %1"), - /* xgettext:no-c-format */ NC_("one", "quarter to %1"), - /* xgettext:no-c-format */ NC_("one", "ten to %1"), - /* xgettext:no-c-format */ NC_("one", "five to %1"), - /* xgettext:no-c-format */ NC_("one", "%1 o'clock") + /* xgettext:no-c-format */ NC_ ("one", "%0 o'clock"), + /* xgettext:no-c-format */ NC_ ("one", "five past %0"), + /* xgettext:no-c-format */ NC_ ("one", "ten past %0"), + /* xgettext:no-c-format */ NC_ ("one", "quarter past %0"), + /* xgettext:no-c-format */ NC_ ("one", "twenty past %0"), + /* xgettext:no-c-format */ NC_ ("one", "twenty five past %0"), + /* xgettext:no-c-format */ NC_ ("one", "half past %0"), + /* xgettext:no-c-format */ NC_ ("one", "twenty five to %1"), + /* xgettext:no-c-format */ NC_ ("one", "twenty to %1"), + /* xgettext:no-c-format */ NC_ ("one", "quarter to %1"), + /* xgettext:no-c-format */ NC_ ("one", "ten to %1"), + /* xgettext:no-c-format */ NC_ ("one", "five to %1"), + /* xgettext:no-c-format */ NC_ ("one", "%1 o'clock") }; -static const gchar *i18n_hour_am_names[] = -{ - NC_("am", "one"), - NC_("am", "two"), - NC_("am", "three"), - NC_("am", "four"), - NC_("am", "five"), - NC_("am", "six"), - NC_("am", "seven"), - NC_("am", "eight"), - NC_("am", "nine"), - NC_("am", "ten"), - NC_("am", "eleven"), +static const gchar *i18n_hour_am_names[] = { + NC_ ("am", "one"), + NC_ ("am", "two"), + NC_ ("am", "three"), + NC_ ("am", "four"), + NC_ ("am", "five"), + NC_ ("am", "six"), + NC_ ("am", "seven"), + NC_ ("am", "eight"), + NC_ ("am", "nine"), + NC_ ("am", "ten"), + NC_ ("am", "eleven"), /* I18N: 12 AM is midnight */ - NC_("am", "twelve") + NC_ ("am", "twelve") }; -static const gchar *i18n_hour_pm_names[] = -{ - NC_("pm", "one"), - NC_("pm", "two"), - NC_("pm", "three"), - NC_("pm", "four"), - NC_("pm", "five"), - NC_("pm", "six"), - NC_("pm", "seven"), - NC_("pm", "eight"), - NC_("pm", "nine"), - NC_("pm", "ten"), - NC_("pm", "eleven"), +static const gchar *i18n_hour_pm_names[] = { + NC_ ("pm", "one"), + NC_ ("pm", "two"), + NC_ ("pm", "three"), + NC_ ("pm", "four"), + NC_ ("pm", "five"), + NC_ ("pm", "six"), + NC_ ("pm", "seven"), + NC_ ("pm", "eight"), + NC_ ("pm", "nine"), + NC_ ("pm", "ten"), + NC_ ("pm", "eleven"), /* I18N: 12 PM is noon */ - NC_("pm", "twelve") + NC_ ("pm", "twelve") }; @@ -177,7 +175,7 @@ xfce_clock_fuzzy_class_init (XfceClockFuzzyClass *klass) g_param_spec_double ("size-ratio", NULL, NULL, -1, G_MAXDOUBLE, -1.00, G_PARAM_READABLE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ORIENTATION, @@ -185,7 +183,7 @@ xfce_clock_fuzzy_class_init (XfceClockFuzzyClass *klass) GTK_TYPE_ORIENTATION, GTK_ORIENTATION_HORIZONTAL, G_PARAM_WRITABLE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_FUZZINESS, @@ -194,7 +192,7 @@ xfce_clock_fuzzy_class_init (XfceClockFuzzyClass *klass) FUZZINESS_MAX, FUZZINESS_DEFAULT, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); } @@ -210,20 +208,19 @@ xfce_clock_fuzzy_init (XfceClockFuzzy *fuzzy) static void -xfce_clock_fuzzy_set_property (GObject *object, - guint prop_id, +xfce_clock_fuzzy_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { XfceClockFuzzy *fuzzy = XFCE_CLOCK_FUZZY (object); - guint fuzziness; + guint fuzziness; switch (prop_id) { case PROP_ORIENTATION: gtk_label_set_angle (GTK_LABEL (object), - g_value_get_enum (value) == GTK_ORIENTATION_HORIZONTAL ? - 0 : 270); + g_value_get_enum (value) == GTK_ORIENTATION_HORIZONTAL ? 0 : 270); break; case PROP_FUZZINESS: @@ -244,9 +241,9 @@ xfce_clock_fuzzy_set_property (GObject *object, static void -xfce_clock_fuzzy_get_property (GObject *object, - guint prop_id, - GValue *value, +xfce_clock_fuzzy_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { XfceClockFuzzy *fuzzy = XFCE_CLOCK_FUZZY (object); @@ -282,16 +279,16 @@ xfce_clock_fuzzy_finalize (GObject *object) static gboolean xfce_clock_fuzzy_update (XfceClockFuzzy *fuzzy, - ClockTime *time) + ClockTime *time) { - GDateTime *date_time; - gint sector; - gint minute, hour; - GString *string; - const gchar *time_format; - gchar *p; - gchar pattern[3]; - gboolean is_pm; + GDateTime *date_time; + gint sector; + gint minute, hour; + GString *string; + const gchar *time_format; + gchar *p; + gchar pattern[3]; + gboolean is_pm; panel_return_val_if_fail (XFCE_CLOCK_IS_FUZZY (fuzzy), FALSE); @@ -342,7 +339,7 @@ xfce_clock_fuzzy_update (XfceClockFuzzy *fuzzy, p = strchr (time_format, '%'); panel_assert (p != NULL && g_ascii_isdigit (*(p + 1))); } - + string = g_string_new (NULL); /* replace the %? with the hour name */ @@ -374,7 +371,6 @@ xfce_clock_fuzzy_update (XfceClockFuzzy *fuzzy, - GtkWidget * xfce_clock_fuzzy_new (ClockTime *time, ClockSleepMonitor *sleep_monitor) diff --git a/plugins/clock/clock-fuzzy.h b/plugins/clock/clock-fuzzy.h index 5b76ca36a..2bc3b5c70 100644 --- a/plugins/clock/clock-fuzzy.h +++ b/plugins/clock/clock-fuzzy.h @@ -30,10 +30,12 @@ G_BEGIN_DECLS #define XFCE_CLOCK_TYPE_FUZZY (xfce_clock_fuzzy_get_type ()) G_DECLARE_FINAL_TYPE (XfceClockFuzzy, xfce_clock_fuzzy, XFCE_CLOCK, FUZZY, GtkLabel) -void xfce_clock_fuzzy_register_type (XfcePanelTypeModule *type_module); +void +xfce_clock_fuzzy_register_type (XfcePanelTypeModule *type_module); -GtkWidget *xfce_clock_fuzzy_new (ClockTime *time, - ClockSleepMonitor *sleep_monitor) G_GNUC_MALLOC; +GtkWidget * +xfce_clock_fuzzy_new (ClockTime *time, + ClockSleepMonitor *sleep_monitor) G_GNUC_MALLOC; G_END_DECLS diff --git a/plugins/clock/clock-lcd.c b/plugins/clock/clock-lcd.c index e48816e4f..97e041d58 100644 --- a/plugins/clock/clock-lcd.c +++ b/plugins/clock/clock-lcd.c @@ -29,34 +29,41 @@ #define RELATIVE_SPACE (0.10) #define RELATIVE_DIGIT (5 * RELATIVE_SPACE) -#define RELATIVE_DOTS (3 * RELATIVE_SPACE) +#define RELATIVE_DOTS (3 * RELATIVE_SPACE) -static void xfce_clock_lcd_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void xfce_clock_lcd_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void xfce_clock_lcd_finalize (GObject *object); -static gboolean xfce_clock_lcd_draw (GtkWidget *widget, - cairo_t *cr); -static gdouble xfce_clock_lcd_get_ratio (XfceClockLcd *lcd); -static gdouble xfce_clock_lcd_draw_dots (cairo_t *cr, - gdouble size, - gdouble offset_x, - gdouble offset_y); -static gdouble xfce_clock_lcd_draw_digit (cairo_t *cr, - guint number, - gdouble size, - gdouble offset_x, - gdouble offset_y); -static gboolean xfce_clock_lcd_update (XfceClockLcd *lcd, - ClockTime *time); - +static void +xfce_clock_lcd_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +xfce_clock_lcd_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +xfce_clock_lcd_finalize (GObject *object); +static gboolean +xfce_clock_lcd_draw (GtkWidget *widget, + cairo_t *cr); +static gdouble +xfce_clock_lcd_get_ratio (XfceClockLcd *lcd); +static gdouble +xfce_clock_lcd_draw_dots (cairo_t *cr, + gdouble size, + gdouble offset_x, + gdouble offset_y); +static gdouble +xfce_clock_lcd_draw_digit (cairo_t *cr, + guint number, + gdouble size, + gdouble offset_x, + gdouble offset_y); +static gboolean +xfce_clock_lcd_update (XfceClockLcd *lcd, + ClockTime *time); @@ -75,22 +82,21 @@ struct _XfceClockLcd { GtkImage __parent__; - ClockTimeTimeout *timeout; + ClockTimeTimeout *timeout; - guint show_seconds : 1; - guint show_military : 1; /* 24-hour clock */ - guint show_meridiem : 1; /* am/pm */ - guint flash_separators : 1; + guint show_seconds : 1; + guint show_military : 1; /* 24-hour clock */ + guint show_meridiem : 1; /* am/pm */ + guint flash_separators : 1; - ClockTime *time; + ClockTime *time; }; typedef struct { gdouble x; gdouble y; -} -LcdPoint; +} LcdPoint; @@ -101,7 +107,7 @@ G_DEFINE_FINAL_TYPE (XfceClockLcd, xfce_clock_lcd, GTK_TYPE_IMAGE) static void xfce_clock_lcd_class_init (XfceClockLcdClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; GtkWidgetClass *gtkwidget_class; gobject_class = G_OBJECT_CLASS (klass); @@ -117,7 +123,7 @@ xfce_clock_lcd_class_init (XfceClockLcdClass *klass) g_param_spec_double ("size-ratio", NULL, NULL, -1, G_MAXDOUBLE, -1.0, G_PARAM_READABLE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ORIENTATION, @@ -125,35 +131,35 @@ xfce_clock_lcd_class_init (XfceClockLcdClass *klass) GTK_TYPE_ORIENTATION, GTK_ORIENTATION_HORIZONTAL, G_PARAM_WRITABLE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SHOW_SECONDS, g_param_spec_boolean ("show-seconds", NULL, NULL, FALSE, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SHOW_MILITARY, g_param_spec_boolean ("show-military", NULL, NULL, FALSE, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SHOW_MERIDIEM, g_param_spec_boolean ("show-meridiem", NULL, NULL, TRUE, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_FLASH_SEPARATORS, g_param_spec_boolean ("flash-separators", NULL, NULL, FALSE, G_PARAM_READWRITE - | G_PARAM_STATIC_STRINGS)); + | G_PARAM_STATIC_STRINGS)); } @@ -170,13 +176,13 @@ xfce_clock_lcd_init (XfceClockLcd *lcd) static void -xfce_clock_lcd_set_property (GObject *object, - guint prop_id, +xfce_clock_lcd_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { XfceClockLcd *lcd = XFCE_CLOCK_LCD (object); - gboolean show_seconds; + gboolean show_seconds; switch (prop_id) { @@ -209,20 +215,20 @@ xfce_clock_lcd_set_property (GObject *object, /* reschedule the timeout and resize */ show_seconds = lcd->show_seconds || lcd->flash_separators; clock_time_timeout_set_interval (lcd->timeout, - show_seconds ? CLOCK_INTERVAL_SECOND : CLOCK_INTERVAL_MINUTE); + show_seconds ? CLOCK_INTERVAL_SECOND : CLOCK_INTERVAL_MINUTE); gtk_widget_queue_resize (GTK_WIDGET (lcd)); } static void -xfce_clock_lcd_get_property (GObject *object, - guint prop_id, - GValue *value, +xfce_clock_lcd_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { XfceClockLcd *lcd = XFCE_CLOCK_LCD (object); - gdouble ratio; + gdouble ratio; switch (prop_id) { @@ -268,17 +274,17 @@ xfce_clock_lcd_finalize (GObject *object) static gboolean xfce_clock_lcd_draw (GtkWidget *widget, - cairo_t *cr) + cairo_t *cr) { XfceClockLcd *lcd = XFCE_CLOCK_LCD (widget); - gdouble offset_x, offset_y; - gint ticks, i; - gdouble size; - gdouble ratio; - GDateTime *time; + gdouble offset_x, offset_y; + gint ticks, i; + gdouble size; + gdouble ratio; + GDateTime *time; GtkAllocation allocation; GtkStyleContext *ctx; - GdkRGBA fg_rgba; + GdkRGBA fg_rgba; panel_return_val_if_fail (XFCE_CLOCK_IS_LCD (lcd), FALSE); panel_return_val_if_fail (cr != NULL, FALSE); @@ -391,8 +397,8 @@ xfce_clock_lcd_draw (GtkWidget *widget, static gdouble xfce_clock_lcd_get_ratio (XfceClockLcd *lcd) { - gdouble ratio; - gint ticks; + gdouble ratio; + gint ticks; GDateTime *time; /* get the local time */ @@ -428,9 +434,9 @@ xfce_clock_lcd_get_ratio (XfceClockLcd *lcd) static gdouble xfce_clock_lcd_draw_dots (cairo_t *cr, - gdouble size, - gdouble offset_x, - gdouble offset_y) + gdouble size, + gdouble offset_x, + gdouble offset_y) { gint i; @@ -468,31 +474,30 @@ xfce_clock_lcd_draw_dots (cairo_t *cr, */ static gdouble xfce_clock_lcd_draw_digit (cairo_t *cr, - guint number, - gdouble size, - gdouble offset_x, - gdouble offset_y) + guint number, + gdouble size, + gdouble offset_x, + gdouble offset_y) { - guint i, j; - gint segment; + guint i, j; + gint segment; gdouble x, y; gdouble rel_x, rel_y; /* coordicates to draw for each segment */ const LcdPoint segment_points[][6] = { - /* 1 */ { { 0, 0 }, { 0.5, 0 }, { 0.4, 0.1 }, { 0.1, 0.1 }, { -1, }, { -1, } }, - /* 2 */ { { 0.4, 0.1 }, { 0.5, 0.0 }, { 0.5, 0.5 }, { 0.4, 0.45 }, { -1, }, { -1, } }, - /* 3 */ { { 0.4, 0.55 }, { 0.5, 0.5 }, { 0.5, 1 }, { 0.4, 0.9 }, { -1, }, { -1, } }, - /* 4 */ { { 0.1, 0.9 }, { 0.4, 0.9 }, { 0.5, 1 }, { 0.0, 1 }, { -1, }, { -1, } }, - /* 5 */ { { 0.0, 0.5 }, { 0.1, 0.55 }, { 0.1, 0.90 }, { 0.0, 1}, { -1, }, { -1, } }, - /* 6 */ { { 0.0, 0.0 }, { 0.1, 0.1 }, { 0.1, 0.45 }, { 0.0, 0.5 }, { -1, }, { -1, } }, + /* 1 */ { { 0, 0 }, { 0.5, 0 }, { 0.4, 0.1 }, { 0.1, 0.1 }, { -1, /**/ }, { -1, /**/ } }, + /* 2 */ { { 0.4, 0.1 }, { 0.5, 0.0 }, { 0.5, 0.5 }, { 0.4, 0.45 }, { -1, /**/ }, { -1, /**/ } }, + /* 3 */ { { 0.4, 0.55 }, { 0.5, 0.5 }, { 0.5, 1 }, { 0.4, 0.9 }, { -1, /**/ }, { -1, /**/ } }, + /* 4 */ { { 0.1, 0.9 }, { 0.4, 0.9 }, { 0.5, 1 }, { 0.0, 1 }, { -1, /**/ }, { -1, /**/ } }, + /* 5 */ { { 0.0, 0.5 }, { 0.1, 0.55 }, { 0.1, 0.90 }, { 0.0, 1 }, { -1, /**/ }, { -1, /**/ } }, + /* 6 */ { { 0.0, 0.0 }, { 0.1, 0.1 }, { 0.1, 0.45 }, { 0.0, 0.5 }, { -1, /**/ }, { -1, /**/ } }, /* 7 */ { { 0.0, 0.5 }, { 0.1, 0.45 }, { 0.4, 0.45 }, { 0.5, 0.5 }, { 0.4, 0.55 }, { 0.1, 0.55 } }, }; /* space line, mirrored to other side */ const LcdPoint clear_points[] = { - { 0, 0 }, { 0.25, 0.25 }, { 0.25, 0.375 }, { 0, 0.5 }, - { 0.25, 0.625 }, { 0.25, 0.75 }, { 0, 1 } + { 0, 0 }, { 0.25, 0.25 }, { 0.25, 0.375 }, { 0, 0.5 }, { 0.25, 0.625 }, { 0.25, 0.75 }, { 0, 1 } }; /* segment to draw for each number: 0, 1, ..., 9, A, P */ @@ -574,7 +579,7 @@ xfce_clock_lcd_draw_digit (cairo_t *cr, static gboolean xfce_clock_lcd_update (XfceClockLcd *lcd, - ClockTime *time) + ClockTime *time) { GtkWidget *widget = GTK_WIDGET (lcd); diff --git a/plugins/clock/clock-lcd.h b/plugins/clock/clock-lcd.h index 7fe837bb0..92488ddec 100644 --- a/plugins/clock/clock-lcd.h +++ b/plugins/clock/clock-lcd.h @@ -30,10 +30,12 @@ G_BEGIN_DECLS #define XFCE_CLOCK_TYPE_LCD (xfce_clock_lcd_get_type ()) G_DECLARE_FINAL_TYPE (XfceClockLcd, xfce_clock_lcd, XFCE_CLOCK, LCD, GtkImage) -void xfce_clock_lcd_register_type (XfcePanelTypeModule *type_module); +void +xfce_clock_lcd_register_type (XfcePanelTypeModule *type_module); -GtkWidget *xfce_clock_lcd_new (ClockTime *time, - ClockSleepMonitor *sleep_monitor) G_GNUC_MALLOC; +GtkWidget * +xfce_clock_lcd_new (ClockTime *time, + ClockSleepMonitor *sleep_monitor) G_GNUC_MALLOC; G_END_DECLS diff --git a/plugins/clock/clock-sleep-monitor.c b/plugins/clock/clock-sleep-monitor.c index 27db58961..bcde5bf1c 100644 --- a/plugins/clock/clock-sleep-monitor.c +++ b/plugins/clock/clock-sleep-monitor.c @@ -58,37 +58,39 @@ typedef struct _ClockSleepMonitorPrivate G_DEFINE_ABSTRACT_TYPE (ClockSleepMonitor, clock_sleep_monitor, G_TYPE_OBJECT) -static void clock_sleep_monitor_finalize (GObject *object); +static void +clock_sleep_monitor_finalize (GObject *object); -static void clock_sleep_monitor_class_init (ClockSleepMonitorClass *klass) +static void +clock_sleep_monitor_class_init (ClockSleepMonitorClass *klass) { GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = clock_sleep_monitor_finalize; - clock_sleep_monitor_woke_up_signal = - g_signal_new ( - g_intern_static_string ("woke-up"), - G_TYPE_FROM_CLASS (gobject_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + clock_sleep_monitor_woke_up_signal = g_signal_new (g_intern_static_string ("woke-up"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } -static void clock_sleep_monitor_init (ClockSleepMonitor *monitor) +static void +clock_sleep_monitor_init (ClockSleepMonitor *monitor) { } -static void clock_sleep_monitor_finalize (GObject *object) +static void +clock_sleep_monitor_finalize (GObject *object) { G_OBJECT_CLASS (clock_sleep_monitor_parent_class)->finalize (object); } -#if defined (SLEEP_MONITOR_USE_LOGIND) || defined (SLEEP_MONITOR_USE_CONSOLEKIT) +#if defined(SLEEP_MONITOR_USE_LOGIND) || defined(SLEEP_MONITOR_USE_CONSOLEKIT) struct _ClockSleepDBusMonitor { @@ -101,9 +103,11 @@ G_DECLARE_FINAL_TYPE (ClockSleepDBusMonitor, clock_sleep_dbus_monitor, CLOCK, SL G_DEFINE_FINAL_TYPE (ClockSleepDBusMonitor, clock_sleep_dbus_monitor, CLOCK_TYPE_SLEEP_MONITOR) -static void clock_sleep_dbus_monitor_finalize (GObject *object); +static void +clock_sleep_dbus_monitor_finalize (GObject *object); -static void clock_sleep_dbus_monitor_class_init (ClockSleepDBusMonitorClass *klass) +static void +clock_sleep_dbus_monitor_class_init (ClockSleepDBusMonitorClass *klass) { GObjectClass *gobject_class; @@ -111,11 +115,13 @@ static void clock_sleep_dbus_monitor_class_init (ClockSleepDBusMonitorClass *kla gobject_class->finalize = clock_sleep_dbus_monitor_finalize; } -static void clock_sleep_dbus_monitor_init (ClockSleepDBusMonitor *monitor) +static void +clock_sleep_dbus_monitor_init (ClockSleepDBusMonitor *monitor) { } -static void clock_sleep_dbus_monitor_finalize (GObject *object) +static void +clock_sleep_dbus_monitor_finalize (GObject *object) { ClockSleepDBusMonitor *monitor = CLOCK_SLEEP_DBUS_MONITOR (object); g_return_if_fail (monitor != NULL); @@ -129,11 +135,12 @@ static void clock_sleep_dbus_monitor_finalize (GObject *object) G_OBJECT_CLASS (clock_sleep_dbus_monitor_parent_class)->finalize (object); } -static void on_prepare_sleep_signal (GDBusProxy *proxy, - gchar *sender_name, - gchar *signal_name, - GVariant *parameters, - ClockSleepMonitor *monitor) +static void +on_prepare_sleep_signal (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + ClockSleepMonitor *monitor) { const gchar *format_string = "(b)"; gboolean going_to_sleep; @@ -192,7 +199,8 @@ proxy_ready (GObject *source_object, } } -static ClockSleepMonitor* clock_sleep_dbus_monitor_create (void) +static ClockSleepMonitor * +clock_sleep_dbus_monitor_create (void) { ClockSleepDBusMonitor *monitor; @@ -237,17 +245,17 @@ static ClockSleepMonitor* clock_sleep_dbus_monitor_create (void) * Collect available implementations in a reasonable order. */ -typedef ClockSleepMonitor* (*SleepMonitorFactory) (void); +typedef ClockSleepMonitor *(*SleepMonitorFactory) (void); -static SleepMonitorFactory sleep_monitor_factories[] = -{ -#if defined (SLEEP_MONITOR_USE_LOGIND) || defined (SLEEP_MONITOR_USE_CONSOLEKIT) +static SleepMonitorFactory sleep_monitor_factories[] = { +#if defined(SLEEP_MONITOR_USE_LOGIND) || defined(SLEEP_MONITOR_USE_CONSOLEKIT) clock_sleep_dbus_monitor_create, #endif NULL }; -ClockSleepMonitor *clock_sleep_monitor_create (void) +ClockSleepMonitor * +clock_sleep_monitor_create (void) { SleepMonitorFactory *factory_ptr = &sleep_monitor_factories[0]; ClockSleepMonitor *monitor = NULL; diff --git a/plugins/clock/clock-sleep-monitor.h b/plugins/clock/clock-sleep-monitor.h index d5dd8dcca..7438cbc8d 100644 --- a/plugins/clock/clock-sleep-monitor.h +++ b/plugins/clock/clock-sleep-monitor.h @@ -36,6 +36,7 @@ struct _ClockSleepMonitorClass * The sleep monitor emits a signal `woke-up()` when it detects wakeup * from a sleep state. */ -ClockSleepMonitor* clock_sleep_monitor_create (void); +ClockSleepMonitor * +clock_sleep_monitor_create (void); G_END_DECLS diff --git a/plugins/clock/clock-time.c b/plugins/clock/clock-time.c index c4f4a4439..ee0ec64c2 100644 --- a/plugins/clock/clock-time.c +++ b/plugins/clock/clock-time.c @@ -26,15 +26,18 @@ #include "common/panel-private.h" -static void clock_time_finalize (GObject *object); -static void clock_time_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void clock_time_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); +static void +clock_time_finalize (GObject *object); +static void +clock_time_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +clock_time_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); @@ -48,20 +51,20 @@ enum struct _ClockTime { - GObject __parent__; + GObject __parent__; - gchar *timezone_name; - GTimeZone *timezone; + gchar *timezone_name; + GTimeZone *timezone; }; struct _ClockTimeTimeout { - guint interval; - guint timeout_id; - guint timeout_counter; - guint restart : 1; - ClockTime *time; - guint time_changed_id; + guint interval; + guint timeout_id; + guint timeout_counter; + guint restart : 1; + ClockTime *time; + guint time_changed_id; ClockSleepMonitor *sleep_monitor; }; @@ -81,7 +84,7 @@ G_DEFINE_FINAL_TYPE (ClockTime, clock_time, G_TYPE_OBJECT) static void clock_time_class_init (ClockTimeClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = clock_time_finalize; @@ -95,13 +98,12 @@ clock_time_class_init (ClockTimeClass *klass) DEFAULT_TIMEZONE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - clock_time_signals[TIME_CHANGED] = - g_signal_new (g_intern_static_string ("time-changed"), - G_TYPE_FROM_CLASS (gobject_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + clock_time_signals[TIME_CHANGED] = g_signal_new (g_intern_static_string ("time-changed"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } @@ -131,9 +133,9 @@ clock_time_finalize (GObject *object) static void -clock_time_get_property (GObject *object, - guint prop_id, - GValue *value, +clock_time_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { ClockTime *time = CLOCK_TIME (object); @@ -153,13 +155,13 @@ clock_time_get_property (GObject *object, static void -clock_time_set_property (GObject *object, - guint prop_id, +clock_time_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { - ClockTime *time = CLOCK_TIME (object); - const gchar *str_value; + ClockTime *time = CLOCK_TIME (object); + const gchar *str_value; switch (prop_id) { @@ -213,11 +215,11 @@ clock_time_get_time (ClockTime *time) gchar * -clock_time_strdup_strftime (ClockTime *time, - const gchar *format) +clock_time_strdup_strftime (ClockTime *time, + const gchar *format) { GDateTime *date_time; - gchar *str; + gchar *str; panel_return_val_if_fail (CLOCK_IS_TIME (time), NULL); @@ -241,7 +243,7 @@ clock_time_interval_from_format (const gchar *format) const gchar *p; if (G_UNLIKELY (xfce_str_is_empty (format))) - return CLOCK_INTERVAL_MINUTE; + return CLOCK_INTERVAL_MINUTE; for (p = format; *p != '\0'; ++p) { @@ -270,7 +272,7 @@ static gboolean clock_time_timeout_running (gpointer user_data) { ClockTimeTimeout *timeout = user_data; - GDateTime *time; + GDateTime *time; g_signal_emit (G_OBJECT (timeout->time), clock_time_signals[TIME_CHANGED], 0); @@ -328,11 +330,11 @@ clock_time_timeout_sync (gpointer user_data) ClockTimeTimeout * -clock_time_timeout_new (guint interval, - ClockTime *time, +clock_time_timeout_new (guint interval, + ClockTime *time, ClockSleepMonitor *sleep_monitor, - GCallback c_handler, - gpointer gobject) + GCallback c_handler, + gpointer gobject) { ClockTimeTimeout *timeout; @@ -347,9 +349,8 @@ clock_time_timeout_new (guint interval, timeout->restart = FALSE; timeout->time = time; - timeout->time_changed_id = - g_signal_connect_swapped (G_OBJECT (time), "time-changed", - c_handler, gobject); + timeout->time_changed_id = g_signal_connect_swapped (G_OBJECT (time), "time-changed", + c_handler, gobject); g_object_ref (G_OBJECT (timeout->time)); @@ -370,11 +371,11 @@ clock_time_timeout_new (guint interval, void clock_time_timeout_set_interval (ClockTimeTimeout *timeout, - guint interval) + guint interval) { GDateTime *time; - guint next_interval; - gboolean restart; + guint next_interval; + gboolean restart; panel_return_if_fail (timeout != NULL); panel_return_if_fail (interval > 0); diff --git a/plugins/clock/clock-time.h b/plugins/clock/clock-time.h index c03400b31..efabecfca 100644 --- a/plugins/clock/clock-time.h +++ b/plugins/clock/clock-time.h @@ -31,34 +31,43 @@ G_BEGIN_DECLS #define CLOCK_INTERVAL_SECOND (1) #define CLOCK_INTERVAL_MINUTE (60) -typedef struct _ClockTimeTimeout ClockTimeTimeout; +typedef struct _ClockTimeTimeout ClockTimeTimeout; #define CLOCK_TYPE_TIME (clock_time_get_type ()) G_DECLARE_FINAL_TYPE (ClockTime, clock_time, CLOCK, TIME, GObject) -void clock_time_register_type (XfcePanelTypeModule *type_module); +void +clock_time_register_type (XfcePanelTypeModule *type_module); -ClockTime *clock_time_new (void); +ClockTime * +clock_time_new (void); -ClockTimeTimeout *clock_time_timeout_new (guint interval, - ClockTime *time, - ClockSleepMonitor *sleep_monitor, - GCallback c_handler, - gpointer gobject); +ClockTimeTimeout * +clock_time_timeout_new (guint interval, + ClockTime *time, + ClockSleepMonitor *sleep_monitor, + GCallback c_handler, + gpointer gobject); -void clock_time_timeout_set_interval (ClockTimeTimeout *timeout, - guint interval); +void +clock_time_timeout_set_interval (ClockTimeTimeout *timeout, + guint interval); -void clock_time_timeout_restart (ClockTimeTimeout *timeout); +void +clock_time_timeout_restart (ClockTimeTimeout *timeout); -void clock_time_timeout_free (ClockTimeTimeout *timeout); +void +clock_time_timeout_free (ClockTimeTimeout *timeout); -GDateTime *clock_time_get_time (ClockTime *time); +GDateTime * +clock_time_get_time (ClockTime *time); -gchar *clock_time_strdup_strftime (ClockTime *time, - const gchar *format); +gchar * +clock_time_strdup_strftime (ClockTime *time, + const gchar *format); -guint clock_time_interval_from_format (const gchar *format); +guint +clock_time_interval_from_format (const gchar *format); G_END_DECLS diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c index fb9121a88..472ff8f17 100644 --- a/plugins/clock/clock.c +++ b/plugins/clock/clock.c @@ -40,7 +40,7 @@ #include <libxfce4ui/libxfce4ui.h> /* TRANSLATORS: adjust this accordingly for your locale format */ -#define DEFAULT_TOOLTIP_FORMAT NC_("Date", "%A %d %B %Y") +#define DEFAULT_TOOLTIP_FORMAT NC_ ("Date", "%A %d %B %Y") /* Please adjust the following command to match your distribution */ /* e.g. "time-admin" */ @@ -52,35 +52,50 @@ -static void clock_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void clock_plugin_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static gboolean clock_plugin_leave_notify_event (GtkWidget *widget, - GdkEventCrossing *event, - ClockPlugin *plugin); -static gboolean clock_plugin_enter_notify_event (GtkWidget *widget, - GdkEventCrossing *event, - ClockPlugin *plugin); -static gboolean clock_plugin_button_press_event (GtkWidget *widget, - GdkEventButton *event, - ClockPlugin *plugin); -static void clock_plugin_construct (XfcePanelPlugin *panel_plugin); -static void clock_plugin_free_data (XfcePanelPlugin *panel_plugin); -static gboolean clock_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); -static void clock_plugin_size_ratio_changed (XfcePanelPlugin *panel_plugin); -static void clock_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode); -static void clock_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); -static void clock_plugin_set_mode (ClockPlugin *plugin); -static void clock_plugin_popup_calendar (ClockPlugin *plugin); -static gboolean clock_plugin_tooltip (gpointer user_data); -static void clock_plugin_set_calendar_options (ClockPlugin *plugin); +static void +clock_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +clock_plugin_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static gboolean +clock_plugin_leave_notify_event (GtkWidget *widget, + GdkEventCrossing *event, + ClockPlugin *plugin); +static gboolean +clock_plugin_enter_notify_event (GtkWidget *widget, + GdkEventCrossing *event, + ClockPlugin *plugin); +static gboolean +clock_plugin_button_press_event (GtkWidget *widget, + GdkEventButton *event, + ClockPlugin *plugin); +static void +clock_plugin_construct (XfcePanelPlugin *panel_plugin); +static void +clock_plugin_free_data (XfcePanelPlugin *panel_plugin); +static gboolean +clock_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); +static void +clock_plugin_size_ratio_changed (XfcePanelPlugin *panel_plugin); +static void +clock_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode); +static void +clock_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); +static void +clock_plugin_set_mode (ClockPlugin *plugin); +static void +clock_plugin_popup_calendar (ClockPlugin *plugin); +static gboolean +clock_plugin_tooltip (gpointer user_data); +static void +clock_plugin_set_calendar_options (ClockPlugin *plugin); @@ -107,52 +122,48 @@ typedef enum CLOCK_PLUGIN_MODE_MIN = CLOCK_PLUGIN_MODE_ANALOG, CLOCK_PLUGIN_MODE_MAX = CLOCK_PLUGIN_MODE_LCD, CLOCK_PLUGIN_MODE_DEFAULT = CLOCK_PLUGIN_MODE_DIGITAL -} -ClockPluginMode; +} ClockPluginMode; struct _ClockPlugin { XfcePanelPlugin __parent__; - GtkWidget *clock; - GtkWidget *button; + GtkWidget *clock; + GtkWidget *button; - GtkWidget *calendar_window; - GtkWidget *calendar; + GtkWidget *calendar_window; + GtkWidget *calendar; - gchar *command; - guint show_week_numbers : 1; - ClockPluginMode mode; - guint rotate_vertically : 1; + gchar *command; + guint show_week_numbers : 1; + ClockPluginMode mode; + guint rotate_vertically : 1; - gchar *tooltip_format; - ClockTimeTimeout *tooltip_timeout; + gchar *tooltip_format; + ClockTimeTimeout *tooltip_timeout; - gchar *time_config_tool; - ClockTime *time; + gchar *time_config_tool; + ClockTime *time; /* may be NULL if no sleep monitor could be instatiated */ - ClockSleepMonitor *sleep_monitor; + ClockSleepMonitor *sleep_monitor; }; typedef struct { ClockPlugin *plugin; - GtkBuilder *builder; - guint zonecompletion_idle; -} -ClockPluginDialog; + GtkBuilder *builder; + guint zonecompletion_idle; +} ClockPluginDialog; -static const gchar *tooltip_formats[] = -{ +static const gchar *tooltip_formats[] = { DEFAULT_TOOLTIP_FORMAT, "%x", - N_("Week %V"), + N_ ("Week %V"), NULL }; -static const gchar *digital_time_formats[] = -{ +static const gchar *digital_time_formats[] = { DEFAULT_DIGITAL_TIME_FORMAT, "%T", "%_H:%M", @@ -163,8 +174,7 @@ static const gchar *digital_time_formats[] = NULL }; -static const gchar *digital_date_formats[] = -{ +static const gchar *digital_date_formats[] = { DEFAULT_DIGITAL_DATE_FORMAT, "%Y %B %d", "%m/%d/%Y", @@ -197,7 +207,7 @@ XFCE_PANEL_DEFINE_PLUGIN (ClockPlugin, clock_plugin) static void clock_plugin_class_init (ClockPluginClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; XfcePanelPluginClass *plugin_class; gobject_class = G_OBJECT_CLASS (klass); @@ -269,7 +279,7 @@ clock_plugin_init (ClockPlugin *plugin) plugin->time_config_tool = g_strdup (DEFAULT_TIME_CONFIG_TOOL); plugin->rotate_vertically = TRUE; plugin->time = clock_time_new (); - plugin->sleep_monitor = clock_sleep_monitor_create(); + plugin->sleep_monitor = clock_sleep_monitor_create (); plugin->button = xfce_panel_create_toggle_button (); /* xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (plugin), plugin->button); */ @@ -290,9 +300,9 @@ clock_plugin_init (ClockPlugin *plugin) static void -clock_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, +clock_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { ClockPlugin *plugin = CLOCK_PLUGIN (object); @@ -332,13 +342,13 @@ clock_plugin_get_property (GObject *object, static void -clock_plugin_set_property (GObject *object, - guint prop_id, +clock_plugin_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { ClockPlugin *plugin = CLOCK_PLUGIN (object); - gboolean rotate_vertically; + gboolean rotate_vertically; switch (prop_id) { @@ -395,9 +405,9 @@ clock_plugin_set_property (GObject *object, static gboolean -clock_plugin_leave_notify_event (GtkWidget *widget, +clock_plugin_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event, - ClockPlugin *plugin) + ClockPlugin *plugin) { /* stop a running tooltip timeout when we leave the widget */ if (plugin->tooltip_timeout != NULL) @@ -412,11 +422,11 @@ clock_plugin_leave_notify_event (GtkWidget *widget, static gboolean -clock_plugin_enter_notify_event (GtkWidget *widget, +clock_plugin_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event, - ClockPlugin *plugin) + ClockPlugin *plugin) { - guint interval; + guint interval; /* start the tooltip timeout if needed */ /* don't bother with hooking up the sleep monitor here */ @@ -433,16 +443,15 @@ clock_plugin_enter_notify_event (GtkWidget *widget, static gboolean -clock_plugin_button_press_event (GtkWidget *widget, +clock_plugin_button_press_event (GtkWidget *widget, GdkEventButton *event, - ClockPlugin *plugin) + ClockPlugin *plugin) { - GError *error = NULL; + GError *error = NULL; if (event->button == 1 || event->button == 2) { - if (event->type == GDK_BUTTON_PRESS && - xfce_str_is_empty (plugin->command)) + if (event->type == GDK_BUTTON_PRESS && xfce_str_is_empty (plugin->command)) { /* toggle calendar window visibility */ if (plugin->calendar_window == NULL @@ -486,9 +495,8 @@ clock_plugin_button_press_event (GtkWidget *widget, static void clock_plugin_construct (XfcePanelPlugin *panel_plugin) { - ClockPlugin *plugin = CLOCK_PLUGIN (panel_plugin); - const PanelProperty properties[] = - { + ClockPlugin *plugin = CLOCK_PLUGIN (panel_plugin); + const PanelProperty properties[] = { { "mode", G_TYPE_UINT }, { "tooltip-format", G_TYPE_STRING }, { "command", G_TYPE_STRING }, @@ -498,11 +506,10 @@ clock_plugin_construct (XfcePanelPlugin *panel_plugin) { NULL } }; - const PanelProperty time_properties[] = - { - { "timezone", G_TYPE_STRING }, - { NULL } - }; + const PanelProperty time_properties[] = { + { "timezone", G_TYPE_STRING }, + { NULL } + }; /* show configure */ xfce_panel_plugin_menu_show_configure (panel_plugin); @@ -548,12 +555,12 @@ clock_plugin_free_data (XfcePanelPlugin *panel_plugin) static gboolean clock_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { ClockPlugin *plugin = CLOCK_PLUGIN (panel_plugin); - gdouble ratio; - gint ratio_size; - gint offset; + gdouble ratio; + gint ratio_size; + gint offset; if (plugin->clock == NULL) return TRUE; @@ -607,16 +614,16 @@ clock_plugin_size_ratio_changed (XfcePanelPlugin *panel_plugin) static void -clock_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode) +clock_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode) { - ClockPlugin *plugin = CLOCK_PLUGIN (panel_plugin); - GtkOrientation orientation; + ClockPlugin *plugin = CLOCK_PLUGIN (panel_plugin); + GtkOrientation orientation; if (plugin->rotate_vertically) { - orientation = (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? - GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL; + orientation = (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? GTK_ORIENTATION_VERTICAL + : GTK_ORIENTATION_HORIZONTAL; g_object_set (G_OBJECT (plugin->clock), "orientation", orientation, NULL); } @@ -627,12 +634,13 @@ clock_plugin_mode_changed (XfcePanelPlugin *panel_plugin, static void -clock_plugin_configure_plugin_mode_changed (GtkComboBox *combo, +clock_plugin_configure_plugin_mode_changed (GtkComboBox *combo, ClockPluginDialog *dialog) { - guint i, active, mode; + guint i, active, mode; GObject *object; - struct { + struct + { const gchar *widget; const gchar *binding; const gchar *property; @@ -719,10 +727,10 @@ clock_plugin_configure_plugin_mode_changed (GtkComboBox *combo, static void -clock_plugin_digital_layout_changed (GtkComboBox *combo, +clock_plugin_digital_layout_changed (GtkComboBox *combo, ClockPluginDialog *dialog) { - guint mode; + guint mode; GObject *date_box, *time_box; panel_return_if_fail (GTK_IS_COMBO_BOX (combo)); @@ -766,11 +774,11 @@ clock_plugin_digital_layout_changed (GtkComboBox *combo, static void clock_plugin_configure_plugin_chooser_changed (GtkComboBox *combo, - GtkEntry *entry) + GtkEntry *entry) { - GtkTreeIter iter; + GtkTreeIter iter; GtkTreeModel *model; - gchar *format; + gchar *format; panel_return_if_fail (GTK_IS_COMBO_BOX (combo)); panel_return_if_fail (GTK_IS_ENTRY (entry)); @@ -797,8 +805,8 @@ clock_plugin_configure_plugin_chooser_changed (GtkComboBox *combo, static gboolean clock_plugin_configure_plugin_chooser_separator (GtkTreeModel *model, - GtkTreeIter *iter, - gpointer user_data) + GtkTreeIter *iter, + gpointer user_data) { gboolean separator; @@ -810,7 +818,7 @@ clock_plugin_configure_plugin_chooser_separator (GtkTreeModel *model, static void -clock_plugin_validate_format_specifier (GtkEntry *entry, +clock_plugin_validate_format_specifier (GtkEntry *entry, const gchar *format, ClockPlugin *plugin) { @@ -828,7 +836,7 @@ clock_plugin_validate_format_specifier (GtkEntry *entry, static void clock_plugin_validate_entry_text (GtkEditable *entry, - gpointer user_data) + gpointer user_data) { ClockPlugin *plugin = user_data; @@ -840,12 +848,12 @@ clock_plugin_validate_entry_text (GtkEditable *entry, static void -clock_plugin_validate_timezone (GtkEntry *entry, +clock_plugin_validate_timezone (GtkEntry *entry, const gchar *format, ClockPlugin *plugin) { GtkStyleContext *context; - gchar *filename; + gchar *filename; context = gtk_widget_get_style_context (GTK_WIDGET (entry)); @@ -868,7 +876,7 @@ clock_plugin_validate_timezone (GtkEntry *entry, static void clock_plugin_validate_entry_tz (GtkEditable *entry, - gpointer user_data) + gpointer user_data) { ClockPlugin *plugin = user_data; @@ -921,22 +929,21 @@ clock_plugin_tz_match_func (GtkEntryCompletion *completion, static void clock_plugin_configure_plugin_chooser_fill (ClockPlugin *plugin, GtkComboBox *combo, - GtkEntry *entry, + GtkEntry *entry, const gchar *formats[]) { - guint i; + guint i; GtkListStore *store; - gchar *preview; - GtkTreeIter iter; - const gchar *active_format; - gboolean has_active = FALSE; + gchar *preview; + GtkTreeIter iter; + const gchar *active_format; + gboolean has_active = FALSE; panel_return_if_fail (CLOCK_IS_PLUGIN (plugin)); panel_return_if_fail (GTK_IS_COMBO_BOX (combo)); panel_return_if_fail (GTK_IS_ENTRY (entry)); - gtk_combo_box_set_row_separator_func (combo, - clock_plugin_configure_plugin_chooser_separator, NULL, NULL); + gtk_combo_box_set_row_separator_func (combo, clock_plugin_configure_plugin_chooser_separator, NULL, NULL); store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING); gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store)); @@ -949,24 +956,24 @@ clock_plugin_configure_plugin_chooser_fill (ClockPlugin *plugin, if (preview) { gtk_list_store_insert_with_values (store, &iter, i, - COLUMN_FORMAT, _(formats[i]), - COLUMN_TEXT, preview, -1); + COLUMN_FORMAT, _(formats[i]), + COLUMN_TEXT, preview, -1); g_free (preview); - if (! has_active - && ! xfce_str_is_empty (active_format) + if (!has_active + && !xfce_str_is_empty (active_format) && strcmp (active_format, formats[i]) == 0) { gtk_combo_box_set_active_iter (combo, &iter); gtk_widget_hide (GTK_WIDGET (entry)); has_active = TRUE; - } } else g_warning ("Getting a time preview failed for format specifier %s, so " - "omitting it from the list of default formats.", formats[i]); + "omitting it from the list of default formats.", + formats[i]); } gtk_list_store_insert_with_values (store, NULL, i++, @@ -984,7 +991,7 @@ clock_plugin_configure_plugin_chooser_fill (ClockPlugin *plugin, } g_signal_connect (G_OBJECT (combo), "changed", - G_CALLBACK (clock_plugin_configure_plugin_chooser_changed), entry); + G_CALLBACK (clock_plugin_configure_plugin_chooser_changed), entry); g_object_unref (G_OBJECT (store)); } @@ -1008,7 +1015,7 @@ static void clock_plugin_configure_config_tool_changed (ClockPluginDialog *dialog) { GObject *object; - gchar *path; + gchar *path; panel_return_if_fail (GTK_IS_BUILDER (dialog->builder)); panel_return_if_fail (CLOCK_IS_PLUGIN (dialog->plugin)); @@ -1023,7 +1030,7 @@ clock_plugin_configure_config_tool_changed (ClockPluginDialog *dialog) static void -clock_plugin_configure_run_config_tool (GtkWidget *button, +clock_plugin_configure_run_config_tool (GtkWidget *button, ClockPlugin *plugin) { GError *error = NULL; @@ -1043,13 +1050,13 @@ clock_plugin_configure_run_config_tool (GtkWidget *button, static void clock_plugin_configure_zoneinfo_model_insert (GtkListStore *store, - const gchar *parent) + const gchar *parent) { - gchar *filename; - GtkTreeIter iter; - GDir *dir; + gchar *filename; + GtkTreeIter iter; + GDir *dir; const gchar *name; - gsize dirlen = strlen (ZONEINFO_DIR); + gsize dirlen = strlen (ZONEINFO_DIR); panel_return_if_fail (GTK_IS_LIST_STORE (store)); @@ -1090,10 +1097,10 @@ clock_plugin_configure_zoneinfo_model_insert (GtkListStore *store, static gboolean clock_plugin_configure_zoneinfo_model (gpointer data) { - ClockPluginDialog *dialog = data; + ClockPluginDialog *dialog = data; GtkEntryCompletion *completion; - GtkListStore *store; - GObject *object; + GtkListStore *store; + GObject *object; dialog->zonecompletion_idle = 0; @@ -1124,12 +1131,12 @@ clock_plugin_configure_zoneinfo_model (gpointer data) static void clock_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) { - ClockPlugin *plugin = CLOCK_PLUGIN (panel_plugin); + ClockPlugin *plugin = CLOCK_PLUGIN (panel_plugin); ClockPluginDialog *dialog; - GtkBuilder *builder; - GObject *window; - GObject *object; - GObject *combo; + GtkBuilder *builder; + GObject *window; + GObject *object; + GObject *combo; panel_return_if_fail (CLOCK_IS_PLUGIN (plugin)); @@ -1150,7 +1157,7 @@ clock_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) dialog); clock_plugin_configure_config_tool_changed (dialog); g_signal_connect (G_OBJECT (object), "clicked", - G_CALLBACK (clock_plugin_configure_run_config_tool), plugin); + G_CALLBACK (clock_plugin_configure_run_config_tool), plugin); object = gtk_builder_get_object (builder, "timezone-name"); panel_return_if_fail (GTK_IS_ENTRY (object)); @@ -1165,8 +1172,8 @@ clock_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) object = gtk_builder_get_object (builder, "mode"); g_signal_connect_data (G_OBJECT (object), "changed", - G_CALLBACK (clock_plugin_configure_plugin_mode_changed), dialog, - (GClosureNotify) (void (*)(void)) clock_plugin_configure_plugin_free, 0); + G_CALLBACK (clock_plugin_configure_plugin_mode_changed), dialog, + (GClosureNotify) (void (*) (void)) clock_plugin_configure_plugin_free, 0); g_object_bind_property (G_OBJECT (plugin), "mode", G_OBJECT (object), "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); @@ -1193,7 +1200,7 @@ clock_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) object = gtk_builder_get_object (builder, "digital-layout"); g_signal_connect (G_OBJECT (object), "changed", - G_CALLBACK (clock_plugin_digital_layout_changed), dialog); + G_CALLBACK (clock_plugin_digital_layout_changed), dialog); clock_plugin_digital_layout_changed (GTK_COMBO_BOX (object), dialog); object = gtk_builder_get_object (builder, "digital-time-format"); @@ -1222,20 +1229,22 @@ clock_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) static void clock_plugin_set_mode (ClockPlugin *plugin) { - const PanelProperty properties[][6] = - { - { /* analog */ + const PanelProperty properties[][6] = { + { + /* analog */ { "show-seconds", G_TYPE_BOOLEAN }, { NULL }, }, - { /* binary */ + { + /* binary */ { "show-seconds", G_TYPE_BOOLEAN }, { "binary-mode", G_TYPE_UINT }, { "show-inactive", G_TYPE_BOOLEAN }, { "show-grid", G_TYPE_BOOLEAN }, { NULL }, }, - { /* digital */ + { + /* digital */ { "digital-layout", G_TYPE_UINT }, { "digital-time-format", G_TYPE_STRING }, { "digital-date-format", G_TYPE_STRING }, @@ -1243,11 +1252,13 @@ clock_plugin_set_mode (ClockPlugin *plugin) { "digital-date-font", G_TYPE_STRING }, { NULL }, }, - { /* fuzzy */ + { + /* fuzzy */ { "fuzziness", G_TYPE_UINT }, { NULL }, }, - { /* lcd */ + { + /* lcd */ { "show-seconds", G_TYPE_BOOLEAN }, { "show-military", G_TYPE_BOOLEAN }, { "show-meridiem", G_TYPE_BOOLEAN }, @@ -1255,7 +1266,7 @@ clock_plugin_set_mode (ClockPlugin *plugin) { NULL }, } }; - GtkOrientation orientation; + GtkOrientation orientation; panel_return_if_fail (CLOCK_IS_PLUGIN (plugin)); @@ -1277,19 +1288,19 @@ clock_plugin_set_mode (ClockPlugin *plugin) if (plugin->rotate_vertically) { - orientation = - (xfce_panel_plugin_get_mode (XFCE_PANEL_PLUGIN (plugin)) - == XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? - GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL; + orientation = (xfce_panel_plugin_get_mode (XFCE_PANEL_PLUGIN (plugin)) + == XFCE_PANEL_PLUGIN_MODE_VERTICAL) + ? GTK_ORIENTATION_VERTICAL + : GTK_ORIENTATION_HORIZONTAL; g_object_set (G_OBJECT (plugin->clock), "orientation", orientation, NULL); } /* watch width/height changes */ g_signal_connect_swapped (G_OBJECT (plugin->clock), "notify::size-ratio", - G_CALLBACK (clock_plugin_size_ratio_changed), plugin); + G_CALLBACK (clock_plugin_size_ratio_changed), plugin); clock_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin), - xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); + xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); panel_properties_bind (NULL, G_OBJECT (plugin->clock), xfce_panel_plugin_get_property_base (XFCE_PANEL_PLUGIN (plugin)), @@ -1358,7 +1369,7 @@ static gboolean clock_plugin_tooltip (gpointer user_data) { ClockPlugin *plugin = CLOCK_PLUGIN (user_data); - gchar *string; + gchar *string; /* set the tooltip */ string = clock_time_strdup_strftime (plugin->time, plugin->tooltip_format); @@ -1380,6 +1391,6 @@ clock_plugin_set_calendar_options (ClockPlugin *plugin) GtkCalendarDisplayOptions options = GTK_CALENDAR_SHOW_HEADING | GTK_CALENDAR_SHOW_DAY_NAMES; if (plugin->show_week_numbers) options |= GTK_CALENDAR_SHOW_WEEK_NUMBERS; - + gtk_calendar_set_display_options (GTK_CALENDAR (plugin->calendar), options); } diff --git a/plugins/clock/clock.h b/plugins/clock/clock.h index e7e8d9ad5..bd42f10a0 100644 --- a/plugins/clock/clock.h +++ b/plugins/clock/clock.h @@ -26,7 +26,8 @@ G_BEGIN_DECLS #define CLOCK_TYPE_PLUGIN (clock_plugin_get_type ()) G_DECLARE_FINAL_TYPE (ClockPlugin, clock_plugin, CLOCK, PLUGIN, XfcePanelPlugin) -void clock_plugin_register_type (XfcePanelTypeModule *type_module); +void +clock_plugin_register_type (XfcePanelTypeModule *type_module); G_END_DECLS diff --git a/plugins/directorymenu/directorymenu.c b/plugins/directorymenu/directorymenu.c index b4bea1e33..82e986f07 100644 --- a/plugins/directorymenu/directorymenu.c +++ b/plugins/directorymenu/directorymenu.c @@ -42,19 +42,19 @@ struct _DirectoryMenuPlugin { XfcePanelPlugin __parent__; - GtkWidget *button; - GtkWidget *icon; - - GFile *base_directory; - gchar *icon_name; - guint open_folder; - guint open_in_terminal; - guint new_folder; - guint new_document; - gchar *file_pattern; - guint hidden_files : 1; - - GSList *patterns; + GtkWidget *button; + GtkWidget *icon; + + GFile *base_directory; + gchar *icon_name; + guint open_folder; + guint open_in_terminal; + guint new_folder; + guint new_document; + gchar *file_pattern; + guint hidden_files : 1; + + GSList *patterns; }; enum @@ -72,25 +72,34 @@ enum -static void directory_menu_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void directory_menu_plugin_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void directory_menu_plugin_construct (XfcePanelPlugin *panel_plugin); -static void directory_menu_plugin_free_file_patterns (DirectoryMenuPlugin *plugin); -static void directory_menu_plugin_free_data (XfcePanelPlugin *panel_plugin); -static gboolean directory_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); -static void directory_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); -static gboolean directory_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, - const gchar *name, - const GValue *value); -static void directory_menu_plugin_menu (GtkWidget *button, - DirectoryMenuPlugin *plugin); +static void +directory_menu_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +directory_menu_plugin_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +directory_menu_plugin_construct (XfcePanelPlugin *panel_plugin); +static void +directory_menu_plugin_free_file_patterns (DirectoryMenuPlugin *plugin); +static void +directory_menu_plugin_free_data (XfcePanelPlugin *panel_plugin); +static gboolean +directory_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); +static void +directory_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); +static gboolean +directory_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, + const gchar *name, + const GValue *value); +static void +directory_menu_plugin_menu (GtkWidget *button, + DirectoryMenuPlugin *plugin); @@ -106,7 +115,7 @@ static void directory_menu_plugin_class_init (DirectoryMenuPluginClass *klass) { XfcePanelPluginClass *plugin_class; - GObjectClass *gobject_class; + GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->get_property = directory_menu_plugin_get_property; @@ -189,7 +198,7 @@ directory_menu_plugin_init (DirectoryMenuPlugin *plugin) gtk_widget_set_name (plugin->button, "directorymenu-button"); gtk_button_set_relief (GTK_BUTTON (plugin->button), GTK_RELIEF_NONE); g_signal_connect (G_OBJECT (plugin->button), "toggled", - G_CALLBACK (directory_menu_plugin_menu), plugin); + G_CALLBACK (directory_menu_plugin_menu), plugin); plugin->icon_name = g_strdup (DEFAULT_ICON_NAME); plugin->icon = gtk_image_new_from_icon_name (plugin->icon_name, GTK_ICON_SIZE_BUTTON); @@ -205,13 +214,13 @@ directory_menu_plugin_init (DirectoryMenuPlugin *plugin) static void -directory_menu_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, +directory_menu_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { DirectoryMenuPlugin *plugin = DIRECTORY_MENU_PLUGIN (object); - gchar *str; + gchar *str; switch (prop_id) { @@ -244,8 +253,7 @@ directory_menu_plugin_get_property (GObject *object, break; case PROP_FILE_PATTERN: - g_value_set_string (value, xfce_str_is_empty (plugin->file_pattern) ? - "" : plugin->file_pattern); + g_value_set_string (value, xfce_str_is_empty (plugin->file_pattern) ? "" : plugin->file_pattern); break; case PROP_HIDDEN_FILES: @@ -261,17 +269,17 @@ directory_menu_plugin_get_property (GObject *object, static void -directory_menu_plugin_set_property (GObject *object, - guint prop_id, +directory_menu_plugin_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { - DirectoryMenuPlugin *plugin = DIRECTORY_MENU_PLUGIN (object); - gchar *display_name; - gchar **array; - guint i; - gint size; - const gchar *path; + DirectoryMenuPlugin *plugin = DIRECTORY_MENU_PLUGIN (object); + gchar *display_name; + gchar **array; + guint i; + gint size; + const gchar *path; switch (prop_id) { @@ -294,9 +302,8 @@ directory_menu_plugin_set_property (GObject *object, case PROP_ICON_NAME: g_free (plugin->icon_name); - plugin->icon_name = - xfce_str_is_empty (g_value_get_string (value)) ? g_strdup (DEFAULT_ICON_NAME) - : g_value_dup_string (value); + plugin->icon_name = xfce_str_is_empty (g_value_get_string (value)) ? g_strdup (DEFAULT_ICON_NAME) + : g_value_dup_string (value); size = xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin)); directory_menu_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin), size); break; @@ -328,8 +335,7 @@ directory_menu_plugin_set_property (GObject *object, { for (i = 0; array[i] != NULL; i++) if (!xfce_str_is_empty (array[i])) - plugin->patterns = g_slist_prepend (plugin->patterns, - g_pattern_spec_new (array[i])); + plugin->patterns = g_slist_prepend (plugin->patterns, g_pattern_spec_new (array[i])); g_strfreev (array); } @@ -351,8 +357,7 @@ static void directory_menu_plugin_construct (XfcePanelPlugin *panel_plugin) { DirectoryMenuPlugin *plugin = DIRECTORY_MENU_PLUGIN (panel_plugin); - const PanelProperty properties[] = - { + const PanelProperty properties[] = { { "base-directory", G_TYPE_STRING }, { "icon-name", G_TYPE_STRING }, { "open-folder", G_TYPE_BOOLEAN }, @@ -414,7 +419,7 @@ directory_menu_plugin_free_data (XfcePanelPlugin *panel_plugin) static gboolean directory_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { DirectoryMenuPlugin *plugin = DIRECTORY_MENU_PLUGIN (panel_plugin); gint icon_size; @@ -431,10 +436,9 @@ directory_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, - static void directory_menu_plugin_configure_plugin_file_set (GtkFileChooserButton *button, - DirectoryMenuPlugin *plugin) + DirectoryMenuPlugin *plugin) { gchar *uri; @@ -449,19 +453,17 @@ directory_menu_plugin_configure_plugin_file_set (GtkFileChooserButton *button, static void -directory_menu_plugin_configure_plugin_icon_chooser (GtkWidget *button, +directory_menu_plugin_configure_plugin_icon_chooser (GtkWidget *button, DirectoryMenuPlugin *plugin) { + GtkWindow *parent = GTK_WINDOW (gtk_widget_get_toplevel (button)); GtkWidget *chooser, *image; - gchar *icon; + gchar *icon; panel_return_if_fail (DIRECTORY_MENU_IS_PLUGIN (plugin)); - chooser = exo_icon_chooser_dialog_new (_("Select An Icon"), - GTK_WINDOW (gtk_widget_get_toplevel (button)), - _("_Cancel"), GTK_RESPONSE_CANCEL, - _("_OK"), GTK_RESPONSE_ACCEPT, - NULL); + chooser = exo_icon_chooser_dialog_new ( + _("Select An Icon"), parent, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_OK"), GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_ACCEPT); exo_icon_chooser_dialog_set_icon (EXO_ICON_CHOOSER_DIALOG (chooser), plugin->icon_name); @@ -490,9 +492,9 @@ static void directory_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) { DirectoryMenuPlugin *plugin = DIRECTORY_MENU_PLUGIN (panel_plugin); - GtkBuilder *builder; - GtkWidget *image; - GObject *dialog, *object; + GtkBuilder *builder; + GtkWidget *image; + GObject *dialog, *object; /* setup the dialog */ builder = panel_utils_builder_new (panel_plugin, directorymenu_dialog_ui, @@ -506,12 +508,12 @@ directory_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) plugin->base_directory, NULL)) gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (object), g_get_home_dir ()); g_signal_connect (G_OBJECT (object), "selection-changed", - G_CALLBACK (directory_menu_plugin_configure_plugin_file_set), plugin); + G_CALLBACK (directory_menu_plugin_configure_plugin_file_set), plugin); object = gtk_builder_get_object (builder, "icon-button"); panel_return_if_fail (GTK_IS_BUTTON (object)); g_signal_connect (G_OBJECT (object), "clicked", - G_CALLBACK (directory_menu_plugin_configure_plugin_icon_chooser), plugin); + G_CALLBACK (directory_menu_plugin_configure_plugin_icon_chooser), plugin); image = gtk_image_new (); xfce_panel_set_image_from_source (GTK_IMAGE (image), plugin->icon_name, @@ -563,8 +565,8 @@ directory_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) static gboolean directory_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, - const gchar *name, - const GValue *value) + const gchar *name, + const GValue *value) { DirectoryMenuPlugin *plugin = DIRECTORY_MENU_PLUGIN (panel_plugin); GtkWidget *invisible; @@ -573,7 +575,7 @@ directory_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, /* try next plugin or indicate that it failed */ if (strcmp (name, "popup") != 0 - || ! gtk_widget_get_visible (GTK_WIDGET (panel_plugin))) + || !gtk_widget_get_visible (GTK_WIDGET (panel_plugin))) return FALSE; invisible = gtk_invisible_new (); @@ -581,7 +583,7 @@ directory_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, /* a menu is already shown, don't popup another one */ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button)) - || ! panel_utils_device_grab (invisible)) + || !panel_utils_device_grab (invisible)) { gtk_widget_destroy (invisible); return TRUE; @@ -614,7 +616,7 @@ directory_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, static void -directory_menu_plugin_deactivate (GtkWidget *menu, +directory_menu_plugin_deactivate (GtkWidget *menu, DirectoryMenuPlugin *plugin) { panel_return_if_fail (plugin->button == NULL || GTK_IS_TOGGLE_BUTTON (plugin->button)); @@ -635,7 +637,7 @@ directory_menu_plugin_menu_sort (gconstpointer a, { GFileType type_a = g_file_info_get_file_type (G_FILE_INFO (a)); GFileType type_b = g_file_info_get_file_type (G_FILE_INFO (b)); - gboolean hidden_a, hidden_b; + gboolean hidden_a, hidden_b; const gchar *display_name_a, *display_name_b; gchar *sort_display_name_a, *sort_display_name_b; gint sort_value; @@ -671,12 +673,12 @@ directory_menu_plugin_menu_sort (gconstpointer a, static void directory_menu_plugin_menu_launch_desktop_file (GtkWidget *mi, - GAppInfo *info) + GAppInfo *info) { GdkAppLaunchContext *context; - GIcon *icon; - GError *error = NULL; - GdkDisplay *display; + GIcon *icon; + GError *error = NULL; + GdkDisplay *display; panel_return_if_fail (G_IS_APP_INFO (info)); panel_return_if_fail (GTK_IS_WIDGET (mi)); @@ -703,17 +705,17 @@ directory_menu_plugin_menu_launch_desktop_file (GtkWidget *mi, static void directory_menu_plugin_menu_launch (GtkWidget *mi, - GFile *file) + GFile *file) { - GAppInfo *appinfo; - GError *error = NULL; - gchar *display_name; - GList fake_list = { NULL, }; + GAppInfo *appinfo; + GError *error = NULL; + gchar *display_name; + GList fake_list = { NULL, /**/ }; GdkAppLaunchContext *context; - GFileInfo *info; - const gchar *message; - gboolean result; - GdkDisplay *display; + GFileInfo *info; + const gchar *message; + gboolean result; + GdkDisplay *display; panel_return_if_fail (G_IS_FILE (file)); panel_return_if_fail (GTK_IS_WIDGET (mi)); @@ -763,20 +765,20 @@ err: static void -directory_menu_plugin_menu_open (GtkWidget *mi, - GFile *dir, +directory_menu_plugin_menu_open (GtkWidget *mi, + GFile *dir, const gchar *category, - gboolean path_as_arg) + gboolean path_as_arg) { - GError *error = NULL; - XfceRc *rc, *helperrc; - const gchar *value, *working_dir; - gchar *filename; - gchar **binaries = NULL; - guint i; - gboolean result = FALSE; - gchar *argv[3]; - gboolean startup_notify = FALSE; + GError *error = NULL; + XfceRc *rc, *helperrc; + const gchar *value, *working_dir; + gchar *filename; + gchar **binaries = NULL; + guint i; + gboolean result = FALSE; + gchar *argv[3]; + gboolean startup_notify = FALSE; /* try to work around the exo code and get the direct command */ rc = xfce_rc_config_open (XFCE_RESOURCE_CONFIG, "xfce4/helpers.rc", TRUE); @@ -838,11 +840,10 @@ directory_menu_plugin_menu_open (GtkWidget *mi, path_as_arg ? working_dir : NULL, working_dir, NULL, - gtk_widget_get_screen (mi), &error) - ) + gtk_widget_get_screen (mi), &error)) { - xfce_dialog_show_error (NULL, error, - _("Failed to execute the preferred application for category \"%s\""), category); + xfce_dialog_show_error ( + NULL, error, _("Failed to execute the preferred application for category \"%s\""), category); g_error_free (error); } } @@ -851,7 +852,7 @@ directory_menu_plugin_menu_open (GtkWidget *mi, static void directory_menu_plugin_menu_open_terminal (GtkWidget *mi, - GFile *dir) + GFile *dir) { panel_return_if_fail (GTK_IS_WIDGET (mi)); panel_return_if_fail (G_IS_FILE (dir)); @@ -863,7 +864,7 @@ directory_menu_plugin_menu_open_terminal (GtkWidget *mi, static void directory_menu_plugin_menu_open_folder (GtkWidget *mi, - GFile *dir) + GFile *dir) { panel_return_if_fail (GTK_IS_WIDGET (mi)); panel_return_if_fail (G_IS_FILE (dir)); @@ -878,16 +879,16 @@ directory_menu_plugin_menu_name_entry_changed (GtkEditable *editable, gpointer dialog) { const gchar *text; - GtkWidget *create_button; - GtkWidget *open_button; + GtkWidget *create_button; + GtkWidget *open_button; - create_button = gtk_dialog_get_widget_for_response (GTK_DIALOG(dialog), + create_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), DIALOG_RESPONSE_CREATE); - open_button = gtk_dialog_get_widget_for_response (GTK_DIALOG(dialog), + open_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), DIALOG_RESPONSE_OPEN); - text = gtk_entry_get_text (GTK_ENTRY(editable)); - if (strlen(text) > 0) + text = gtk_entry_get_text (GTK_ENTRY (editable)); + if (strlen (text) > 0) { gtk_widget_set_sensitive (create_button, TRUE); gtk_widget_set_sensitive (open_button, TRUE); @@ -903,23 +904,23 @@ directory_menu_plugin_menu_name_entry_changed (GtkEditable *editable, static void directory_menu_plugin_create_new (GtkWidget *mi, - GFile *parent_dir, - gboolean is_folder) + GFile *parent_dir, + gboolean is_folder) { - GtkWidget *dialog; + GtkWidget *dialog; const gchar *dialog_title; - gint dialog_retval; - GtkWidget *content; - GtkWidget *grid; - GtkWidget *icon; - GtkWidget *label; - GtkWidget *entry; - GDateTime *date; - gchar *formatted_date; + gint dialog_retval; + GtkWidget *content; + GtkWidget *grid; + GtkWidget *icon; + GtkWidget *label; + GtkWidget *entry; + GDateTime *date; + gchar *formatted_date; const gchar *filename; - gchar *filepath; - GFile *new_file = NULL; - GError *error = NULL; + gchar *filepath; + GFile *new_file = NULL; + GError *error = NULL; if (is_folder) { @@ -932,12 +933,9 @@ directory_menu_plugin_create_new (GtkWidget *mi, icon = gtk_image_new_from_icon_name ("text-x-generic", GTK_ICON_SIZE_DIALOG); } - dialog = gtk_dialog_new_with_buttons (dialog_title, NULL, - GTK_DIALOG_MODAL, - _("_Cancel"), GTK_RESPONSE_CANCEL, - _("C_reate"), DIALOG_RESPONSE_CREATE, - _("Create & _Open"), DIALOG_RESPONSE_OPEN, - NULL); + dialog = gtk_dialog_new_with_buttons ( + dialog_title, NULL, GTK_DIALOG_MODAL, + _("_Cancel"), GTK_RESPONSE_CANCEL, _("C_reate"), DIALOG_RESPONSE_CREATE, _("Create & _Open"), DIALOG_RESPONSE_OPEN, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), 1); grid = gtk_grid_new (); @@ -958,7 +956,7 @@ directory_menu_plugin_create_new (GtkWidget *mi, formatted_date = g_date_time_format (date, "%F %T"); entry = gtk_entry_new (); gtk_widget_set_hexpand (entry, TRUE); - gtk_entry_set_text (GTK_ENTRY(entry), formatted_date); + gtk_entry_set_text (GTK_ENTRY (entry), formatted_date); g_free (formatted_date); g_date_time_unref (date); gtk_grid_attach (GTK_GRID (grid), entry, 1, 1, 1, 1); @@ -974,8 +972,8 @@ directory_menu_plugin_create_new (GtkWidget *mi, dialog_retval = gtk_dialog_run (GTK_DIALOG (dialog)); if (dialog_retval >= 0) { - filename = gtk_entry_get_text (GTK_ENTRY(entry)); - if (strlen(filename) > 0) + filename = gtk_entry_get_text (GTK_ENTRY (entry)); + if (strlen (filename) > 0) { new_file = g_file_get_child (parent_dir, filename); if (is_folder) @@ -1007,7 +1005,7 @@ directory_menu_plugin_create_new (GtkWidget *mi, static void directory_menu_plugin_menu_new_folder (GtkWidget *mi, - GFile *dir) + GFile *dir) { panel_return_if_fail (GTK_IS_WIDGET (mi)); panel_return_if_fail (G_IS_FILE (dir)); @@ -1019,7 +1017,7 @@ directory_menu_plugin_menu_new_folder (GtkWidget *mi, static void directory_menu_plugin_menu_new_document (GtkWidget *mi, - GFile *dir) + GFile *dir) { panel_return_if_fail (GTK_IS_WIDGET (mi)); panel_return_if_fail (G_IS_FILE (dir)); @@ -1034,29 +1032,29 @@ directory_menu_plugin_menu_unload (GtkWidget *menu) { /* delay destruction so we can handle the activate event first */ gtk_container_foreach (GTK_CONTAINER (menu), - (GtkCallback) (void (*)(void)) panel_utils_destroy_later, NULL); + (GtkCallback) (void (*) (void)) panel_utils_destroy_later, NULL); } static void -directory_menu_plugin_menu_load (GtkWidget *menu, +directory_menu_plugin_menu_load (GtkWidget *menu, DirectoryMenuPlugin *plugin) { GFileEnumerator *iter; - GFileInfo *info; - GtkWidget *mi; - const gchar *display_name; - GSList *li, *infos = NULL; - GIcon *icon; - GtkWidget *image; - GtkWidget *submenu; - GFile *file; - GFile *dir; - gboolean visible; - GFileType file_type; + GFileInfo *info; + GtkWidget *mi; + const gchar *display_name; + GSList *li, *infos = NULL; + GIcon *icon; + GtkWidget *image; + GtkWidget *submenu; + GFile *file; + GFile *dir; + gboolean visible; + GFileType file_type; GDesktopAppInfo *desktopinfo; - const gchar *description; + const gchar *description; panel_return_if_fail (DIRECTORY_MENU_IS_PLUGIN (plugin)); panel_return_if_fail (GTK_IS_MENU (menu)); @@ -1066,59 +1064,64 @@ directory_menu_plugin_menu_load (GtkWidget *menu, if (G_UNLIKELY (dir == NULL)) return; - if (plugin->open_folder) { - mi = panel_image_menu_item_new_with_label (_("Open Folder")); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); - g_signal_connect_data (G_OBJECT (mi), "activate", - G_CALLBACK (directory_menu_plugin_menu_open_folder), - g_object_ref (dir), (GClosureNotify) (void (*)(void)) g_object_unref, 0); - gtk_widget_show (mi); - - image = gtk_image_new_from_icon_name ("folder-open", GTK_ICON_SIZE_MENU); - panel_image_menu_item_set_image (mi, image); - gtk_widget_show (image); - } - - if (plugin->open_in_terminal) { - mi = panel_image_menu_item_new_with_label (_("Open in Terminal")); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); - g_signal_connect_data (G_OBJECT (mi), "activate", - G_CALLBACK (directory_menu_plugin_menu_open_terminal), - g_object_ref (dir), (GClosureNotify) (void (*)(void)) g_object_unref, 0); - gtk_widget_show (mi); - - image = gtk_image_new_from_icon_name ("utilities-terminal", GTK_ICON_SIZE_MENU); - panel_image_menu_item_set_image (mi, image); - gtk_widget_show (image); - } - - if (plugin->new_folder) { - mi = panel_image_menu_item_new_with_label (_("Create Folder...")); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); - g_signal_connect_data (G_OBJECT (mi), "activate", - G_CALLBACK (directory_menu_plugin_menu_new_folder), - g_object_ref (dir), (GClosureNotify) (void (*)(void)) g_object_unref, 0); - gtk_widget_show (mi); - - image = gtk_image_new_from_icon_name ("folder-new", GTK_ICON_SIZE_MENU); - panel_image_menu_item_set_image (mi, image); - gtk_widget_show (image); - } - - if (plugin->new_document) { - mi = panel_image_menu_item_new_with_label (_("Create Text Document...")); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); - g_signal_connect_data (G_OBJECT (mi), "activate", - G_CALLBACK (directory_menu_plugin_menu_new_document), - g_object_ref (dir), (GClosureNotify) (void (*)(void)) g_object_unref, 0); - gtk_widget_show (mi); - - image = gtk_image_new_from_icon_name ("document-new", GTK_ICON_SIZE_MENU); - panel_image_menu_item_set_image (mi, image); - gtk_widget_show (image); - } - - iter = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME + if (plugin->open_folder) + { + mi = panel_image_menu_item_new_with_label (_("Open Folder")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); + g_signal_connect_data (G_OBJECT (mi), "activate", + G_CALLBACK (directory_menu_plugin_menu_open_folder), + g_object_ref (dir), (GClosureNotify) (void (*) (void)) g_object_unref, 0); + gtk_widget_show (mi); + + image = gtk_image_new_from_icon_name ("folder-open", GTK_ICON_SIZE_MENU); + panel_image_menu_item_set_image (mi, image); + gtk_widget_show (image); + } + + if (plugin->open_in_terminal) + { + mi = panel_image_menu_item_new_with_label (_("Open in Terminal")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); + g_signal_connect_data (G_OBJECT (mi), "activate", + G_CALLBACK (directory_menu_plugin_menu_open_terminal), + g_object_ref (dir), (GClosureNotify) (void (*) (void)) g_object_unref, 0); + gtk_widget_show (mi); + + image = gtk_image_new_from_icon_name ("utilities-terminal", GTK_ICON_SIZE_MENU); + panel_image_menu_item_set_image (mi, image); + gtk_widget_show (image); + } + + if (plugin->new_folder) + { + mi = panel_image_menu_item_new_with_label (_("Create Folder...")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); + g_signal_connect_data (G_OBJECT (mi), "activate", + G_CALLBACK (directory_menu_plugin_menu_new_folder), + g_object_ref (dir), (GClosureNotify) (void (*) (void)) g_object_unref, 0); + gtk_widget_show (mi); + + image = gtk_image_new_from_icon_name ("folder-new", GTK_ICON_SIZE_MENU); + panel_image_menu_item_set_image (mi, image); + gtk_widget_show (image); + } + + if (plugin->new_document) + { + mi = panel_image_menu_item_new_with_label (_("Create Text Document...")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); + g_signal_connect_data (G_OBJECT (mi), "activate", + G_CALLBACK (directory_menu_plugin_menu_new_document), + g_object_ref (dir), (GClosureNotify) (void (*) (void)) g_object_unref, 0); + gtk_widget_show (mi); + + image = gtk_image_new_from_icon_name ("document-new", GTK_ICON_SIZE_MENU); + panel_image_menu_item_set_image (mi, image); + gtk_widget_show (image); + } + + iter = g_file_enumerate_children (dir, + G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN @@ -1153,8 +1156,8 @@ directory_menu_plugin_menu_load (GtkWidget *menu, display_name = g_file_info_get_display_name (info); if (G_LIKELY (display_name != NULL)) for (li = plugin->patterns; !visible && li != NULL; li = li->next) - if (g_pattern_spec_match_string (li->data, display_name)) - visible = TRUE; + if (g_pattern_spec_match_string (li->data, display_name)) + visible = TRUE; if (!visible) { @@ -1169,7 +1172,7 @@ directory_menu_plugin_menu_load (GtkWidget *menu, g_object_unref (G_OBJECT (iter)); if (G_LIKELY (infos != NULL - && (plugin->open_folder || plugin->open_in_terminal))) + && (plugin->open_folder || plugin->open_in_terminal))) { mi = gtk_separator_menu_item_new (); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); @@ -1195,8 +1198,8 @@ directory_menu_plugin_menu_load (GtkWidget *menu, * to load them like a normal menu */ desktopinfo = NULL; if (G_UNLIKELY (file_type != G_FILE_TYPE_DIRECTORY - && g_file_is_native (file) - && g_str_has_suffix (display_name, ".desktop"))) + && g_file_is_native (file) + && g_str_has_suffix (display_name, ".desktop"))) { desktopinfo = g_desktop_app_info_new_from_filename (g_file_peek_path (file)); if (G_LIKELY (desktopinfo != NULL)) @@ -1237,9 +1240,9 @@ directory_menu_plugin_menu_load (GtkWidget *menu, g_object_set_qdata_full (G_OBJECT (submenu), menu_file, file, g_object_unref); g_signal_connect (G_OBJECT (submenu), "show", - G_CALLBACK (directory_menu_plugin_menu_load), plugin); + G_CALLBACK (directory_menu_plugin_menu_load), plugin); g_signal_connect_after (G_OBJECT (submenu), "hide", - G_CALLBACK (directory_menu_plugin_menu_unload), NULL); + G_CALLBACK (directory_menu_plugin_menu_unload), NULL); } else if (G_UNLIKELY (desktopinfo != NULL)) { @@ -1248,16 +1251,16 @@ directory_menu_plugin_menu_load (GtkWidget *menu, gtk_widget_set_tooltip_text (mi, description); g_signal_connect_data (G_OBJECT (mi), "activate", - G_CALLBACK (directory_menu_plugin_menu_launch_desktop_file), - desktopinfo, (GClosureNotify) (void (*)(void)) g_object_unref, 0); + G_CALLBACK (directory_menu_plugin_menu_launch_desktop_file), + desktopinfo, (GClosureNotify) (void (*) (void)) g_object_unref, 0); g_object_unref (G_OBJECT (file)); } else { g_signal_connect_data (G_OBJECT (mi), "activate", - G_CALLBACK (directory_menu_plugin_menu_launch), file, - (GClosureNotify) (void (*)(void)) g_object_unref, 0); + G_CALLBACK (directory_menu_plugin_menu_launch), file, + (GClosureNotify) (void (*) (void)) g_object_unref, 0); } g_object_unref (G_OBJECT (info)); @@ -1270,11 +1273,11 @@ directory_menu_plugin_menu_load (GtkWidget *menu, static void -directory_menu_plugin_menu (GtkWidget *button, +directory_menu_plugin_menu (GtkWidget *button, DirectoryMenuPlugin *plugin) { GtkWidget *menu; - GdkEvent *event = NULL; + GdkEvent *event = NULL; panel_return_if_fail (DIRECTORY_MENU_IS_PLUGIN (plugin)); panel_return_if_fail (button == NULL || plugin->button == button); @@ -1296,7 +1299,7 @@ directory_menu_plugin_menu (GtkWidget *button, menu = gtk_menu_new (); g_signal_connect (G_OBJECT (menu), "deactivate", - G_CALLBACK (directory_menu_plugin_deactivate), plugin); + G_CALLBACK (directory_menu_plugin_deactivate), plugin); g_object_set_qdata_full (G_OBJECT (menu), menu_file, g_object_ref (plugin->base_directory), diff --git a/plugins/directorymenu/directorymenu.h b/plugins/directorymenu/directorymenu.h index de7482bce..3e3798b9d 100644 --- a/plugins/directorymenu/directorymenu.h +++ b/plugins/directorymenu/directorymenu.h @@ -26,7 +26,8 @@ G_BEGIN_DECLS #define DIRECTORY_MENU_TYPE_PLUGIN (directory_menu_plugin_get_type ()) G_DECLARE_FINAL_TYPE (DirectoryMenuPlugin, directory_menu_plugin, DIRECTORY_MENU, PLUGIN, XfcePanelPlugin) -void directory_menu_plugin_register_type (XfcePanelTypeModule *type_module); +void +directory_menu_plugin_register_type (XfcePanelTypeModule *type_module); G_END_DECLS diff --git a/plugins/launcher/launcher-dialog.c b/plugins/launcher/launcher-dialog.c index ae51091e1..2f6739183 100644 --- a/plugins/launcher/launcher-dialog.c +++ b/plugins/launcher/launcher-dialog.c @@ -38,18 +38,16 @@ typedef struct { LauncherPlugin *plugin; - GtkBuilder *builder; - guint idle_populate_id; - GSList *items; -} -LauncherPluginDialog; + GtkBuilder *builder; + guint idle_populate_id; + GSList *items; +} LauncherPluginDialog; typedef struct { LauncherPluginDialog *dialog; - GarconMenuItem *item; -} -LauncherChangedHandler; + GarconMenuItem *item; +} LauncherChangedHandler; enum { @@ -62,21 +60,28 @@ enum -static void launcher_dialog_items_set_item (GtkTreeModel *model, - GtkTreeIter *iter, - GarconMenuItem *item, - LauncherPluginDialog *dialog); -static void launcher_dialog_tree_save (LauncherPluginDialog *dialog); -static void launcher_dialog_tree_selection_changed (GtkTreeSelection *selection, - LauncherPluginDialog *dialog); -static gboolean launcher_dialog_press_event (LauncherPluginDialog *dialog, - const gchar *object_name); -static void launcher_dialog_items_unload (LauncherPluginDialog *dialog); -static void launcher_dialog_items_load (LauncherPluginDialog *dialog); -static void launcher_dialog_item_desktop_item_edit (GtkWidget *widget, - const gchar *type, - const gchar *uri, - LauncherPluginDialog *dialog); +static void +launcher_dialog_items_set_item (GtkTreeModel *model, + GtkTreeIter *iter, + GarconMenuItem *item, + LauncherPluginDialog *dialog); +static void +launcher_dialog_tree_save (LauncherPluginDialog *dialog); +static void +launcher_dialog_tree_selection_changed (GtkTreeSelection *selection, + LauncherPluginDialog *dialog); +static gboolean +launcher_dialog_press_event (LauncherPluginDialog *dialog, + const gchar *object_name); +static void +launcher_dialog_items_unload (LauncherPluginDialog *dialog); +static void +launcher_dialog_items_load (LauncherPluginDialog *dialog); +static void +launcher_dialog_item_desktop_item_edit (GtkWidget *widget, + const gchar *type, + const gchar *uri, + LauncherPluginDialog *dialog); @@ -87,19 +92,16 @@ enum DROP_TARGET_ROW }; -static const GtkTargetEntry add_drag_targets[] = -{ +static const GtkTargetEntry add_drag_targets[] = { { "text/uri-list", 0, 0 } }; -static const GtkTargetEntry list_drop_targets[] = -{ +static const GtkTargetEntry list_drop_targets[] = { { "text/uri-list", 0, DROP_TARGET_URI }, { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, DROP_TARGET_ROW } }; -static const GtkTargetEntry list_drag_targets[] = -{ +static const GtkTargetEntry list_drag_targets[] = { { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 } }; @@ -107,15 +109,15 @@ static const GtkTargetEntry list_drag_targets[] = static gboolean launcher_dialog_add_visible_function (GtkTreeModel *model, - GtkTreeIter *iter, - gpointer user_data) + GtkTreeIter *iter, + gpointer user_data) { - gchar *string, *escaped; - gboolean visible = FALSE; + gchar *string, *escaped; + gboolean visible = FALSE; const gchar *text; - gchar *normalized; - gchar *text_casefolded; - gchar *name_casefolded; + gchar *normalized; + gchar *text_casefolded; + gchar *name_casefolded; /* get the search string from the item */ text = gtk_entry_get_text (GTK_ENTRY (user_data)); @@ -171,9 +173,9 @@ launcher_dialog_add_store_insert (gpointer key, gpointer value, gpointer user_data) { - GtkTreeIter iter; + GtkTreeIter iter; GarconMenuItem *item = GARCON_MENU_ITEM (value); - GtkTreeModel *model = GTK_TREE_MODEL (user_data); + GtkTreeModel *model = GTK_TREE_MODEL (user_data); panel_return_if_fail (GARCON_IS_MENU_ITEM (item)); panel_return_if_fail (GTK_IS_LIST_STORE (model)); @@ -188,8 +190,8 @@ static gboolean launcher_dialog_add_populate_model_idle (gpointer user_data) { LauncherPluginDialog *dialog = user_data; - GObject *store; - GHashTable *pool; + GObject *store; + GHashTable *pool; panel_return_val_if_fail (GTK_IS_BUILDER (dialog->builder), FALSE); @@ -229,28 +231,28 @@ launcher_dialog_add_populate_model (LauncherPluginDialog *dialog) /* fire an idle menu system load */ if (G_LIKELY (dialog->idle_populate_id == 0)) dialog->idle_populate_id = gdk_threads_add_idle_full ( - G_PRIORITY_DEFAULT_IDLE, - launcher_dialog_add_populate_model_idle, - dialog, launcher_dialog_add_populate_model_idle_destroyed); + G_PRIORITY_DEFAULT_IDLE, + launcher_dialog_add_populate_model_idle, + dialog, launcher_dialog_add_populate_model_idle_destroyed); } static void -launcher_dialog_add_drag_data_get (GtkWidget *treeview, - GdkDragContext *drag_context, - GtkSelectionData *data, - guint info, - guint timestamp, +launcher_dialog_add_drag_data_get (GtkWidget *treeview, + GdkDragContext *drag_context, + GtkSelectionData *data, + guint info, + guint timestamp, LauncherPluginDialog *dialog) { - GtkTreeSelection *selection; - GList *rows, *li; - GtkTreeModel *model; - gchar **uris; - GarconMenuItem *item; - guint i; - GtkTreeIter iter; + GtkTreeSelection *selection; + GList *rows, *li; + GtkTreeModel *model; + gchar **uris; + GarconMenuItem *item; + guint i; + GtkTreeIter iter; panel_return_if_fail (GTK_IS_BUILDER (dialog->builder)); panel_return_if_fail (GTK_IS_TREE_VIEW (treeview)); @@ -282,11 +284,11 @@ launcher_dialog_add_drag_data_get (GtkWidget *treeview, static void -launcher_dialog_add_selection_changed (GtkTreeSelection *selection, +launcher_dialog_add_selection_changed (GtkTreeSelection *selection, LauncherPluginDialog *dialog) { - GObject *object; - gboolean sensitive; + GObject *object; + gboolean sensitive; panel_return_if_fail (GTK_IS_BUILDER (dialog->builder)); panel_return_if_fail (GTK_IS_TREE_SELECTION (selection)); @@ -299,8 +301,8 @@ launcher_dialog_add_selection_changed (GtkTreeSelection *selection, static gboolean -launcher_dialog_add_button_press_event (GtkTreeView *treeview, - GdkEventButton *event, +launcher_dialog_add_button_press_event (GtkTreeView *treeview, + GdkEventButton *event, LauncherPluginDialog *dialog) { panel_return_val_if_fail (GTK_IS_BUILDER (dialog->builder), FALSE); @@ -319,8 +321,8 @@ launcher_dialog_add_button_press_event (GtkTreeView *treeview, static gboolean -launcher_dialog_add_key_press_event (GtkTreeView *treeview, - GdkEventKey *event, +launcher_dialog_add_key_press_event (GtkTreeView *treeview, + GdkEventKey *event, LauncherPluginDialog *dialog) { panel_return_val_if_fail (GTK_IS_BUILDER (dialog->builder), FALSE); @@ -336,16 +338,16 @@ launcher_dialog_add_key_press_event (GtkTreeView *treeview, static void -launcher_dialog_add_response (GtkWidget *widget, - gint response_id, +launcher_dialog_add_response (GtkWidget *widget, + gint response_id, LauncherPluginDialog *dialog) { - GObject *treeview, *store; + GObject *treeview, *store; GtkTreeSelection *selection; - GtkTreeModel *item_model, *add_model; - GtkTreeIter iter, sibling, tmp; - GarconMenuItem *item; - GList *list, *li; + GtkTreeModel *item_model, *add_model; + GtkTreeIter iter, sibling, tmp; + GarconMenuItem *item; + GList *list, *li; panel_return_if_fail (GTK_IS_DIALOG (widget)); panel_return_if_fail (LAUNCHER_IS_PLUGIN (dialog->plugin)); @@ -418,12 +420,12 @@ launcher_dialog_add_response (GtkWidget *widget, static gboolean launcher_dialog_tree_save_foreach (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data) { - GPtrArray *array = user_data; - GValue *value; + GPtrArray *array = user_data; + GValue *value; GarconMenuItem *item; /* get the desktop id of the item from the store */ @@ -448,7 +450,7 @@ launcher_dialog_tree_save_foreach (GtkTreeModel *model, static void launcher_dialog_tree_save (LauncherPluginDialog *dialog) { - GObject *store; + GObject *store; GPtrArray *array; store = gtk_builder_get_object (dialog->builder, "item-store"); @@ -458,10 +460,10 @@ launcher_dialog_tree_save (LauncherPluginDialog *dialog) launcher_dialog_tree_save_foreach, array); g_signal_handlers_block_by_func (G_OBJECT (dialog->plugin), - G_CALLBACK (launcher_dialog_items_load), dialog); + G_CALLBACK (launcher_dialog_items_load), dialog); g_object_set (dialog->plugin, "items", array, NULL); - g_signal_handlers_unblock_by_func (G_OBJECT (dialog->plugin), - G_CALLBACK (launcher_dialog_items_load), dialog); + g_signal_handlers_unblock_by_func (G_OBJECT (dialog->plugin), + G_CALLBACK (launcher_dialog_items_load), dialog); xfconf_array_free (array); } @@ -476,23 +478,23 @@ launcher_dialog_tree_save_cb (gpointer user_data) } static void -launcher_dialog_tree_drag_data_received (GtkWidget *treeview, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *data, - guint info, - guint timestamp, +launcher_dialog_tree_drag_data_received (GtkWidget *treeview, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *data, + guint info, + guint timestamp, LauncherPluginDialog *dialog) { - GtkTreePath *path; - GtkTreeViewDropPosition drop_pos; - gchar **uris; - GtkTreeIter iter; - GtkTreeModel *model; - gint position; - GarconMenuItem *item; - guint i; + GtkTreePath *path; + GtkTreeViewDropPosition drop_pos; + gchar **uris; + GtkTreeIter iter; + GtkTreeModel *model; + gint position; + GarconMenuItem *item; + guint i; panel_return_if_fail (GTK_IS_TREE_VIEW (treeview)); panel_return_if_fail (GTK_IS_BUILDER (dialog->builder)); @@ -553,18 +555,18 @@ launcher_dialog_tree_drag_data_received (GtkWidget *treeview, static void -launcher_dialog_tree_selection_changed (GtkTreeSelection *selection, +launcher_dialog_tree_selection_changed (GtkTreeSelection *selection, LauncherPluginDialog *dialog) { - GObject *object; - GtkTreeModel *model; - GtkTreeIter iter; - gint n_children = -1; - gint position = 0; - GtkTreePath *path; - gboolean sensitive; + GObject *object; + GtkTreeModel *model; + GtkTreeIter iter; + gint n_children = -1; + gint position = 0; + GtkTreePath *path; + gboolean sensitive; GarconMenuItem *item = NULL; - gboolean editable = FALSE; + gboolean editable = FALSE; panel_return_if_fail (GTK_IS_TREE_SELECTION (selection)); panel_return_if_fail (GTK_IS_BUILDER (dialog->builder)); @@ -627,7 +629,7 @@ launcher_dialog_tree_selection_changed (GtkTreeSelection *selection, static gboolean launcher_dialog_press_event (LauncherPluginDialog *dialog, - const gchar *object_name) + const gchar *object_name) { GObject *object; @@ -647,7 +649,7 @@ launcher_dialog_press_event (LauncherPluginDialog *dialog, static gboolean -launcher_dialog_tree_popup_menu (GtkWidget *treeview, +launcher_dialog_tree_popup_menu (GtkWidget *treeview, LauncherPluginDialog *dialog) { GObject *menu; @@ -664,7 +666,7 @@ launcher_dialog_tree_popup_menu (GtkWidget *treeview, static void -launcher_dialog_tree_popup_menu_activated (GtkWidget *mi, +launcher_dialog_tree_popup_menu_activated (GtkWidget *mi, LauncherPluginDialog *dialog) { const gchar *name; @@ -699,8 +701,8 @@ launcher_dialog_tree_popup_menu_activated (GtkWidget *mi, static gboolean -launcher_dialog_tree_button_press_event (GtkTreeView *treeview, - GdkEventButton *event, +launcher_dialog_tree_button_press_event (GtkTreeView *treeview, + GdkEventButton *event, LauncherPluginDialog *dialog) { panel_return_val_if_fail (GTK_IS_BUILDER (dialog->builder), FALSE); @@ -726,8 +728,8 @@ launcher_dialog_tree_button_press_event (GtkTreeView *treeview, static gboolean -launcher_dialog_tree_key_press_event (GtkTreeView *treeview, - GdkEventKey *event, +launcher_dialog_tree_key_press_event (GtkTreeView *treeview, + GdkEventKey *event, LauncherPluginDialog *dialog) { panel_return_val_if_fail (GTK_IS_BUILDER (dialog->builder), FALSE); @@ -743,15 +745,15 @@ launcher_dialog_tree_key_press_event (GtkTreeView *treeview, static void -launcher_dialog_item_desktop_item_edit (GtkWidget *widget, - const gchar *type, - const gchar *uri, +launcher_dialog_item_desktop_item_edit (GtkWidget *widget, + const gchar *type, + const gchar *uri, LauncherPluginDialog *dialog) { - gchar *filename; - gchar *command; + gchar *filename; + gchar *command; GdkScreen *screen; - GError *error = NULL; + GError *error = NULL; GtkWidget *toplevel; panel_return_if_fail (GTK_IS_WIDGET (widget)); @@ -776,7 +778,7 @@ launcher_dialog_item_desktop_item_edit (GtkWidget *widget, { toplevel = gtk_widget_get_toplevel (widget); xfce_dialog_show_error (GTK_WINDOW (toplevel), error, - _("Failed to open desktop item editor")); + _("Failed to open desktop item editor")); g_error_free (error); } @@ -786,7 +788,7 @@ launcher_dialog_item_desktop_item_edit (GtkWidget *widget, static void -launcher_dialog_item_link_button_clicked (GtkWidget *button, +launcher_dialog_item_link_button_clicked (GtkWidget *button, LauncherPluginDialog *dialog) { launcher_dialog_item_desktop_item_edit (button, "Link", NULL, dialog); @@ -795,21 +797,21 @@ launcher_dialog_item_link_button_clicked (GtkWidget *button, static void -launcher_dialog_item_button_clicked (GtkWidget *button, +launcher_dialog_item_button_clicked (GtkWidget *button, LauncherPluginDialog *dialog) { - const gchar *name; - const gchar *display_name = NULL; - GObject *object; - GObject *treeview; + const gchar *name; + const gchar *display_name = NULL; + GObject *object; + GObject *treeview; GtkTreeSelection *selection; - GtkTreeModel *model; - GtkTreeIter iter_a, iter_b; - GtkTreePath *path; - gchar *uri; - GarconMenuItem *item; - GtkWidget *toplevel; - gboolean save_items = TRUE; + GtkTreeModel *model; + GtkTreeIter iter_a, iter_b; + GtkTreePath *path; + gchar *uri; + GarconMenuItem *item; + GtkWidget *toplevel; + gboolean save_items = TRUE; panel_return_if_fail (GTK_IS_BUILDABLE (button)); panel_return_if_fail (GTK_IS_BUILDER (dialog->builder)); @@ -836,6 +838,10 @@ launcher_dialog_item_button_clicked (GtkWidget *button, if (strcmp (name, "item-delete") == 0) { + const gchar *label = _("_Remove"); + const gchar *text = _("If you delete an item, it will be permanently removed"); + const gchar *_name; + /* get item name */ gtk_tree_model_get (model, &iter_a, COL_ITEM, &item, -1); if (G_LIKELY (item != NULL)) @@ -843,10 +849,9 @@ launcher_dialog_item_button_clicked (GtkWidget *button, /* ask the user */ toplevel = gtk_widget_get_toplevel (button); - if (xfce_dialog_confirm (GTK_WINDOW (toplevel), "edit-delete", _("_Remove"), - _("If you delete an item, it will be permanently removed"), - _("Are you sure you want to remove \"%s\"?"), - xfce_str_is_empty (display_name) ? _("Unnamed item") : display_name)) + _name = xfce_str_is_empty (display_name) ? _("Unnamed item") : display_name; + if (xfce_dialog_confirm (GTK_WINDOW (toplevel), "edit-delete", label, text, + _("Are you sure you want to remove \"%s\"?"), _name)) { /* remove the item from the store */ gtk_list_store_remove (GTK_LIST_STORE (model), &iter_a); @@ -913,8 +918,8 @@ launcher_dialog_item_button_clicked (GtkWidget *button, static void -launcher_dialog_response (GtkWidget *widget, - gint response_id, +launcher_dialog_response (GtkWidget *widget, + gint response_id, LauncherPluginDialog *dialog) { GObject *add_dialog; @@ -931,7 +936,7 @@ launcher_dialog_response (GtkWidget *widget, /* disconnect from items-changed signal */ g_signal_handlers_disconnect_by_func (G_OBJECT (dialog->plugin), - G_CALLBACK (launcher_dialog_items_load), dialog); + G_CALLBACK (launcher_dialog_items_load), dialog); /* disconnect from the menu items */ launcher_dialog_items_unload (dialog); @@ -951,12 +956,12 @@ launcher_dialog_response (GtkWidget *widget, static gboolean launcher_dialog_item_changed_foreach (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data) { - GarconMenuItem *item; - gboolean found; + GarconMenuItem *item; + gboolean found; LauncherChangedHandler *handler = user_data; panel_return_val_if_fail (GARCON_IS_MENU_ITEM (handler->item), TRUE); @@ -976,11 +981,11 @@ launcher_dialog_item_changed_foreach (GtkTreeModel *model, static void -launcher_dialog_item_changed (GarconMenuItem *item, +launcher_dialog_item_changed (GarconMenuItem *item, LauncherPluginDialog *dialog) { - GObject *treeview; - GtkTreeModel *model; + GObject *treeview; + GtkTreeModel *model; LauncherChangedHandler *handler; panel_return_if_fail (GARCON_IS_MENU_ITEM (item)); @@ -999,13 +1004,13 @@ launcher_dialog_item_changed (GarconMenuItem *item, static void -launcher_dialog_tree_row_changed (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, +launcher_dialog_tree_row_changed (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, LauncherPluginDialog *dialog) { GtkTreeSelection *selection; - GObject *treeview; + GObject *treeview; panel_return_if_fail (GTK_IS_BUILDER (dialog->builder)); @@ -1021,16 +1026,16 @@ launcher_dialog_tree_row_changed (GtkTreeModel *model, static void -launcher_dialog_items_set_item (GtkTreeModel *model, - GtkTreeIter *iter, - GarconMenuItem *item, +launcher_dialog_items_set_item (GtkTreeModel *model, + GtkTreeIter *iter, + GarconMenuItem *item, LauncherPluginDialog *dialog) { const gchar *name, *comment; - gchar *markup; - GIcon *icon; - gchar *tooltip; - GFile *gfile; + gchar *markup; + GIcon *icon; + gchar *tooltip; + GFile *gfile; panel_return_if_fail (GTK_IS_LIST_STORE (model)); panel_return_if_fail (GARCON_IS_MENU_ITEM (item)); @@ -1047,7 +1052,7 @@ launcher_dialog_items_set_item (GtkTreeModel *model, if (dialog != NULL) g_signal_handlers_block_by_func (G_OBJECT (model), - G_CALLBACK (launcher_dialog_tree_row_changed), dialog); + G_CALLBACK (launcher_dialog_tree_row_changed), dialog); gfile = garcon_menu_item_get_file (item); tooltip = g_file_get_parse_name (gfile); @@ -1062,7 +1067,7 @@ launcher_dialog_items_set_item (GtkTreeModel *model, if (dialog != NULL) g_signal_handlers_unblock_by_func (G_OBJECT (model), - G_CALLBACK (launcher_dialog_tree_row_changed), dialog); + G_CALLBACK (launcher_dialog_tree_row_changed), dialog); if (G_LIKELY (icon != NULL)) g_object_unref (G_OBJECT (icon)); @@ -1081,7 +1086,7 @@ launcher_dialog_items_unload (LauncherPluginDialog *dialog) { panel_return_if_fail (GARCON_IS_MENU_ITEM (li->data)); g_signal_handlers_disconnect_by_func (G_OBJECT (li->data), - G_CALLBACK (launcher_dialog_item_changed), dialog); + G_CALLBACK (launcher_dialog_item_changed), dialog); g_object_unref (G_OBJECT (li->data)); } @@ -1094,12 +1099,12 @@ launcher_dialog_items_unload (LauncherPluginDialog *dialog) static void launcher_dialog_items_load (LauncherPluginDialog *dialog) { - GObject *treeview; + GObject *treeview; GtkTreeSelection *selection; - GtkTreeModel *model; - GSList *li; - GtkTreeIter iter; - GtkTreePath *path; + GtkTreeModel *model; + GSList *li; + GtkTreeIter iter; + GtkTreePath *path; /* get the treeview */ treeview = gtk_builder_get_object (dialog->builder, "item-treeview"); @@ -1122,7 +1127,7 @@ launcher_dialog_items_load (LauncherPluginDialog *dialog) gtk_list_store_append (GTK_LIST_STORE (model), &iter); launcher_dialog_items_set_item (model, &iter, GARCON_MENU_ITEM (li->data), dialog); g_signal_connect (G_OBJECT (li->data), "changed", - G_CALLBACK (launcher_dialog_item_changed), dialog); + G_CALLBACK (launcher_dialog_item_changed), dialog); } if (G_LIKELY (path != NULL)) @@ -1144,18 +1149,18 @@ void launcher_dialog_show (LauncherPlugin *plugin) { LauncherPluginDialog *dialog; - GtkBuilder *builder; - GObject *window, *object, *item; - guint i; - GtkTreeSelection *selection; - const gchar *button_names[] = { "item-add", "item-delete", - "item-move-up", "item-move-down", - "item-edit", "item-new" }; - const gchar *mi_names[] = { "mi-edit", "mi-delete", - "mi-application", "mi-link", "mi-add", - "mi-move-up", "mi-move-down" }; - const gchar *binding_names[] = { "disable-tooltips", "show-label", - "move-first", "arrow-position" }; + GtkBuilder *builder; + GObject *window, *object, *item; + guint i; + GtkTreeSelection *selection; + const gchar *button_names[] = { "item-add", "item-delete", + "item-move-up", "item-move-down", + "item-edit", "item-new" }; + const gchar *mi_names[] = { "mi-edit", "mi-delete", + "mi-application", "mi-link", "mi-add", + "mi-move-up", "mi-move-down" }; + const gchar *binding_names[] = { "disable-tooltips", "show-label", + "move-first", "arrow-position" }; panel_return_if_fail (LAUNCHER_IS_PLUGIN (plugin)); @@ -1172,7 +1177,7 @@ launcher_dialog_show (LauncherPlugin *plugin) dialog->items = NULL; g_signal_connect (G_OBJECT (window), "response", - G_CALLBACK (launcher_dialog_response), dialog); + G_CALLBACK (launcher_dialog_response), dialog); /* connect item buttons */ for (i = 0; i < G_N_ELEMENTS (button_names); i++) @@ -1180,7 +1185,7 @@ launcher_dialog_show (LauncherPlugin *plugin) object = gtk_builder_get_object (builder, button_names[i]); panel_return_if_fail (GTK_IS_WIDGET (object)); g_signal_connect (G_OBJECT (object), "clicked", - G_CALLBACK (launcher_dialog_item_button_clicked), dialog); + G_CALLBACK (launcher_dialog_item_button_clicked), dialog); } object = gtk_builder_get_object (builder, "item-link"); g_signal_connect (G_OBJECT (object), "clicked", @@ -1192,32 +1197,32 @@ launcher_dialog_show (LauncherPlugin *plugin) object = gtk_builder_get_object (builder, mi_names[i]); panel_return_if_fail (GTK_IS_WIDGET (object)); g_signal_connect (G_OBJECT (object), "activate", - G_CALLBACK (launcher_dialog_tree_popup_menu_activated), dialog); + G_CALLBACK (launcher_dialog_tree_popup_menu_activated), dialog); } object = gtk_builder_get_object (dialog->builder, "item-store"); g_signal_connect (G_OBJECT (object), "row-changed", - G_CALLBACK (launcher_dialog_tree_row_changed), dialog); + G_CALLBACK (launcher_dialog_tree_row_changed), dialog); /* setup treeview selection */ object = gtk_builder_get_object (builder, "item-treeview"); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (object)); - gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (object), - list_drop_targets, G_N_ELEMENTS (list_drop_targets), GDK_ACTION_COPY); - gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (object), GDK_BUTTON1_MASK, - list_drag_targets, G_N_ELEMENTS (list_drag_targets), GDK_ACTION_MOVE); + gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (object), list_drop_targets, + G_N_ELEMENTS (list_drop_targets), GDK_ACTION_COPY); + gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (object), GDK_BUTTON1_MASK, list_drag_targets, + G_N_ELEMENTS (list_drag_targets), GDK_ACTION_MOVE); gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); g_signal_connect (G_OBJECT (object), "drag-data-received", - G_CALLBACK (launcher_dialog_tree_drag_data_received), dialog); + G_CALLBACK (launcher_dialog_tree_drag_data_received), dialog); g_signal_connect (G_OBJECT (selection), "changed", - G_CALLBACK (launcher_dialog_tree_selection_changed), dialog); + G_CALLBACK (launcher_dialog_tree_selection_changed), dialog); launcher_dialog_tree_selection_changed (selection, dialog); g_signal_connect (G_OBJECT (object), "button-press-event", - G_CALLBACK (launcher_dialog_tree_button_press_event), dialog); + G_CALLBACK (launcher_dialog_tree_button_press_event), dialog); g_signal_connect (G_OBJECT (object), "key-press-event", - G_CALLBACK (launcher_dialog_tree_key_press_event), dialog); + G_CALLBACK (launcher_dialog_tree_key_press_event), dialog); g_signal_connect (G_OBJECT (object), "popup-menu", - G_CALLBACK (launcher_dialog_tree_popup_menu), dialog); + G_CALLBACK (launcher_dialog_tree_popup_menu), dialog); /* connect bindings to the advanced properties */ for (i = 0; i < G_N_ELEMENTS (binding_names); i++) @@ -1232,11 +1237,11 @@ launcher_dialog_show (LauncherPlugin *plugin) /* setup responses for the add dialog */ object = gtk_builder_get_object (builder, "dialog-add"); gtk_window_set_screen (GTK_WINDOW (object), - gtk_window_get_screen (GTK_WINDOW (window))); + gtk_window_get_screen (GTK_WINDOW (window))); g_signal_connect (G_OBJECT (object), "response", - G_CALLBACK (launcher_dialog_add_response), dialog); + G_CALLBACK (launcher_dialog_add_response), dialog); g_signal_connect (G_OBJECT (object), "delete-event", - G_CALLBACK (gtk_widget_hide_on_delete), NULL); + G_CALLBACK (gtk_widget_hide_on_delete), NULL); /* setup sorting in the add dialog */ object = gtk_builder_get_object (builder, "add-store"); @@ -1246,30 +1251,30 @@ launcher_dialog_show (LauncherPlugin *plugin) /* allow selecting multiple items in the add dialog */ object = gtk_builder_get_object (builder, "add-treeview"); gtk_drag_source_set (GTK_WIDGET (object), GDK_BUTTON1_MASK, - add_drag_targets, G_N_ELEMENTS (add_drag_targets), GDK_ACTION_COPY); + add_drag_targets, G_N_ELEMENTS (add_drag_targets), GDK_ACTION_COPY); g_signal_connect (G_OBJECT (object), "drag-data-get", - G_CALLBACK (launcher_dialog_add_drag_data_get), dialog); + G_CALLBACK (launcher_dialog_add_drag_data_get), dialog); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (object)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); g_signal_connect (G_OBJECT (selection), "changed", - G_CALLBACK (launcher_dialog_add_selection_changed), dialog); + G_CALLBACK (launcher_dialog_add_selection_changed), dialog); g_signal_connect (G_OBJECT (object), "button-press-event", - G_CALLBACK (launcher_dialog_add_button_press_event), dialog); + G_CALLBACK (launcher_dialog_add_button_press_event), dialog); g_signal_connect (G_OBJECT (object), "key-press-event", - G_CALLBACK (launcher_dialog_add_key_press_event), dialog); + G_CALLBACK (launcher_dialog_add_key_press_event), dialog); /* setup search filter in the add dialog */ object = gtk_builder_get_object (builder, "add-store-filter"); item = gtk_builder_get_object (builder, "add-search"); gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (object), - launcher_dialog_add_visible_function, item, NULL); + launcher_dialog_add_visible_function, item, NULL); g_signal_connect_swapped (G_OBJECT (item), "changed", - G_CALLBACK (gtk_tree_model_filter_refilter), object); + G_CALLBACK (gtk_tree_model_filter_refilter), object); /* load the plugin items */ launcher_dialog_items_load (dialog); g_signal_connect_swapped (G_OBJECT (plugin), "items-changed", - G_CALLBACK (launcher_dialog_items_load), dialog); + G_CALLBACK (launcher_dialog_items_load), dialog); /* show the dialog */ gtk_widget_show (GTK_WIDGET (window)); diff --git a/plugins/launcher/launcher-dialog.h b/plugins/launcher/launcher-dialog.h index 1dca7b68d..d4e8b997c 100644 --- a/plugins/launcher/launcher-dialog.h +++ b/plugins/launcher/launcher-dialog.h @@ -21,6 +21,7 @@ #include "launcher.h" -void launcher_dialog_show (LauncherPlugin *plugin); +void +launcher_dialog_show (LauncherPlugin *plugin); #endif /* !__XFCE_LAUNCHER_DIALOG_H__ */ diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c index 7c33f13f5..6e7964d60 100644 --- a/plugins/launcher/launcher.c +++ b/plugins/launcher/launcher.c @@ -32,134 +32,177 @@ #include <libxfce4ui/libxfce4ui.h> #include <xfconf/xfconf.h> -#define ARROW_BUTTON_SIZE (12) -#define MENU_POPUP_DELAY (225) +#define ARROW_BUTTON_SIZE (12) +#define MENU_POPUP_DELAY (225) #define NO_ARROW_INSIDE_BUTTON(plugin) ((plugin)->arrow_position != LAUNCHER_ARROW_INTERNAL \ || LIST_HAS_ONE_OR_NO_ENTRIES ((plugin)->items)) -#define ARROW_INSIDE_BUTTON(plugin) (!NO_ARROW_INSIDE_BUTTON (plugin)) -#define RELATIVE_CONFIG_PATH PANEL_PLUGIN_RELATIVE_PATH G_DIR_SEPARATOR_S "%s-%d" - - - -static void launcher_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void launcher_plugin_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void launcher_plugin_construct (XfcePanelPlugin *panel_plugin); -static void launcher_plugin_free_data (XfcePanelPlugin *panel_plugin); -static void launcher_plugin_removed (XfcePanelPlugin *panel_plugin); -static gboolean launcher_plugin_remote_event (XfcePanelPlugin *panel_plugin, - const gchar *name, - const GValue *value); -static gboolean launcher_plugin_save_delayed_timeout (gpointer user_data); -static void launcher_plugin_save_delayed (LauncherPlugin *plugin); -static void launcher_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode); -static gboolean launcher_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); -static void launcher_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); -static void launcher_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, - XfceScreenPosition position); -static LauncherArrowType launcher_plugin_default_arrow_type (LauncherPlugin *plugin); -static void launcher_plugin_pack_widgets (LauncherPlugin *plugin); -static void launcher_plugin_tooltip_icon_invalidate (GObject *object); -static void launcher_plugin_icon_invalidate (LauncherPlugin *plugin); -static void launcher_plugin_menu_deactivate (GtkWidget *menu, - LauncherPlugin *plugin); -static void launcher_plugin_menu_item_activate (GtkMenuItem *widget, - GarconMenuItem *item); -static void launcher_plugin_menu_item_drag_data_received (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *data, - guint info, - guint drag_time, - GarconMenuItem *item); -static void launcher_plugin_menu_construct (LauncherPlugin *plugin); -static void launcher_plugin_menu_popup_destroyed (gpointer user_data); -static gboolean launcher_plugin_menu_popup (gpointer user_data); -static void launcher_plugin_menu_destroy (LauncherPlugin *plugin); -static void launcher_plugin_button_update (LauncherPlugin *plugin); -static void launcher_plugin_button_update_action_menu (LauncherPlugin *plugin); -static void launcher_plugin_button_state_changed (GtkWidget *button_a, - GtkStateFlags state, - GtkWidget *button_b); -static gboolean launcher_plugin_button_press_event (GtkWidget *button, - GdkEventButton *event, - LauncherPlugin *plugin); -static gboolean launcher_plugin_button_release_event (GtkWidget *button, - GdkEventButton *event, - LauncherPlugin *plugin); -static gboolean launcher_plugin_button_query_tooltip (GtkWidget *widget, - gint x, - gint y, - gboolean keyboard_mode, - GtkTooltip *tooltip, - LauncherPlugin *plugin); -static void launcher_plugin_button_drag_data_received (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection_data, - guint info, - guint drag_time, - LauncherPlugin *plugin); -static gboolean launcher_plugin_button_drag_motion (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint drag_time, - LauncherPlugin *plugin); -static gboolean launcher_plugin_button_drag_drop (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint drag_time, - LauncherPlugin *plugin); -static void launcher_plugin_button_drag_leave (GtkWidget *widget, - GdkDragContext *context, - guint drag_time, - LauncherPlugin *plugin); -static gboolean launcher_plugin_button_draw (GtkWidget *widget, - cairo_t *cr, - LauncherPlugin *plugin); -static void launcher_plugin_arrow_visibility (LauncherPlugin *plugin); -static gboolean launcher_plugin_arrow_press_event (GtkWidget *button, - GdkEventButton *event, - LauncherPlugin *plugin); -static gboolean launcher_plugin_arrow_drag_motion (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint drag_time, - LauncherPlugin *plugin); -static void launcher_plugin_arrow_drag_leave (GtkWidget *widget, - GdkDragContext *context, - guint drag_time, - LauncherPlugin *plugin); -static gboolean launcher_plugin_item_query_tooltip (GtkWidget *widget, - gint x, - gint y, - gboolean keyboard_mode, - GtkTooltip *tooltip, - GarconMenuItem *item); -static gboolean launcher_plugin_item_exec_on_screen (GarconMenuItem *item, - guint32 event_time, - GdkScreen *screen, - GSList *uri_list); -static void launcher_plugin_item_exec (GarconMenuItem *item, - guint32 event_time, - GdkScreen *screen, - GSList *uri_list); -static void launcher_plugin_item_exec_from_clipboard (GarconMenuItem *item, - guint32 event_time, - GdkScreen *screen); -static GSList *launcher_plugin_uri_list_extract (GtkSelectionData *data); +#define ARROW_INSIDE_BUTTON(plugin) (!NO_ARROW_INSIDE_BUTTON (plugin)) +#define RELATIVE_CONFIG_PATH PANEL_PLUGIN_RELATIVE_PATH G_DIR_SEPARATOR_S "%s-%d" + + + +static void +launcher_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +launcher_plugin_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +launcher_plugin_construct (XfcePanelPlugin *panel_plugin); +static void +launcher_plugin_free_data (XfcePanelPlugin *panel_plugin); +static void +launcher_plugin_removed (XfcePanelPlugin *panel_plugin); +static gboolean +launcher_plugin_remote_event (XfcePanelPlugin *panel_plugin, + const gchar *name, + const GValue *value); +static gboolean +launcher_plugin_save_delayed_timeout (gpointer user_data); +static void +launcher_plugin_save_delayed (LauncherPlugin *plugin); +static void +launcher_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode); +static gboolean +launcher_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); +static void +launcher_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); +static void +launcher_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, + XfceScreenPosition position); +static LauncherArrowType +launcher_plugin_default_arrow_type (LauncherPlugin *plugin); +static void +launcher_plugin_pack_widgets (LauncherPlugin *plugin); +static void +launcher_plugin_tooltip_icon_invalidate (GObject *object); +static void +launcher_plugin_icon_invalidate (LauncherPlugin *plugin); +static void +launcher_plugin_menu_deactivate (GtkWidget *menu, + LauncherPlugin *plugin); +static void +launcher_plugin_menu_item_activate (GtkMenuItem *widget, + GarconMenuItem *item); +static void +launcher_plugin_menu_item_drag_data_received (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *data, + guint info, + guint drag_time, + GarconMenuItem *item); +static void +launcher_plugin_menu_construct (LauncherPlugin *plugin); +static void +launcher_plugin_menu_popup_destroyed (gpointer user_data); +static gboolean +launcher_plugin_menu_popup (gpointer user_data); +static void +launcher_plugin_menu_destroy (LauncherPlugin *plugin); +static void +launcher_plugin_button_update (LauncherPlugin *plugin); +static void +launcher_plugin_button_update_action_menu (LauncherPlugin *plugin); +static void +launcher_plugin_button_state_changed (GtkWidget *button_a, + GtkStateFlags state, + GtkWidget *button_b); +static gboolean +launcher_plugin_button_press_event (GtkWidget *button, + GdkEventButton *event, + LauncherPlugin *plugin); +static gboolean +launcher_plugin_button_release_event (GtkWidget *button, + GdkEventButton *event, + LauncherPlugin *plugin); +static gboolean +launcher_plugin_button_query_tooltip (GtkWidget *widget, + gint x, + gint y, + gboolean keyboard_mode, + GtkTooltip *tooltip, + LauncherPlugin *plugin); +static void +launcher_plugin_button_drag_data_received (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *selection_data, + guint info, + guint drag_time, + LauncherPlugin *plugin); +static gboolean +launcher_plugin_button_drag_motion (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint drag_time, + LauncherPlugin *plugin); +static gboolean +launcher_plugin_button_drag_drop (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint drag_time, + LauncherPlugin *plugin); +static void +launcher_plugin_button_drag_leave (GtkWidget *widget, + GdkDragContext *context, + guint drag_time, + LauncherPlugin *plugin); +static gboolean +launcher_plugin_button_draw (GtkWidget *widget, + cairo_t *cr, + LauncherPlugin *plugin); +static void +launcher_plugin_arrow_visibility (LauncherPlugin *plugin); +static gboolean +launcher_plugin_arrow_press_event (GtkWidget *button, + GdkEventButton *event, + LauncherPlugin *plugin); +static gboolean +launcher_plugin_arrow_drag_motion (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint drag_time, + LauncherPlugin *plugin); +static void +launcher_plugin_arrow_drag_leave (GtkWidget *widget, + GdkDragContext *context, + guint drag_time, + LauncherPlugin *plugin); +static gboolean +launcher_plugin_item_query_tooltip (GtkWidget *widget, + gint x, + gint y, + gboolean keyboard_mode, + GtkTooltip *tooltip, + GarconMenuItem *item); +static gboolean +launcher_plugin_item_exec_on_screen (GarconMenuItem *item, + guint32 event_time, + GdkScreen *screen, + GSList *uri_list); +static void +launcher_plugin_item_exec (GarconMenuItem *item, + guint32 event_time, + GdkScreen *screen, + GSList *uri_list); +static void +launcher_plugin_item_exec_from_clipboard (GarconMenuItem *item, + guint32 event_time, + GdkScreen *screen); +static GSList * +launcher_plugin_uri_list_extract (GtkSelectionData *data); @@ -167,31 +210,31 @@ struct _LauncherPlugin { XfcePanelPlugin __parent__; - GtkWidget *box; - GtkWidget *button; - GtkWidget *arrow; - GtkWidget *child; - GtkWidget *menu; - GtkWidget *action_menu; + GtkWidget *box; + GtkWidget *button; + GtkWidget *arrow; + GtkWidget *child; + GtkWidget *menu; + GtkWidget *action_menu; - GSList *items; + GSList *items; - cairo_surface_t *surface; - gchar *icon_name; + cairo_surface_t *surface; + gchar *icon_name; - gulong theme_change_id; + gulong theme_change_id; - guint menu_timeout_id; + guint menu_timeout_id; - guint disable_tooltips : 1; - guint move_first : 1; - guint show_label : 1; - LauncherArrowType arrow_position; + guint disable_tooltips : 1; + guint move_first : 1; + guint show_label : 1; + LauncherArrowType arrow_position; - GFile *config_directory; - GFileMonitor *config_monitor; + GFile *config_directory; + GFileMonitor *config_monitor; - guint save_timeout_id; + guint save_timeout_id; }; enum @@ -217,15 +260,14 @@ XFCE_PANEL_DEFINE_PLUGIN_RESIDENT (LauncherPlugin, launcher_plugin) /* quark to attach the plugin to menu items */ -static GQuark launcher_plugin_quark = 0; -static guint launcher_signals[LAST_SIGNAL]; +static GQuark launcher_plugin_quark = 0; +static guint launcher_signals[LAST_SIGNAL]; /* target types for dropping in the launcher plugin */ -static const GtkTargetEntry drop_targets[] = -{ - { "text/uri-list", 0, 0, }, +static const GtkTargetEntry drop_targets[] = { + { "text/uri-list", 0, 0 }, { "STRING", 0, 0 }, { "UTF8_STRING", 0, 0 }, { "text/plain", 0, 0 }, @@ -236,7 +278,7 @@ static const GtkTargetEntry drop_targets[] = static void launcher_plugin_class_init (LauncherPluginClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; XfcePanelPluginClass *plugin_class; gobject_class = G_OBJECT_CLASS (klass); @@ -290,13 +332,12 @@ launcher_plugin_class_init (LauncherPluginClass *klass) LAUNCHER_ARROW_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - launcher_signals[ITEMS_CHANGED] = - g_signal_new (g_intern_static_string ("items-changed"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + launcher_signals[ITEMS_CHANGED] = g_signal_new (g_intern_static_string ("items-changed"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); /* initialize the quark */ launcher_plugin_quark = g_quark_from_static_string ("xfce-launcher-plugin"); @@ -307,9 +348,9 @@ launcher_plugin_class_init (LauncherPluginClass *klass) static void launcher_plugin_init (LauncherPlugin *plugin) { - GtkCssProvider *css_provider; + GtkCssProvider *css_provider; GtkStyleContext *context; - gchar *css_string; + gchar *css_string; plugin->disable_tooltips = FALSE; plugin->move_first = FALSE; @@ -334,29 +375,30 @@ launcher_plugin_init (LauncherPlugin *plugin) gtk_widget_set_has_tooltip (plugin->button, TRUE); gtk_widget_set_name (plugin->button, "launcher-button"); g_signal_connect (G_OBJECT (plugin->button), "button-press-event", - G_CALLBACK (launcher_plugin_button_press_event), plugin); + G_CALLBACK (launcher_plugin_button_press_event), plugin); g_signal_connect (G_OBJECT (plugin->button), "button-release-event", - G_CALLBACK (launcher_plugin_button_release_event), plugin); + G_CALLBACK (launcher_plugin_button_release_event), plugin); g_signal_connect (G_OBJECT (plugin->button), "query-tooltip", - G_CALLBACK (launcher_plugin_button_query_tooltip), plugin); + G_CALLBACK (launcher_plugin_button_query_tooltip), plugin); g_signal_connect (G_OBJECT (plugin->button), "drag-data-received", - G_CALLBACK (launcher_plugin_button_drag_data_received), plugin); + G_CALLBACK (launcher_plugin_button_drag_data_received), plugin); g_signal_connect (G_OBJECT (plugin->button), "drag-motion", - G_CALLBACK (launcher_plugin_button_drag_motion), plugin); + G_CALLBACK (launcher_plugin_button_drag_motion), plugin); g_signal_connect (G_OBJECT (plugin->button), "drag-drop", - G_CALLBACK (launcher_plugin_button_drag_drop), plugin); + G_CALLBACK (launcher_plugin_button_drag_drop), plugin); g_signal_connect (G_OBJECT (plugin->button), "drag-leave", - G_CALLBACK (launcher_plugin_button_drag_leave), plugin); + G_CALLBACK (launcher_plugin_button_drag_leave), plugin); g_signal_connect_after (G_OBJECT (plugin->button), "draw", - G_CALLBACK (launcher_plugin_button_draw), plugin); + G_CALLBACK (launcher_plugin_button_draw), plugin); /* invalidate tooltip icon when needed */ - plugin->theme_change_id = g_signal_connect_swapped (gtk_icon_theme_get_default (), "changed", - G_CALLBACK (launcher_plugin_tooltip_icon_invalidate), plugin->button); + plugin->theme_change_id + = g_signal_connect_swapped (gtk_icon_theme_get_default (), "changed", + G_CALLBACK (launcher_plugin_tooltip_icon_invalidate), plugin->button); g_signal_connect (plugin, "notify::scale-factor", - G_CALLBACK (launcher_plugin_icon_invalidate), NULL); + G_CALLBACK (launcher_plugin_icon_invalidate), NULL); g_signal_connect (plugin, "notify::scale-factor", - G_CALLBACK (launcher_plugin_menu_destroy), NULL); + G_CALLBACK (launcher_plugin_menu_destroy), NULL); /* Make sure there aren't any constraints set on buttons by themes (Adwaita sets those minimum sizes) */ context = gtk_widget_get_style_context (plugin->button); @@ -378,13 +420,13 @@ launcher_plugin_init (LauncherPlugin *plugin) gtk_button_set_relief (GTK_BUTTON (plugin->arrow), GTK_RELIEF_NONE); gtk_widget_set_name (plugin->button, "launcher-arrow"); g_signal_connect (G_OBJECT (plugin->arrow), "button-press-event", - G_CALLBACK (launcher_plugin_arrow_press_event), plugin); + G_CALLBACK (launcher_plugin_arrow_press_event), plugin); g_signal_connect (G_OBJECT (plugin->arrow), "drag-motion", - G_CALLBACK (launcher_plugin_arrow_drag_motion), plugin); + G_CALLBACK (launcher_plugin_arrow_drag_motion), plugin); g_signal_connect (G_OBJECT (plugin->button), "drag-drop", - G_CALLBACK (launcher_plugin_button_drag_drop), plugin); + G_CALLBACK (launcher_plugin_button_drag_drop), plugin); g_signal_connect (G_OBJECT (plugin->arrow), "drag-leave", - G_CALLBACK (launcher_plugin_arrow_drag_leave), plugin); + G_CALLBACK (launcher_plugin_arrow_drag_leave), plugin); panel_utils_set_atk_info (plugin->arrow, _("Open launcher menu"), NULL); @@ -395,9 +437,9 @@ launcher_plugin_init (LauncherPlugin *plugin) /* sync button states */ g_signal_connect (G_OBJECT (plugin->button), "state-flags-changed", - G_CALLBACK (launcher_plugin_button_state_changed), plugin->arrow); + G_CALLBACK (launcher_plugin_button_state_changed), plugin->arrow); g_signal_connect (G_OBJECT (plugin->arrow), "state-flags-changed", - G_CALLBACK (launcher_plugin_button_state_changed), plugin->button); + G_CALLBACK (launcher_plugin_button_state_changed), plugin->button); } @@ -405,7 +447,7 @@ launcher_plugin_init (LauncherPlugin *plugin) static void launcher_free_array_element (gpointer data) { - GValue *value = (GValue *)data; + GValue *value = (GValue *) data; g_value_unset (value); g_free (value); @@ -414,16 +456,16 @@ launcher_free_array_element (gpointer data) static void -launcher_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, +launcher_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { LauncherPlugin *plugin = LAUNCHER_PLUGIN (object); - GPtrArray *array; - GValue *tmp; - GSList *li; - GFile *item_file; + GPtrArray *array; + GValue *tmp; + GSList *li; + GFile *item_file; switch (prop_id) { @@ -501,15 +543,15 @@ launcher_plugin_item_changed (GarconMenuItem *item, static gboolean -launcher_plugin_item_duplicate (GFile *src_file, - GFile *dst_file, +launcher_plugin_item_duplicate (GFile *src_file, + GFile *dst_file, GError **error) { GKeyFile *key_file; - gchar *contents = NULL; - gsize length; - gboolean result = FALSE; - gchar *uri; + gchar *contents = NULL; + gsize length; + gboolean result = FALSE; + gchar *uri; panel_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -543,15 +585,15 @@ err1: static GarconMenuItem * launcher_plugin_item_load (LauncherPlugin *plugin, - const gchar *str, - gboolean *desktop_id_return, - gboolean *location_changed) + const gchar *str, + gboolean *desktop_id_return, + gboolean *location_changed) { - GFile *src_file, *dst_file; - gchar *src_path, *dst_path; - GSList *li, *lnext; + GFile *src_file, *dst_file; + gchar *src_path, *dst_path; + GSList *li, *lnext; GarconMenuItem *item = NULL; - GError *error = NULL; + GError *error = NULL; panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), NULL); panel_return_val_if_fail (str != NULL, NULL); @@ -583,8 +625,8 @@ launcher_plugin_item_load (LauncherPlugin *plugin, else { src_path = g_file_get_parse_name (src_file); - g_warning ("Failed to create duplicate of desktop file \"%s\" " - "to \"%s\": %s", src_path, dst_path, error->message); + g_warning ("Failed to create duplicate of desktop file \"%s\" to \"%s\": %s", + src_path, dst_path, error->message); g_error_free (error); g_free (src_path); @@ -600,8 +642,8 @@ launcher_plugin_item_load (LauncherPlugin *plugin, { /* nothing we can do with this file */ src_path = g_file_get_parse_name (src_file); - g_warning ("Failed to load desktop file \"%s\". It will be removed " - "from the configuration", src_path); + g_warning ("Failed to load desktop file \"%s\". It will be removed from the configuration", + src_path); g_free (src_path); g_object_unref (G_OBJECT (src_file)); @@ -648,10 +690,10 @@ launcher_plugin_item_load (LauncherPlugin *plugin, static void launcher_plugin_items_delete_configs (LauncherPlugin *plugin) { - GSList *li; - GFile *file; - gboolean succeed = TRUE; - GError *error = NULL; + GSList *li; + GFile *file; + gboolean succeed = TRUE; + GError *error = NULL; panel_return_if_fail (G_IS_FILE (plugin->config_directory)); @@ -677,19 +719,19 @@ launcher_plugin_items_delete_configs (LauncherPlugin *plugin) static void launcher_plugin_items_load (LauncherPlugin *plugin, - GPtrArray *array) + GPtrArray *array) { - guint i; - const GValue *value; - const gchar *str; + guint i; + const GValue *value; + const gchar *str; GarconMenuItem *item; GarconMenuItem *pool_item; - GSList *items = NULL; - GHashTable *pool = NULL; - gboolean desktop_id; - gchar *uri; - gboolean items_modified = FALSE; - gboolean location_changed; + GSList *items = NULL; + GHashTable *pool = NULL; + gboolean desktop_id; + gchar *uri; + gboolean items_modified = FALSE; + gboolean location_changed; panel_return_if_fail (LAUNCHER_IS_PLUGIN (plugin)); panel_return_if_fail (array != NULL); @@ -752,7 +794,7 @@ launcher_plugin_items_load (LauncherPlugin *plugin, panel_assert (GARCON_IS_MENU_ITEM (item)); items = g_slist_append (items, item); g_signal_connect (G_OBJECT (item), "changed", - G_CALLBACK (launcher_plugin_item_changed), plugin); + G_CALLBACK (launcher_plugin_item_changed), plugin); } if (G_UNLIKELY (pool != NULL)) @@ -773,13 +815,13 @@ launcher_plugin_items_load (LauncherPlugin *plugin, static void -launcher_plugin_set_property (GObject *object, - guint prop_id, +launcher_plugin_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { LauncherPlugin *plugin = LAUNCHER_PLUGIN (object); - GPtrArray *array; + GPtrArray *array; panel_return_if_fail (G_IS_FILE (plugin->config_directory)); @@ -839,7 +881,7 @@ launcher_plugin_set_property (GObject *object, /* update size */ launcher_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin), - xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); + xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); /* update the button */ launcher_plugin_button_update (plugin); @@ -857,7 +899,7 @@ update_arrow: /* update the plugin size */ launcher_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin), - xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); + xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin))); break; default: @@ -869,21 +911,21 @@ update_arrow: static void -launcher_plugin_file_changed (GFileMonitor *monitor, - GFile *changed_file, - GFile *other_file, - GFileMonitorEvent event_type, - LauncherPlugin *plugin) +launcher_plugin_file_changed (GFileMonitor *monitor, + GFile *changed_file, + GFile *other_file, + GFileMonitorEvent event_type, + LauncherPlugin *plugin) { - GSList *li, *lnext; + GSList *li, *lnext; GarconMenuItem *item; - GFile *item_file; - gboolean found; - GError *error = NULL; - gchar *base_name; - gboolean result; - gboolean exists; - gboolean update_plugin = FALSE; + GFile *item_file; + gboolean found; + GError *error = NULL; + gchar *base_name; + gboolean result; + gboolean exists; + gboolean update_plugin = FALSE; panel_return_if_fail (LAUNCHER_IS_PLUGIN (plugin)); panel_return_if_fail (plugin->config_monitor == monitor); @@ -940,7 +982,7 @@ launcher_plugin_file_changed (GFileMonitor *monitor, { plugin->items = g_slist_append (plugin->items, item); g_signal_connect (G_OBJECT (item), "changed", - G_CALLBACK (launcher_plugin_item_changed), plugin); + G_CALLBACK (launcher_plugin_item_changed), plugin); update_plugin = TRUE; } } @@ -964,15 +1006,14 @@ launcher_plugin_file_changed (GFileMonitor *monitor, static void launcher_plugin_construct (XfcePanelPlugin *panel_plugin) { - LauncherPlugin *plugin = LAUNCHER_PLUGIN (panel_plugin); - const gchar * const *uris; - guint i; - GPtrArray *array; - GValue *value; - gchar *file, *path; - GError *error = NULL; - const PanelProperty properties[] = - { + LauncherPlugin *plugin = LAUNCHER_PLUGIN (panel_plugin); + const gchar *const *uris; + guint i; + GPtrArray *array; + GValue *value; + gchar *file, *path; + GError *error = NULL; + const PanelProperty properties[] = { { "show-label", G_TYPE_BOOLEAN }, { "items", G_TYPE_PTR_ARRAY }, { "disable-tooltips", G_TYPE_BOOLEAN }, @@ -1055,7 +1096,7 @@ static void launcher_plugin_free_data (XfcePanelPlugin *panel_plugin) { LauncherPlugin *plugin = LAUNCHER_PLUGIN (panel_plugin); - GtkIconTheme *icon_theme; + GtkIconTheme *icon_theme; /* stop monitoring */ if (plugin->config_monitor != NULL) @@ -1098,7 +1139,7 @@ static void launcher_plugin_removed (XfcePanelPlugin *panel_plugin) { LauncherPlugin *plugin = LAUNCHER_PLUGIN (panel_plugin); - GError *error = NULL; + GError *error = NULL; panel_return_if_fail (G_IS_FILE (plugin->config_directory)); @@ -1130,8 +1171,8 @@ launcher_plugin_removed (XfcePanelPlugin *panel_plugin) static gboolean launcher_plugin_remote_event (XfcePanelPlugin *panel_plugin, - const gchar *name, - const GValue *value) + const gchar *name, + const GValue *value) { LauncherPlugin *plugin = LAUNCHER_PLUGIN (panel_plugin); @@ -1186,14 +1227,14 @@ launcher_plugin_save_delayed (LauncherPlugin *plugin) g_source_remove (plugin->save_timeout_id); plugin->save_timeout_id = gdk_threads_add_timeout_seconds_full (G_PRIORITY_LOW, 1, - launcher_plugin_save_delayed_timeout, plugin, - launcher_plugin_save_delayed_timeout_destroyed); + launcher_plugin_save_delayed_timeout, plugin, + launcher_plugin_save_delayed_timeout_destroyed); } static void -launcher_plugin_mode_changed (XfcePanelPlugin *panel_plugin, +launcher_plugin_mode_changed (XfcePanelPlugin *panel_plugin, XfcePanelPluginMode mode) { /* update label orientation */ @@ -1204,24 +1245,24 @@ launcher_plugin_mode_changed (XfcePanelPlugin *panel_plugin, /* update the arrow button */ launcher_plugin_screen_position_changed (panel_plugin, - xfce_panel_plugin_get_screen_position (panel_plugin)); + xfce_panel_plugin_get_screen_position (panel_plugin)); /* update the plugin size */ launcher_plugin_size_changed (panel_plugin, - xfce_panel_plugin_get_size (panel_plugin)); + xfce_panel_plugin_get_size (panel_plugin)); } static gboolean launcher_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { - LauncherPlugin *plugin = LAUNCHER_PLUGIN (panel_plugin); - gint p_width, p_height; - gint a_width, a_height; - gboolean horizontal; - LauncherArrowType arrow_position; + LauncherPlugin *plugin = LAUNCHER_PLUGIN (panel_plugin); + gint p_width, p_height; + gint a_width, a_height; + gboolean horizontal; + LauncherArrowType arrow_position; /* initialize the plugin size */ size /= xfce_panel_plugin_get_nrows (panel_plugin); @@ -1232,8 +1273,7 @@ launcher_plugin_size_changed (XfcePanelPlugin *panel_plugin, if (gtk_widget_get_visible (plugin->arrow)) { /* if the panel is horizontal */ - horizontal = !!(xfce_panel_plugin_get_orientation (panel_plugin) == - GTK_ORIENTATION_HORIZONTAL); + horizontal = !!(xfce_panel_plugin_get_orientation (panel_plugin) == GTK_ORIENTATION_HORIZONTAL); /* translate default direction */ arrow_position = launcher_plugin_default_arrow_type (plugin); @@ -1260,9 +1300,8 @@ launcher_plugin_size_changed (XfcePanelPlugin *panel_plugin, break; } - /* set the arrow size */ - gtk_widget_set_size_request (plugin->arrow, a_width, a_height); - + /* set the arrow size */ + gtk_widget_set_size_request (plugin->arrow, a_width, a_height); } /* set the panel plugin size */ @@ -1319,14 +1358,14 @@ launcher_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) static void -launcher_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, - XfceScreenPosition position) +launcher_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, + XfceScreenPosition position) { LauncherPlugin *plugin = LAUNCHER_PLUGIN (panel_plugin); /* set the new arrow direction */ xfce_arrow_button_set_arrow_type (XFCE_ARROW_BUTTON (plugin->arrow), - xfce_panel_plugin_arrow_type (panel_plugin)); + xfce_panel_plugin_arrow_type (panel_plugin)); /* destroy the menu to update sort order */ launcher_plugin_menu_destroy (plugin); @@ -1338,7 +1377,7 @@ static LauncherArrowType launcher_plugin_default_arrow_type (LauncherPlugin *plugin) { LauncherArrowType pos = plugin->arrow_position; - gboolean rtl; + gboolean rtl; panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), LAUNCHER_ARROW_NORTH); @@ -1347,8 +1386,7 @@ launcher_plugin_default_arrow_type (LauncherPlugin *plugin) /* get the plugin direction */ rtl = !!(gtk_widget_get_direction (GTK_WIDGET (plugin)) == GTK_TEXT_DIR_RTL); - if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == - GTK_ORIENTATION_HORIZONTAL) + if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_HORIZONTAL) pos = rtl ? LAUNCHER_ARROW_WEST : LAUNCHER_ARROW_EAST; else pos = rtl ? LAUNCHER_ARROW_NORTH : LAUNCHER_ARROW_SOUTH; @@ -1375,15 +1413,17 @@ launcher_plugin_pack_widgets (LauncherPlugin *plugin) panel_assert (pos != LAUNCHER_ARROW_DEFAULT); /* set the position of the arrow button in the box */ - gtk_box_set_child_packing (GTK_BOX (plugin->box), plugin->arrow, TRUE, TRUE, 0, - (pos == LAUNCHER_ARROW_SOUTH || pos == LAUNCHER_ARROW_EAST) ? GTK_PACK_END : GTK_PACK_START); - gtk_box_set_child_packing (GTK_BOX (plugin->box), plugin->button, FALSE, FALSE, 0, - (pos == LAUNCHER_ARROW_SOUTH || pos == LAUNCHER_ARROW_EAST) ? GTK_PACK_START : GTK_PACK_END); + gtk_box_set_child_packing ( + GTK_BOX (plugin->box), plugin->arrow, TRUE, TRUE, 0, + (pos == LAUNCHER_ARROW_SOUTH || pos == LAUNCHER_ARROW_EAST) ? GTK_PACK_END : GTK_PACK_START); + gtk_box_set_child_packing ( + GTK_BOX (plugin->box), plugin->button, FALSE, FALSE, 0, + (pos == LAUNCHER_ARROW_SOUTH || pos == LAUNCHER_ARROW_EAST) ? GTK_PACK_START : GTK_PACK_END); /* set the orientation */ - gtk_orientable_set_orientation (GTK_ORIENTABLE (plugin->box), - !!(pos == LAUNCHER_ARROW_WEST || pos == LAUNCHER_ARROW_EAST) ? - GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); + gtk_orientable_set_orientation ( + GTK_ORIENTABLE (plugin->box), + (pos == LAUNCHER_ARROW_WEST || pos == LAUNCHER_ARROW_EAST) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); } @@ -1411,7 +1451,7 @@ launcher_plugin_tooltip_icon (const gchar *icon_name) static void -launcher_plugin_menu_deactivate (GtkWidget *menu, +launcher_plugin_menu_deactivate (GtkWidget *menu, LauncherPlugin *plugin) { panel_return_if_fail (LAUNCHER_IS_PLUGIN (plugin)); @@ -1432,13 +1472,13 @@ launcher_plugin_menu_deactivate (GtkWidget *menu, static void -launcher_plugin_menu_item_activate (GtkMenuItem *widget, - GarconMenuItem *item) +launcher_plugin_menu_item_activate (GtkMenuItem *widget, + GarconMenuItem *item) { LauncherPlugin *plugin; - GdkScreen *screen; - GdkEvent *event; - guint32 event_time; + GdkScreen *screen; + GdkEvent *event; + guint32 event_time; panel_return_if_fail (GTK_IS_MENU_ITEM (widget)); panel_return_if_fail (GARCON_IS_MENU_ITEM (item)); @@ -1481,17 +1521,17 @@ launcher_plugin_menu_item_activate (GtkMenuItem *widget, static void -launcher_plugin_menu_item_drag_data_received (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *data, - guint info, - guint drag_time, - GarconMenuItem *item) +launcher_plugin_menu_item_drag_data_received (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *data, + guint info, + guint drag_time, + GarconMenuItem *item) { LauncherPlugin *plugin; - GSList *uri_list; + GSList *uri_list; panel_return_if_fail (GTK_IS_MENU_ITEM (widget)); panel_return_if_fail (GARCON_IS_MENU_ITEM (item)); @@ -1536,14 +1576,14 @@ launcher_plugin_menu_item_drag_data_received (GtkWidget *widget, static void launcher_plugin_menu_construct (LauncherPlugin *plugin) { - GtkArrowType arrow_type; - guint n; + GtkArrowType arrow_type; + guint n; GarconMenuItem *item; - GtkWidget *mi, *box, *label, *image; - GdkPixbuf *pixbuf; - const gchar *name, *icon_name; - GSList *li; - gint icon_size; + GtkWidget *mi, *box, *label, *image; + GdkPixbuf *pixbuf; + const gchar *name, *icon_name; + GSList *li; + gint icon_size; panel_return_if_fail (LAUNCHER_IS_PLUGIN (plugin)); panel_return_if_fail (plugin->menu == NULL); @@ -1582,22 +1622,22 @@ launcher_plugin_menu_construct (LauncherPlugin *plugin) gtk_drag_dest_set (mi, GTK_DEST_DEFAULT_ALL, drop_targets, G_N_ELEMENTS (drop_targets), GDK_ACTION_COPY); g_signal_connect (G_OBJECT (mi), "activate", - G_CALLBACK (launcher_plugin_menu_item_activate), item); + G_CALLBACK (launcher_plugin_menu_item_activate), item); g_signal_connect (G_OBJECT (mi), "drag-data-received", - G_CALLBACK (launcher_plugin_menu_item_drag_data_received), item); + G_CALLBACK (launcher_plugin_menu_item_drag_data_received), item); g_signal_connect (G_OBJECT (mi), "drag-leave", - G_CALLBACK (launcher_plugin_arrow_drag_leave), plugin); + G_CALLBACK (launcher_plugin_arrow_drag_leave), plugin); /* only connect the tooltip signal if tips are enabled */ if (!plugin->disable_tooltips) { gtk_widget_set_has_tooltip (mi, TRUE); g_signal_connect (G_OBJECT (mi), "query-tooltip", - G_CALLBACK (launcher_plugin_item_query_tooltip), item); + G_CALLBACK (launcher_plugin_item_query_tooltip), item); /* invalidate tooltip icon when needed */ g_signal_connect_object (gtk_icon_theme_get_default (), "changed", - G_CALLBACK (launcher_plugin_tooltip_icon_invalidate), mi, G_CONNECT_SWAPPED); + G_CALLBACK (launcher_plugin_tooltip_icon_invalidate), mi, G_CONNECT_SWAPPED); } /* depending on the menu position we prepend or append */ @@ -1646,7 +1686,7 @@ launcher_plugin_menu_construct (LauncherPlugin *plugin) static void launcher_plugin_menu_popup_destroyed (gpointer user_data) { - LAUNCHER_PLUGIN (user_data)->menu_timeout_id = 0; + LAUNCHER_PLUGIN (user_data)->menu_timeout_id = 0; } @@ -1655,8 +1695,8 @@ static gboolean launcher_plugin_menu_popup (gpointer user_data) { LauncherPlugin *plugin = LAUNCHER_PLUGIN (user_data); - gint x, y; - GdkEvent *event = NULL; + gint x, y; + GdkEvent *event = NULL; panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), FALSE); @@ -1743,10 +1783,10 @@ launcher_plugin_menu_destroy (LauncherPlugin *plugin) static void launcher_plugin_button_update (LauncherPlugin *plugin) { - GarconMenuItem *item = NULL; - const gchar *icon_name; - XfcePanelPluginMode mode; - gint icon_size; + GarconMenuItem *item = NULL; + const gchar *icon_name; + XfcePanelPluginMode mode; + gint icon_size; panel_return_if_fail (LAUNCHER_IS_PLUGIN (plugin)); @@ -1774,7 +1814,7 @@ launcher_plugin_button_update (LauncherPlugin *plugin) gtk_label_set_angle (GTK_LABEL (plugin->child), (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? 270 : 0); gtk_label_set_text (GTK_LABEL (plugin->child), - item != NULL ? garcon_menu_item_get_name (item) : _("No items")); + item != NULL ? garcon_menu_item_get_name (item) : _("No items")); } else if (G_LIKELY (item != NULL)) { @@ -1812,8 +1852,8 @@ launcher_plugin_button_update (LauncherPlugin *plugin) } panel_utils_set_atk_info (plugin->button, - garcon_menu_item_get_name (item), - garcon_menu_item_get_comment (item)); + garcon_menu_item_get_name (item), + garcon_menu_item_get_comment (item)); } else { @@ -1848,7 +1888,7 @@ static void launcher_plugin_button_update_action_menu (LauncherPlugin *plugin) { GarconMenuItem *item = NULL; - GList *list; + GList *list; panel_return_if_fail (LAUNCHER_IS_PLUGIN (plugin)); panel_return_if_fail (plugin->menu == NULL); @@ -1879,9 +1919,9 @@ launcher_plugin_button_update_action_menu (LauncherPlugin *plugin) static void -launcher_plugin_button_state_changed (GtkWidget *button_a, - GtkStateFlags state, - GtkWidget *button_b) +launcher_plugin_button_state_changed (GtkWidget *button_a, + GtkStateFlags state, + GtkWidget *button_b) { if (gtk_widget_get_state_flags (button_a) != gtk_widget_get_state_flags (button_b) && (gtk_widget_get_state_flags (button_a) & GTK_STATE_FLAG_INSENSITIVE)) @@ -1891,7 +1931,7 @@ launcher_plugin_button_state_changed (GtkWidget *button_a, static gboolean -launcher_plugin_button_press_event (GtkWidget *button, +launcher_plugin_button_press_event (GtkWidget *button, GdkEventButton *event, LauncherPlugin *plugin) { @@ -1919,11 +1959,10 @@ launcher_plugin_button_press_event (GtkWidget *button, && LIST_HAS_TWO_OR_MORE_ENTRIES (plugin->items)) { /* start the popup timeout */ - plugin->menu_timeout_id = - gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, - MENU_POPUP_DELAY, - launcher_plugin_menu_popup, plugin, - launcher_plugin_menu_popup_destroyed); + plugin->menu_timeout_id = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, + MENU_POPUP_DELAY, + launcher_plugin_menu_popup, plugin, + launcher_plugin_menu_popup_destroyed); } return FALSE; @@ -1932,12 +1971,12 @@ launcher_plugin_button_press_event (GtkWidget *button, static gboolean -launcher_plugin_button_release_event (GtkWidget *button, +launcher_plugin_button_release_event (GtkWidget *button, GdkEventButton *event, LauncherPlugin *plugin) { GarconMenuItem *item; - GdkScreen *screen; + GdkScreen *screen; panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), FALSE); @@ -1951,8 +1990,8 @@ launcher_plugin_button_release_event (GtkWidget *button, return FALSE; /* leave if button release happens outside of launcher */ - if (event->x < 0 || event->x > gdk_window_get_width (event->window) || - event->y < 0 || event->y > gdk_window_get_height (event->window)) + if (event->x < 0 || event->x > gdk_window_get_width (event->window) + || event->y < 0 || event->y > gdk_window_get_height (event->window)) return FALSE; /* get the menu item and the screen */ @@ -1973,11 +2012,11 @@ launcher_plugin_button_release_event (GtkWidget *button, static gboolean -launcher_plugin_button_query_tooltip (GtkWidget *widget, - gint x, - gint y, - gboolean keyboard_mode, - GtkTooltip *tooltip, +launcher_plugin_button_query_tooltip (GtkWidget *widget, + gint x, + gint y, + gboolean keyboard_mode, + GtkTooltip *tooltip, LauncherPlugin *plugin) { panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), FALSE); @@ -1995,14 +2034,14 @@ launcher_plugin_button_query_tooltip (GtkWidget *widget, static void -launcher_plugin_button_drag_data_received (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, +launcher_plugin_button_drag_data_received (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, GtkSelectionData *selection_data, - guint info, - guint drag_time, - LauncherPlugin *plugin) + guint info, + guint drag_time, + LauncherPlugin *plugin) { GSList *uri_list; @@ -2033,16 +2072,16 @@ launcher_plugin_button_drag_data_received (GtkWidget *widget, static GdkAtom launcher_plugin_supported_drop (GdkDragContext *context, - GtkWidget *widget) + GtkWidget *widget) { - GList *li; - GdkAtom target; - guint i; - GdkModifierType modifiers = 0; + GList *li; + GdkAtom target; + guint i; + GdkModifierType modifiers = 0; /* do not handle drops if control is pressed */ gdk_window_get_device_position (gtk_widget_get_window (widget), - gdk_drag_context_get_device(context), + gdk_drag_context_get_device (context), NULL, NULL, &modifiers); if (PANEL_HAS_FLAG (modifiers, GDK_CONTROL_MASK)) return GDK_NONE; @@ -2062,11 +2101,11 @@ launcher_plugin_supported_drop (GdkDragContext *context, static gboolean -launcher_plugin_button_drag_motion (GtkWidget *widget, +launcher_plugin_button_drag_motion (GtkWidget *widget, GdkDragContext *context, - gint x, - gint y, - guint drag_time, + gint x, + gint y, + guint drag_time, LauncherPlugin *plugin) { panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), FALSE); @@ -2098,11 +2137,11 @@ launcher_plugin_button_drag_motion (GtkWidget *widget, static gboolean -launcher_plugin_button_drag_drop (GtkWidget *widget, +launcher_plugin_button_drag_drop (GtkWidget *widget, GdkDragContext *context, - gint x, - gint y, - guint drag_time, + gint x, + gint y, + guint drag_time, LauncherPlugin *plugin) { GdkAtom target; @@ -2119,9 +2158,9 @@ launcher_plugin_button_drag_drop (GtkWidget *widget, static void -launcher_plugin_button_drag_leave (GtkWidget *widget, +launcher_plugin_button_drag_leave (GtkWidget *widget, GdkDragContext *context, - guint drag_time, + guint drag_time, LauncherPlugin *plugin) { panel_return_if_fail (LAUNCHER_IS_PLUGIN (plugin)); @@ -2136,16 +2175,16 @@ launcher_plugin_button_drag_leave (GtkWidget *widget, static gboolean -launcher_plugin_button_draw (GtkWidget *widget, - cairo_t *cr, +launcher_plugin_button_draw (GtkWidget *widget, + cairo_t *cr, LauncherPlugin *plugin) { - GtkArrowType arrow_type; - gdouble angle; - gint size, x, y, offset; - GtkAllocation allocation; - GtkStyleContext *ctx; - GtkBorder padding; + GtkArrowType arrow_type; + gdouble angle; + gint size, x, y, offset; + GtkAllocation allocation; + GtkStyleContext *ctx; + GtkBorder padding; panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), FALSE); @@ -2210,7 +2249,7 @@ launcher_plugin_arrow_visibility (LauncherPlugin *plugin) panel_return_if_fail (LAUNCHER_IS_PLUGIN (plugin)); if (plugin->arrow_position != LAUNCHER_ARROW_INTERNAL - && LIST_HAS_TWO_OR_MORE_ENTRIES (plugin->items)) + && LIST_HAS_TWO_OR_MORE_ENTRIES (plugin->items)) gtk_widget_show (plugin->arrow); else gtk_widget_hide (plugin->arrow); @@ -2219,7 +2258,7 @@ launcher_plugin_arrow_visibility (LauncherPlugin *plugin) static gboolean -launcher_plugin_arrow_press_event (GtkWidget *button, +launcher_plugin_arrow_press_event (GtkWidget *button, GdkEventButton *event, LauncherPlugin *plugin) { @@ -2237,13 +2276,12 @@ launcher_plugin_arrow_press_event (GtkWidget *button, - static gboolean -launcher_plugin_arrow_drag_motion (GtkWidget *widget, +launcher_plugin_arrow_drag_motion (GtkWidget *widget, GdkDragContext *context, - gint x, - gint y, - guint drag_time, + gint x, + gint y, + guint drag_time, LauncherPlugin *plugin) { panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), FALSE); @@ -2260,10 +2298,9 @@ launcher_plugin_arrow_drag_motion (GtkWidget *widget, gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->arrow), TRUE); /* start the popup timeout */ - plugin->menu_timeout_id = - gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, MENU_POPUP_DELAY, - launcher_plugin_menu_popup, plugin, - launcher_plugin_menu_popup_destroyed); + plugin->menu_timeout_id = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, MENU_POPUP_DELAY, + launcher_plugin_menu_popup, plugin, + launcher_plugin_menu_popup_destroyed); } return TRUE; @@ -2275,10 +2312,10 @@ static gboolean launcher_plugin_arrow_drag_leave_timeout (gpointer user_data) { LauncherPlugin *plugin = LAUNCHER_PLUGIN (user_data); - gint pointer_x, pointer_y; - GtkWidget *menu = plugin->menu; - gint menu_x, menu_y, menu_w, menu_h; - GdkDevice *device; + gint pointer_x, pointer_y; + GtkWidget *menu = plugin->menu; + gint menu_x, menu_y, menu_w, menu_h; + GdkDevice *device; panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), FALSE); panel_return_val_if_fail (menu == NULL || gtk_widget_get_has_window (menu), FALSE); @@ -2288,7 +2325,7 @@ launcher_plugin_arrow_drag_leave_timeout (gpointer user_data) return FALSE; /* leave if the menu is already hidden */ - if (! gtk_widget_get_visible (plugin->menu)) + if (!gtk_widget_get_visible (plugin->menu)) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->arrow), FALSE); return FALSE; @@ -2324,9 +2361,9 @@ launcher_plugin_arrow_drag_leave_timeout (gpointer user_data) static void -launcher_plugin_arrow_drag_leave (GtkWidget *widget, +launcher_plugin_arrow_drag_leave (GtkWidget *widget, GdkDragContext *context, - guint drag_time, + guint drag_time, LauncherPlugin *plugin) { panel_return_if_fail (LAUNCHER_IS_PLUGIN (plugin)); @@ -2369,11 +2406,11 @@ launcher_plugin_icon_invalidate (LauncherPlugin *plugin) static gboolean -launcher_plugin_item_query_tooltip (GtkWidget *widget, - gint x, - gint y, - gboolean keyboard_mode, - GtkTooltip *tooltip, +launcher_plugin_item_query_tooltip (GtkWidget *widget, + gint x, + gint y, + gboolean keyboard_mode, + GtkTooltip *tooltip, GarconMenuItem *item) { gchar *markup; @@ -2418,21 +2455,21 @@ launcher_plugin_item_query_tooltip (GtkWidget *widget, static gboolean launcher_plugin_item_exec_on_screen (GarconMenuItem *item, - guint32 event_time, - GdkScreen *screen, - GSList *uri_list) -{ - GError *error = NULL; - gchar **argv; - gboolean succeed = FALSE; - gchar *command, *uri; + guint32 event_time, + GdkScreen *screen, + GSList *uri_list) +{ + GError *error = NULL; + gchar **argv; + gboolean succeed = FALSE; + gchar *command, *uri; const gchar *icon; panel_return_val_if_fail (GARCON_IS_MENU_ITEM (item), FALSE); panel_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); /* get the command */ - command = (gchar*) garcon_menu_item_get_command (item); + command = (gchar *) garcon_menu_item_get_command (item); panel_return_val_if_fail (!xfce_str_is_empty (command), FALSE); /* expand the field codes */ @@ -2473,12 +2510,12 @@ launcher_plugin_item_exec_on_screen (GarconMenuItem *item, static void launcher_plugin_item_exec (GarconMenuItem *item, - guint32 event_time, - GdkScreen *screen, - GSList *uri_list) + guint32 event_time, + GdkScreen *screen, + GSList *uri_list) { - GSList *li, fake; - gboolean proceed = TRUE; + GSList *li, fake; + gboolean proceed = TRUE; const gchar *command; panel_return_if_fail (GARCON_IS_MENU_ITEM (item)); @@ -2490,8 +2527,8 @@ launcher_plugin_item_exec (GarconMenuItem *item, return; if (G_UNLIKELY (uri_list != NULL - && strstr (command, "%F") == NULL - && strstr (command, "%U") == NULL)) + && strstr (command, "%F") == NULL + && strstr (command, "%U") == NULL)) { fake.next = NULL; @@ -2512,11 +2549,11 @@ launcher_plugin_item_exec (GarconMenuItem *item, static void launcher_plugin_item_exec_from_clipboard (GarconMenuItem *item, - guint32 event_time, - GdkScreen *screen) + guint32 event_time, + GdkScreen *screen) { - GtkClipboard *clipboard; - gchar *text = NULL; + GtkClipboard *clipboard; + gchar *text = NULL; panel_return_if_fail (GARCON_IS_MENU_ITEM (item)); panel_return_if_fail (GDK_IS_SCREEN (screen)); @@ -2543,10 +2580,10 @@ launcher_plugin_item_exec_from_clipboard (GarconMenuItem *item, static GSList * launcher_plugin_uri_list_extract (GtkSelectionData *data) { - GSList *list = NULL; - gchar **array; - guint i; - gchar *uri; + GSList *list = NULL; + gchar **array; + guint i; + gchar *uri; /* leave if there is no data */ if (gtk_selection_data_get_length (data) <= 0) @@ -2611,7 +2648,7 @@ launcher_plugin_get_items (LauncherPlugin *plugin) panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), NULL); /* set extra reference and return a copy of the list */ - g_slist_foreach (plugin->items, (GFunc) (void (*)(void)) g_object_ref, NULL); + g_slist_foreach (plugin->items, (GFunc) (void (*) (void)) g_object_ref, NULL); return g_slist_copy (plugin->items); } @@ -2620,8 +2657,8 @@ launcher_plugin_get_items (LauncherPlugin *plugin) gchar * launcher_plugin_unique_filename (LauncherPlugin *plugin) { - gchar *filename, *path; - static guint counter = 0; + gchar *filename, *path; + static guint counter = 0; panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), NULL); @@ -2634,7 +2671,6 @@ launcher_plugin_unique_filename (LauncherPlugin *plugin) g_free (filename); return path; - } @@ -2643,10 +2679,10 @@ static void launcher_plugin_garcon_menu_pool_add (GarconMenu *menu, GHashTable *pool) { - GList *li, *items; - GList *menus; + GList *li, *items; + GList *menus; GarconMenuItem *item; - const gchar *desktop_id; + const gchar *desktop_id; panel_return_if_fail (GARCON_IS_MENU (menu)); @@ -2684,7 +2720,7 @@ launcher_plugin_garcon_menu_pool (void) { GHashTable *pool; GarconMenu *menu; - GError *error = NULL; + GError *error = NULL; /* always return a hash table, even if it's empty */ pool = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -2719,10 +2755,10 @@ launcher_plugin_garcon_menu_pool (void) gboolean launcher_plugin_item_is_editable (LauncherPlugin *plugin, GarconMenuItem *item, - gboolean *can_delete) + gboolean *can_delete) { - GFile *item_file; - gboolean editable = FALSE; + GFile *item_file; + gboolean editable = FALSE; GFileInfo *file_info; panel_return_val_if_fail (LAUNCHER_IS_PLUGIN (plugin), FALSE); @@ -2733,8 +2769,7 @@ launcher_plugin_item_is_editable (LauncherPlugin *plugin, goto out; file_info = g_file_query_info (item_file, - G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE "," - G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, + G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE "," G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, G_FILE_QUERY_INFO_NONE, NULL, NULL); if (G_LIKELY (file_info != NULL)) { diff --git a/plugins/launcher/launcher.h b/plugins/launcher/launcher.h index eb97b4c6d..1c37a423a 100644 --- a/plugins/launcher/launcher.h +++ b/plugins/launcher/launcher.h @@ -38,19 +38,25 @@ typedef enum _LauncherArrowType LAUNCHER_ARROW_INTERNAL } LauncherArrowType; -void launcher_plugin_register_type (XfcePanelTypeModule *type_module); +void +launcher_plugin_register_type (XfcePanelTypeModule *type_module); -GSList *launcher_plugin_get_items (LauncherPlugin *plugin); +GSList * +launcher_plugin_get_items (LauncherPlugin *plugin); -gchar *launcher_plugin_unique_filename (LauncherPlugin *plugin); +gchar * +launcher_plugin_unique_filename (LauncherPlugin *plugin); -GHashTable *launcher_plugin_garcon_menu_pool (void); +GHashTable * +launcher_plugin_garcon_menu_pool (void); -gboolean launcher_plugin_item_is_editable (LauncherPlugin *plugin, - GarconMenuItem *item, - gboolean *can_delete); +gboolean +launcher_plugin_item_is_editable (LauncherPlugin *plugin, + GarconMenuItem *item, + gboolean *can_delete); -GIcon *launcher_plugin_tooltip_icon (const gchar *icon_name); +GIcon * +launcher_plugin_tooltip_icon (const gchar *icon_name); G_END_DECLS diff --git a/plugins/pager/pager-buttons.c b/plugins/pager/pager-buttons.c index 220350024..f8ac5a7c4 100644 --- a/plugins/pager/pager-buttons.c +++ b/plugins/pager/pager-buttons.c @@ -28,50 +28,61 @@ -static void pager_buttons_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void pager_buttons_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void pager_buttons_finalize (GObject *object); -static void pager_buttons_queue_rebuild (PagerButtons *pager); -static void pager_buttons_screen_workspace_changed (XfwWorkspaceGroup *group, - XfwWorkspace *previous_workspace, - PagerButtons *pager); -static void pager_buttons_screen_workspace_created (XfwWorkspaceGroup *group, - XfwWorkspace *created_workspace, - PagerButtons *pager); -static void pager_buttons_screen_workspace_destroyed (XfwWorkspaceGroup *group, - XfwWorkspace *destroyed_workspace, - PagerButtons *pager); -static void pager_buttons_screen_viewports_changed (XfwWorkspaceGroup *group, - PagerButtons *pager); -static void pager_buttons_workspace_button_toggled (GtkWidget *button, - XfwWorkspace *workspace); -static void pager_buttons_workspace_button_label (XfwWorkspace *workspace, - GtkWidget *label); -static void pager_buttons_viewport_button_toggled (GtkWidget *button, - PagerButtons *pager); +static void +pager_buttons_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +pager_buttons_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +pager_buttons_finalize (GObject *object); +static void +pager_buttons_queue_rebuild (PagerButtons *pager); +static void +pager_buttons_screen_workspace_changed (XfwWorkspaceGroup *group, + XfwWorkspace *previous_workspace, + PagerButtons *pager); +static void +pager_buttons_screen_workspace_created (XfwWorkspaceGroup *group, + XfwWorkspace *created_workspace, + PagerButtons *pager); +static void +pager_buttons_screen_workspace_destroyed (XfwWorkspaceGroup *group, + XfwWorkspace *destroyed_workspace, + PagerButtons *pager); +static void +pager_buttons_screen_viewports_changed (XfwWorkspaceGroup *group, + PagerButtons *pager); +static void +pager_buttons_workspace_button_toggled (GtkWidget *button, + XfwWorkspace *workspace); +static void +pager_buttons_workspace_button_label (XfwWorkspace *workspace, + GtkWidget *label); +static void +pager_buttons_viewport_button_toggled (GtkWidget *button, + PagerButtons *pager); struct _PagerButtons { - GtkGrid __parent__; + GtkGrid __parent__; - GSList *buttons; + GSList *buttons; - guint rebuild_id; + guint rebuild_id; - XfwScreen *xfw_screen; + XfwScreen *xfw_screen; XfwWorkspaceGroup *workspace_group; - gint rows; - gboolean numbering; - GtkOrientation orientation; + gint rows; + gboolean numbering; + GtkOrientation orientation; }; enum @@ -108,31 +119,27 @@ pager_buttons_class_init (PagerButtonsClass *klass) g_object_class_install_property (gobject_class, PROP_SCREEN, - g_param_spec_object ("screen", - NULL, NULL, - XFW_TYPE_SCREEN, - G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS - | G_PARAM_CONSTRUCT_ONLY)); + g_param_spec_object ("screen", NULL, NULL, + XFW_TYPE_SCREEN, + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS + | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (gobject_class, PROP_ROWS, - g_param_spec_int ("rows", - NULL, NULL, + g_param_spec_int ("rows", NULL, NULL, 1, 100, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ORIENTATION, - g_param_spec_enum ("orientation", - NULL, NULL, - GTK_TYPE_ORIENTATION, - GTK_ORIENTATION_HORIZONTAL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_param_spec_enum ("orientation", NULL, NULL, + GTK_TYPE_ORIENTATION, + GTK_ORIENTATION_HORIZONTAL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_NUMBERING, - g_param_spec_boolean ("numbering", - NULL, NULL, + g_param_spec_boolean ("numbering", NULL, NULL, FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } @@ -159,9 +166,9 @@ pager_buttons_init (PagerButtons *pager) static void -pager_buttons_get_property (GObject *object, - guint prop_id, - GValue *value, +pager_buttons_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { PagerButtons *pager = PAGER_BUTTONS (object); @@ -189,10 +196,10 @@ pager_buttons_get_property (GObject *object, static void -pager_buttons_set_property (GObject *object, - guint prop_id, +pager_buttons_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { PagerButtons *pager = PAGER_BUTTONS (object); XfwWorkspaceManager *manager; @@ -206,13 +213,13 @@ pager_buttons_set_property (GObject *object, pager->workspace_group = xfw_workspace_manager_list_workspace_groups (manager)->data; g_signal_connect (G_OBJECT (pager->workspace_group), "active-workspace-changed", - G_CALLBACK (pager_buttons_screen_workspace_changed), pager); + G_CALLBACK (pager_buttons_screen_workspace_changed), pager); g_signal_connect (G_OBJECT (pager->workspace_group), "workspace-added", - G_CALLBACK (pager_buttons_screen_workspace_created), pager); + G_CALLBACK (pager_buttons_screen_workspace_created), pager); g_signal_connect (G_OBJECT (pager->workspace_group), "workspace-removed", - G_CALLBACK (pager_buttons_screen_workspace_destroyed), pager); + G_CALLBACK (pager_buttons_screen_workspace_destroyed), pager); g_signal_connect (G_OBJECT (pager->workspace_group), "viewports-changed", - G_CALLBACK (pager_buttons_screen_viewports_changed), pager); + G_CALLBACK (pager_buttons_screen_viewports_changed), pager); pager_buttons_queue_rebuild (pager); break; @@ -248,13 +255,13 @@ pager_buttons_finalize (GObject *object) if (G_LIKELY (pager->xfw_screen != NULL)) { g_signal_handlers_disconnect_by_func (G_OBJECT (pager->workspace_group), - G_CALLBACK (pager_buttons_screen_workspace_changed), pager); + G_CALLBACK (pager_buttons_screen_workspace_changed), pager); g_signal_handlers_disconnect_by_func (G_OBJECT (pager->workspace_group), - G_CALLBACK (pager_buttons_screen_workspace_created), pager); + G_CALLBACK (pager_buttons_screen_workspace_created), pager); g_signal_handlers_disconnect_by_func (G_OBJECT (pager->workspace_group), - G_CALLBACK (pager_buttons_screen_workspace_destroyed), pager); + G_CALLBACK (pager_buttons_screen_workspace_destroyed), pager); g_signal_handlers_disconnect_by_func (G_OBJECT (pager->workspace_group), - G_CALLBACK (pager_buttons_screen_viewports_changed), pager); + G_CALLBACK (pager_buttons_screen_viewports_changed), pager); g_object_unref (G_OBJECT (pager->xfw_screen)); } @@ -267,7 +274,7 @@ pager_buttons_finalize (GObject *object) static gboolean -pager_buttons_button_press_event (GtkWidget *button, +pager_buttons_button_press_event (GtkWidget *button, GdkEventButton *event) { guint modifiers; @@ -290,30 +297,30 @@ pager_buttons_button_press_event (GtkWidget *button, static gboolean pager_buttons_rebuild_idle (gpointer user_data) { - PagerButtons *pager = PAGER_BUTTONS (user_data); - GList *li, *workspaces; - XfwWorkspace *active_ws; - gint n, n_workspaces; - gint rows, cols; - gint row, col; - GtkWidget *button; - XfwWorkspace *workspace = NULL; - GtkWidget *panel_plugin; - GtkWidget *label; - gint screen_width = 0, screen_height = 0; - gboolean viewport_mode = FALSE; - gint n_viewports = 0; - gint *vp_info; - gchar text[8]; - GdkRectangle *rect = NULL; - GdkScreen *screen; - guint scale_factor; + PagerButtons *pager = PAGER_BUTTONS (user_data); + GList *li, *workspaces; + XfwWorkspace *active_ws; + gint n, n_workspaces; + gint rows, cols; + gint row, col; + GtkWidget *button; + XfwWorkspace *workspace = NULL; + GtkWidget *panel_plugin; + GtkWidget *label; + gint screen_width = 0, screen_height = 0; + gboolean viewport_mode = FALSE; + gint n_viewports = 0; + gint *vp_info; + gchar text[8]; + GdkRectangle *rect = NULL; + GdkScreen *screen; + guint scale_factor; panel_return_val_if_fail (PAGER_IS_BUTTONS (pager), FALSE); panel_return_val_if_fail (XFW_IS_SCREEN (pager->xfw_screen), FALSE); gtk_container_foreach (GTK_CONTAINER (pager), - (GtkCallback) (void (*)(void)) gtk_widget_destroy, NULL); + (GtkCallback) (void (*) (void)) gtk_widget_destroy, NULL); g_slist_free (pager->buttons); pager->buttons = NULL; @@ -327,7 +334,7 @@ pager_buttons_rebuild_idle (gpointer user_data) /* check if the user uses 1 workspace with viewports */ if (G_UNLIKELY (n_workspaces == 1 - && xfw_workspace_get_state (workspaces->data) & XFW_WORKSPACE_STATE_VIRTUAL)) + && xfw_workspace_get_state (workspaces->data) & XFW_WORKSPACE_STATE_VIRTUAL)) { workspace = XFW_WORKSPACE (workspaces->data); rect = xfw_workspace_get_geometry (workspace); @@ -359,7 +366,7 @@ pager_buttons_rebuild_idle (gpointer user_data) } else { - workspace_layout: +workspace_layout: rows = CLAMP (1, pager->rows, n_workspaces); cols = n_workspaces / rows; @@ -389,9 +396,9 @@ pager_buttons_rebuild_idle (gpointer user_data) && rect->y >= vp_info[VIEWPORT_Y] && rect->y < vp_info[VIEWPORT_Y] + screen_height) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); g_signal_connect (G_OBJECT (button), "toggled", - G_CALLBACK (pager_buttons_viewport_button_toggled), pager); + G_CALLBACK (pager_buttons_viewport_button_toggled), pager); g_signal_connect (G_OBJECT (button), "button-press-event", - G_CALLBACK (pager_buttons_button_press_event), NULL); + G_CALLBACK (pager_buttons_button_press_event), NULL); xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (panel_plugin), button); gtk_widget_show (button); @@ -401,7 +408,7 @@ pager_buttons_rebuild_idle (gpointer user_data) g_snprintf (text, sizeof (text), "%d", n + 1); label = gtk_label_new (text); gtk_label_set_angle (GTK_LABEL (label), - pager->orientation == GTK_ORIENTATION_HORIZONTAL ? 0 : 270); + pager->orientation == GTK_ORIENTATION_HORIZONTAL ? 0 : 270); gtk_container_add (GTK_CONTAINER (button), label); gtk_widget_show (label); @@ -431,19 +438,19 @@ pager_buttons_rebuild_idle (gpointer user_data) if (workspace == active_ws) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); g_signal_connect (G_OBJECT (button), "toggled", - G_CALLBACK (pager_buttons_workspace_button_toggled), workspace); + G_CALLBACK (pager_buttons_workspace_button_toggled), workspace); g_signal_connect (G_OBJECT (button), "button-press-event", - G_CALLBACK (pager_buttons_button_press_event), NULL); + G_CALLBACK (pager_buttons_button_press_event), NULL); xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (panel_plugin), button); gtk_widget_show (button); label = gtk_label_new (NULL); g_object_set_data (G_OBJECT (label), "numbering", GINT_TO_POINTER (pager->numbering)); g_signal_connect_object (G_OBJECT (workspace), "name-changed", - G_CALLBACK (pager_buttons_workspace_button_label), label, 0); + G_CALLBACK (pager_buttons_workspace_button_label), label, 0); pager_buttons_workspace_button_label (workspace, label); gtk_label_set_angle (GTK_LABEL (label), - pager->orientation == GTK_ORIENTATION_HORIZONTAL ? 0 : 270); + pager->orientation == GTK_ORIENTATION_HORIZONTAL ? 0 : 270); gtk_container_add (GTK_CONTAINER (button), label); gtk_widget_show (label); @@ -467,7 +474,7 @@ pager_buttons_rebuild_idle (gpointer user_data) pager->buttons = g_slist_reverse (pager->buttons); - leave: +leave: return FALSE; } @@ -501,9 +508,9 @@ pager_buttons_screen_workspace_changed (XfwWorkspaceGroup *group, XfwWorkspace *previous_workspace, PagerButtons *pager) { - gint active = -1, n; - XfwWorkspace *active_ws; - GSList *li; + gint active = -1, n; + XfwWorkspace *active_ws; + GSList *li; panel_return_if_fail (XFW_IS_WORKSPACE_GROUP (group)); panel_return_if_fail (previous_workspace == NULL || XFW_IS_WORKSPACE (previous_workspace)); @@ -571,8 +578,8 @@ pager_buttons_workspace_button_label (XfwWorkspace *workspace, GtkWidget *label) { const gchar *name; - gchar *utf8 = NULL, *name_fallback = NULL, *name_num = NULL; - gboolean numbering; + gchar *utf8 = NULL, *name_fallback = NULL, *name_num = NULL; + gboolean numbering; panel_return_if_fail (XFW_IS_WORKSPACE (workspace)); panel_return_if_fail (GTK_IS_LABEL (label)); @@ -604,8 +611,8 @@ pager_buttons_workspace_button_label (XfwWorkspace *workspace, static void -pager_buttons_workspace_button_toggled (GtkWidget *button, - XfwWorkspace *workspace) +pager_buttons_workspace_button_toggled (GtkWidget *button, + XfwWorkspace *workspace) { PagerButtons *pager; XfwWorkspace *active_ws; @@ -625,7 +632,7 @@ pager_buttons_workspace_button_toggled (GtkWidget *button, static void -pager_buttons_viewport_button_toggled (GtkWidget *button, +pager_buttons_viewport_button_toggled (GtkWidget *button, PagerButtons *pager) { gint *vp_info; @@ -656,13 +663,13 @@ pager_buttons_new (XfwScreen *screen) void -pager_buttons_set_orientation (PagerButtons *pager, - GtkOrientation orientation) +pager_buttons_set_orientation (PagerButtons *pager, + GtkOrientation orientation) { panel_return_if_fail (PAGER_IS_BUTTONS (pager)); if (pager->orientation == orientation) - return; + return; pager->orientation = orientation; pager_buttons_queue_rebuild (pager); @@ -672,12 +679,12 @@ pager_buttons_set_orientation (PagerButtons *pager, void pager_buttons_set_n_rows (PagerButtons *pager, - gint rows) + gint rows) { panel_return_if_fail (PAGER_IS_BUTTONS (pager)); if (pager->rows == rows) - return; + return; pager->rows = rows; pager_buttons_queue_rebuild (pager); @@ -687,12 +694,12 @@ pager_buttons_set_n_rows (PagerButtons *pager, void pager_buttons_set_numbering (PagerButtons *pager, - gboolean numbering) + gboolean numbering) { panel_return_if_fail (PAGER_IS_BUTTONS (pager)); if (pager->numbering == numbering) - return; + return; pager->numbering = numbering; pager_buttons_queue_rebuild (pager); diff --git a/plugins/pager/pager-buttons.h b/plugins/pager/pager-buttons.h index f15d3515b..5ddef7e5c 100644 --- a/plugins/pager/pager-buttons.h +++ b/plugins/pager/pager-buttons.h @@ -29,18 +29,23 @@ G_BEGIN_DECLS #define PAGER_TYPE_BUTTONS (pager_buttons_get_type ()) G_DECLARE_FINAL_TYPE (PagerButtons, pager_buttons, PAGER, BUTTONS, XfcePanelPlugin) -void pager_buttons_register_type (XfcePanelTypeModule *type_module); +void +pager_buttons_register_type (XfcePanelTypeModule *type_module); -GtkWidget *pager_buttons_new (XfwScreen *screen) G_GNUC_MALLOC; +GtkWidget * +pager_buttons_new (XfwScreen *screen) G_GNUC_MALLOC; -void pager_buttons_set_orientation (PagerButtons *pager, - GtkOrientation orientation); +void +pager_buttons_set_orientation (PagerButtons *pager, + GtkOrientation orientation); -void pager_buttons_set_n_rows (PagerButtons *pager, - gint rows); +void +pager_buttons_set_n_rows (PagerButtons *pager, + gint rows); -void pager_buttons_set_numbering (PagerButtons *pager, - gboolean numbering); +void +pager_buttons_set_numbering (PagerButtons *pager, + gboolean numbering); G_END_DECLS diff --git a/plugins/pager/pager.c b/plugins/pager/pager.c index a2a7d1200..4f644062b 100644 --- a/plugins/pager/pager.c +++ b/plugins/pager/pager.c @@ -44,53 +44,72 @@ -static void pager_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void pager_plugin_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static gboolean pager_plugin_scroll_event (GtkWidget *widget, - GdkEventScroll *event); +static void +pager_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +pager_plugin_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static gboolean +pager_plugin_scroll_event (GtkWidget *widget, + GdkEventScroll *event); #ifdef ENABLE_X11 -static void pager_plugin_drag_begin_event (GtkWidget *widget, - GdkDragContext *context, - gpointer user_data); -static void pager_plugin_drag_end_event (GtkWidget *widget, - GdkDragContext *context, - gpointer user_data); +static void +pager_plugin_drag_begin_event (GtkWidget *widget, + GdkDragContext *context, + gpointer user_data); +static void +pager_plugin_drag_end_event (GtkWidget *widget, + GdkDragContext *context, + gpointer user_data); #endif -static void pager_plugin_screen_changed (GtkWidget *widget, - GdkScreen *previous_screen); -static void pager_plugin_construct (XfcePanelPlugin *panel_plugin); -static void pager_plugin_style_updated (GtkWidget *pager, - gpointer user_data); -static void pager_plugin_free_data (XfcePanelPlugin *panel_plugin); -static gboolean pager_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); -static void pager_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode); -static void pager_plugin_configure_workspace_settings (GtkWidget *button); -static void pager_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); -static gpointer pager_plugin_get_master_plugin (PagerPlugin *plugin); -static void pager_plugin_screen_layout_changed (PagerPlugin *plugin, - gpointer screen); -static void pager_plugin_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static void pager_plugin_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height); -static void pager_plugin_get_preferred_width_for_height (GtkWidget *widget, - gint height, - gint *minimum_width, - gint *natural_width); -static void pager_plugin_get_preferred_height_for_width (GtkWidget *widget, - gint width, - gint *minimum_height, - gint *natural_height); +static void +pager_plugin_screen_changed (GtkWidget *widget, + GdkScreen *previous_screen); +static void +pager_plugin_construct (XfcePanelPlugin *panel_plugin); +static void +pager_plugin_style_updated (GtkWidget *pager, + gpointer user_data); +static void +pager_plugin_free_data (XfcePanelPlugin *panel_plugin); +static gboolean +pager_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); +static void +pager_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode); +static void +pager_plugin_configure_workspace_settings (GtkWidget *button); +static void +pager_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); +static gpointer +pager_plugin_get_master_plugin (PagerPlugin *plugin); +static void +pager_plugin_screen_layout_changed (PagerPlugin *plugin, + gpointer screen); +static void +pager_plugin_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width); +static void +pager_plugin_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height); +static void +pager_plugin_get_preferred_width_for_height (GtkWidget *widget, + gint height, + gint *minimum_width, + gint *natural_width); +static void +pager_plugin_get_preferred_height_for_width (GtkWidget *widget, + gint width, + gint *minimum_height, + gint *natural_height); @@ -98,27 +117,27 @@ struct _PagerPlugin { XfcePanelPlugin __parent__; - GtkWidget *pager; + GtkWidget *pager; - XfwScreen *xfw_screen; + XfwScreen *xfw_screen; XfwWorkspaceGroup *workspace_group; #ifdef ENABLE_X11 -#if WNCK_CHECK_VERSION (43, 0, 0) - WnckHandle *wnck_handle; +#if WNCK_CHECK_VERSION(43, 0, 0) + WnckHandle *wnck_handle; #endif #endif /* settings */ - guint scrolling : 1; - guint wrap_workspaces : 1; - guint miniature_view : 1; - guint rows; - gboolean numbering; - gfloat ratio; + guint scrolling : 1; + guint wrap_workspaces : 1; + guint miniature_view : 1; + guint rows; + gboolean numbering; + gfloat ratio; /* synchronize plugin with master plugin which manages workspace layout */ - guint sync_idle_id; - gboolean sync_wait; + guint sync_idle_id; + gboolean sync_wait; }; enum @@ -143,8 +162,8 @@ static void pager_plugin_class_init (PagerPluginClass *klass) { XfcePanelPluginClass *plugin_class; - GObjectClass *gobject_class; - GtkWidgetClass *widget_class; + GObjectClass *gobject_class; + GtkWidgetClass *widget_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->get_property = pager_plugin_get_property; @@ -153,9 +172,9 @@ pager_plugin_class_init (PagerPluginClass *klass) widget_class = GTK_WIDGET_CLASS (klass); widget_class->scroll_event = pager_plugin_scroll_event; widget_class->get_preferred_width = pager_plugin_get_preferred_width; - widget_class->get_preferred_width_for_height = pager_plugin_get_preferred_width_for_height; + widget_class->get_preferred_width_for_height = pager_plugin_get_preferred_width_for_height; widget_class->get_preferred_height = pager_plugin_get_preferred_height; - widget_class->get_preferred_height_for_width = pager_plugin_get_preferred_height_for_width; + widget_class->get_preferred_height_for_width = pager_plugin_get_preferred_height_for_width; plugin_class = XFCE_PANEL_PLUGIN_CLASS (klass); plugin_class->construct = pager_plugin_construct; @@ -217,7 +236,7 @@ pager_plugin_init (PagerPlugin *plugin) plugin->sync_idle_id = 0; plugin->sync_wait = TRUE; #ifdef ENABLE_X11 -#if WNCK_CHECK_VERSION (43, 0, 0) +#if WNCK_CHECK_VERSION(43, 0, 0) if (WINDOWING_IS_X11 ()) plugin->wnck_handle = wnck_handle_new (WNCK_CLIENT_TYPE_PAGER); #endif @@ -235,9 +254,9 @@ pager_plugin_init (PagerPlugin *plugin) static void -pager_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, +pager_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { PagerPlugin *plugin = PAGER_PLUGIN (object); @@ -273,13 +292,13 @@ pager_plugin_get_property (GObject *object, static void -pager_plugin_set_property (GObject *object, - guint prop_id, +pager_plugin_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { PagerPlugin *plugin = PAGER_PLUGIN (object), *master_plugin; - guint rows; + guint rows; switch (prop_id) { @@ -355,14 +374,14 @@ pager_plugin_set_property (GObject *object, static void pager_plugin_style_updated (GtkWidget *pager, - gpointer user_data) + gpointer user_data) { - GtkWidget *toplevel = gtk_widget_get_toplevel (pager); - GtkStyleContext *context; - GtkCssProvider *provider; - GdkRGBA *bg_color; - gchar *css_string; - gchar *color_string; + GtkWidget *toplevel = gtk_widget_get_toplevel (pager); + GtkStyleContext *context; + GtkCssProvider *provider; + GdkRGBA *bg_color; + gchar *css_string; + gchar *color_string; g_return_if_fail (gtk_widget_is_toplevel (toplevel)); @@ -372,7 +391,7 @@ pager_plugin_style_updated (GtkWidget *pager, gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL, GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &bg_color, NULL); - color_string = gdk_rgba_to_string(bg_color); + color_string = gdk_rgba_to_string (bg_color); // FIXME: The shade value only works well visually for bright themes/panels css_string = g_strdup_printf ("wnck-pager { background: %s; }" "wnck-pager:selected { background: shade(%s, 0.7); }" @@ -381,8 +400,8 @@ pager_plugin_style_updated (GtkWidget *pager, context = gtk_widget_get_style_context (pager); gtk_css_provider_load_from_data (provider, css_string, -1, NULL); gtk_style_context_add_provider (context, - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_THEME); + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_THEME); gdk_rgba_free (bg_color); g_free (color_string); g_free (css_string); @@ -392,20 +411,20 @@ pager_plugin_style_updated (GtkWidget *pager, static gboolean -pager_plugin_scroll_event (GtkWidget *widget, +pager_plugin_scroll_event (GtkWidget *widget, GdkEventScroll *event) { - PagerPlugin *plugin = PAGER_PLUGIN (widget); - XfwWorkspace *active_ws; - XfwWorkspace *new_ws; - gint active_n; - gint n_workspaces; - GdkScrollDirection scrolling_direction; + PagerPlugin *plugin = PAGER_PLUGIN (widget); + XfwWorkspace *active_ws; + XfwWorkspace *new_ws; + gint active_n; + gint n_workspaces; + GdkScrollDirection scrolling_direction; panel_return_val_if_fail (XFW_IS_SCREEN (plugin->xfw_screen), FALSE); /* leave when scrolling is not enabled */ - if (! plugin->scrolling) + if (!plugin->scrolling) return TRUE; if (event->direction != GDK_SCROLL_SMOOTH) @@ -436,18 +455,18 @@ pager_plugin_scroll_event (GtkWidget *widget, n_workspaces = xfw_workspace_group_get_workspace_count (plugin->workspace_group) - 1; if (plugin->wrap_workspaces) - { - /* wrap around */ - if (active_n < 0) - active_n = n_workspaces; - else if (active_n > n_workspaces) - active_n = 0; - } - else if (active_n < 0 || active_n > n_workspaces ) - { - /* we do not need to do anything */ - return TRUE; - } + { + /* wrap around */ + if (active_n < 0) + active_n = n_workspaces; + else if (active_n > n_workspaces) + active_n = 0; + } + else if (active_n < 0 || active_n > n_workspaces) + { + /* we do not need to do anything */ + return TRUE; + } new_ws = g_list_nth_data (xfw_workspace_group_list_workspaces (plugin->workspace_group), active_n); if (new_ws != NULL && active_ws != new_ws) @@ -460,9 +479,9 @@ pager_plugin_scroll_event (GtkWidget *widget, #ifdef ENABLE_X11 static void -pager_plugin_drag_begin_event (GtkWidget *widget, +pager_plugin_drag_begin_event (GtkWidget *widget, GdkDragContext *context, - gpointer user_data) + gpointer user_data) { PagerPlugin *plugin = user_data; @@ -473,9 +492,9 @@ pager_plugin_drag_begin_event (GtkWidget *widget, static void -pager_plugin_drag_end_event (GtkWidget *widget, +pager_plugin_drag_end_event (GtkWidget *widget, GdkDragContext *context, - gpointer user_data) + gpointer user_data) { PagerPlugin *plugin = user_data; @@ -537,7 +556,7 @@ pager_plugin_screen_layout_changed_idle (gpointer data) /* changing workspace layout in buttons-view is delayed twice: in our code * and in Libwnck code */ master_plugin = pager_plugin_get_master_plugin (plugin); - if (! master_plugin->miniature_view && plugin->sync_wait) + if (!master_plugin->miniature_view && plugin->sync_wait) { plugin->sync_wait = FALSE; return TRUE; @@ -557,7 +576,7 @@ pager_plugin_screen_layout_changed (PagerPlugin *plugin, gpointer screen) { XfcePanelPluginMode mode; - GtkOrientation orientation; + GtkOrientation orientation; panel_return_if_fail (PAGER_IS_PLUGIN (plugin)); panel_return_if_fail (XFW_IS_SCREEN (plugin->xfw_screen)); @@ -567,8 +586,8 @@ pager_plugin_screen_layout_changed (PagerPlugin *plugin, if ((plugin != pager_plugin_get_master_plugin (plugin) || screen != NULL) && plugin->sync_idle_id == 0) { - plugin->sync_idle_id = - g_idle_add_full (G_PRIORITY_LOW, pager_plugin_screen_layout_changed_idle, plugin, NULL); + plugin->sync_idle_id = g_idle_add_full ( + G_PRIORITY_LOW, pager_plugin_screen_layout_changed_idle, plugin, NULL); return; } @@ -576,16 +595,15 @@ pager_plugin_screen_layout_changed (PagerPlugin *plugin, gtk_widget_destroy (GTK_WIDGET (plugin->pager)); mode = xfce_panel_plugin_get_mode (XFCE_PANEL_PLUGIN (plugin)); - orientation = - (mode != XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? - GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL; + orientation = (mode != XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? GTK_ORIENTATION_HORIZONTAL + : GTK_ORIENTATION_VERTICAL; #ifdef ENABLE_X11 if (plugin->miniature_view) { pager_plugin_set_ratio (plugin); -#if WNCK_CHECK_VERSION (43, 0, 0) +#if WNCK_CHECK_VERSION(43, 0, 0) /* using a handle allows in particular the pager not to be affected by a possible * change of default wnck icon size in other plugins */ plugin->pager = wnck_pager_new_with_handle (plugin->wnck_handle); @@ -623,7 +641,7 @@ pager_plugin_screen_layout_changed (PagerPlugin *plugin, created widget. Otherwise it may sometimes end up transparent. */ pager_plugin_style_updated (plugin->pager, NULL); g_signal_connect (G_OBJECT (plugin->pager), "style-updated", - G_CALLBACK (pager_plugin_style_updated), NULL); + G_CALLBACK (pager_plugin_style_updated), NULL); } @@ -652,13 +670,13 @@ pager_plugin_screen_changed (GtkWidget *widget, screen = gdk_screen_get_default (); g_signal_connect_object (G_OBJECT (screen), "monitors-changed", - G_CALLBACK (pager_plugin_screen_layout_changed), plugin, G_CONNECT_SWAPPED); + G_CALLBACK (pager_plugin_screen_layout_changed), plugin, G_CONNECT_SWAPPED); g_signal_connect_object (G_OBJECT (screen), "size-changed", - G_CALLBACK (pager_plugin_screen_layout_changed), plugin, G_CONNECT_SWAPPED); + G_CALLBACK (pager_plugin_screen_layout_changed), plugin, G_CONNECT_SWAPPED); g_signal_connect_object (G_OBJECT (xfw_screen), "window-manager-changed", - G_CALLBACK (pager_plugin_screen_layout_changed), plugin, G_CONNECT_SWAPPED); + G_CALLBACK (pager_plugin_screen_layout_changed), plugin, G_CONNECT_SWAPPED); g_signal_connect_object (G_OBJECT (plugin->workspace_group), "viewports-changed", - G_CALLBACK (pager_plugin_screen_layout_changed), plugin, G_CONNECT_SWAPPED); + G_CALLBACK (pager_plugin_screen_layout_changed), plugin, G_CONNECT_SWAPPED); } else g_object_unref (xfw_screen); @@ -669,10 +687,9 @@ pager_plugin_screen_changed (GtkWidget *widget, static void pager_plugin_construct (XfcePanelPlugin *panel_plugin) { - PagerPlugin *plugin = PAGER_PLUGIN (panel_plugin); - GtkWidget *mi, *image; - const PanelProperty properties[] = - { + PagerPlugin *plugin = PAGER_PLUGIN (panel_plugin); + GtkWidget *mi, *image; + const PanelProperty properties[] = { { "workspace-scrolling", G_TYPE_BOOLEAN }, { "wrap-workspaces", G_TYPE_BOOLEAN }, { "miniature-view", G_TYPE_BOOLEAN }, @@ -686,7 +703,7 @@ pager_plugin_construct (XfcePanelPlugin *panel_plugin) mi = panel_image_menu_item_new_with_mnemonic (_("Workspace _Settings...")); xfce_panel_plugin_menu_insert_item (panel_plugin, GTK_MENU_ITEM (mi)); g_signal_connect (G_OBJECT (mi), "activate", - G_CALLBACK (pager_plugin_configure_workspace_settings), NULL); + G_CALLBACK (pager_plugin_configure_workspace_settings), NULL); gtk_widget_show (mi); image = gtk_image_new_from_icon_name ("org.xfce.panel.pager", GTK_ICON_SIZE_MENU); @@ -699,7 +716,7 @@ pager_plugin_construct (XfcePanelPlugin *panel_plugin) pager_plugin_screen_changed (GTK_WIDGET (plugin), NULL); g_signal_connect (G_OBJECT (plugin), "screen-changed", - G_CALLBACK (pager_plugin_screen_changed), NULL); + G_CALLBACK (pager_plugin_screen_changed), NULL); } @@ -709,11 +726,10 @@ pager_plugin_free_data (XfcePanelPlugin *panel_plugin) { PagerPlugin *plugin = PAGER_PLUGIN (panel_plugin); - g_signal_handlers_disconnect_by_func (G_OBJECT (plugin), - pager_plugin_screen_changed, NULL); + g_signal_handlers_disconnect_by_func (G_OBJECT (plugin), pager_plugin_screen_changed, NULL); #ifdef ENABLE_X11 -#if WNCK_CHECK_VERSION (43, 0, 0) +#if WNCK_CHECK_VERSION(43, 0, 0) if (plugin->wnck_handle != NULL) g_object_unref (plugin->wnck_handle); #endif @@ -730,7 +746,7 @@ pager_plugin_free_data (XfcePanelPlugin *panel_plugin) static gboolean pager_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { gtk_widget_queue_resize (GTK_WIDGET (panel_plugin)); @@ -741,18 +757,17 @@ pager_plugin_size_changed (XfcePanelPlugin *panel_plugin, static void -pager_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode) +pager_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode) { - PagerPlugin *plugin = PAGER_PLUGIN (panel_plugin); - GtkOrientation orientation; + PagerPlugin *plugin = PAGER_PLUGIN (panel_plugin); + GtkOrientation orientation; if (plugin->pager == NULL) return; - orientation = - (mode != XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? - GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL; + orientation = (mode != XFCE_PANEL_PLUGIN_MODE_VERTICAL) ? GTK_ORIENTATION_HORIZONTAL + : GTK_ORIENTATION_VERTICAL; #ifdef ENABLE_X11 if (plugin->miniature_view) @@ -768,7 +783,7 @@ static void pager_plugin_configure_workspace_settings (GtkWidget *button) { GdkScreen *screen; - GError *error = NULL; + GError *error = NULL; GtkWidget *toplevel; panel_return_if_fail (GTK_IS_WIDGET (button)); @@ -784,7 +799,7 @@ pager_plugin_configure_workspace_settings (GtkWidget *button) /* show an error dialog */ toplevel = gtk_widget_get_toplevel (button); xfce_dialog_show_error (GTK_WINDOW (toplevel), error, - _("Unable to open the workspace settings")); + _("Unable to open the workspace settings")); g_error_free (error); } } @@ -811,8 +826,8 @@ pager_plugin_configure_n_workspaces_changed (XfwWorkspaceGroup *group, static void -pager_plugin_configure_destroyed (gpointer data, - GObject *where_the_object_was) +pager_plugin_configure_destroyed (gpointer data, + GObject *where_the_object_was) { PagerPlugin *plugin = PAGER_PLUGIN (data); @@ -827,8 +842,8 @@ static void pager_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) { PagerPlugin *plugin = PAGER_PLUGIN (panel_plugin); - GtkBuilder *builder; - GObject *dialog, *object; + GtkBuilder *builder; + GObject *dialog, *object; panel_return_if_fail (PAGER_IS_PLUGIN (plugin)); @@ -840,15 +855,15 @@ pager_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) /* signals to monitor number of workspace changes */ g_signal_connect (G_OBJECT (plugin->workspace_group), "workspace-added", - G_CALLBACK (pager_plugin_configure_n_workspaces_changed), builder); + G_CALLBACK (pager_plugin_configure_n_workspaces_changed), builder); g_signal_connect (G_OBJECT (plugin->workspace_group), "workspace-removed", - G_CALLBACK (pager_plugin_configure_n_workspaces_changed), builder); + G_CALLBACK (pager_plugin_configure_n_workspaces_changed), builder); g_object_weak_ref (G_OBJECT (builder), pager_plugin_configure_destroyed, plugin); object = gtk_builder_get_object (builder, "settings-button"); panel_return_if_fail (GTK_IS_BUTTON (object)); g_signal_connect (G_OBJECT (object), "clicked", - G_CALLBACK (pager_plugin_configure_workspace_settings), dialog); + G_CALLBACK (pager_plugin_configure_workspace_settings), dialog); object = gtk_builder_get_object (builder, "appearance"); panel_return_if_fail (GTK_IS_COMBO_BOX (object)); @@ -897,21 +912,20 @@ pager_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) static void pager_plugin_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) + gint *minimum_width, + gint *natural_width) { - PagerPlugin *plugin = PAGER_PLUGIN (widget); - XfcePanelPluginMode mode; - gint n_workspaces, n_cols; - gint min_width = 0; - gint nat_width = 0; + PagerPlugin *plugin = PAGER_PLUGIN (widget); + XfcePanelPluginMode mode; + gint n_workspaces, n_cols; + gint min_width = 0; + gint nat_width = 0; if (plugin->pager != NULL) gtk_widget_get_preferred_width (plugin->pager, &min_width, &nat_width); mode = xfce_panel_plugin_get_mode (XFCE_PANEL_PLUGIN (plugin)); - if (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL || - mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) + if (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL || mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) min_width = nat_width = xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin)); else if (plugin->miniature_view) { @@ -929,14 +943,14 @@ pager_plugin_get_preferred_width (GtkWidget *widget, static void pager_plugin_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) + gint *minimum_height, + gint *natural_height) { - PagerPlugin *plugin = PAGER_PLUGIN (widget); - XfcePanelPluginMode mode; - gint n_workspaces, n_cols; - gint min_height = 0; - gint nat_height = 0; + PagerPlugin *plugin = PAGER_PLUGIN (widget); + XfcePanelPluginMode mode; + gint n_workspaces, n_cols; + gint min_height = 0; + gint nat_height = 0; if (plugin->pager != NULL) gtk_widget_get_preferred_height (plugin->pager, &min_height, &nat_height); @@ -963,18 +977,18 @@ pager_plugin_get_preferred_height (GtkWidget *widget, static void pager_plugin_get_preferred_width_for_height (GtkWidget *widget, - gint height, - gint *minimum_width, - gint *natural_width) + gint height, + gint *minimum_width, + gint *natural_width) { pager_plugin_get_preferred_width (widget, minimum_width, natural_width); } static void pager_plugin_get_preferred_height_for_width (GtkWidget *widget, - gint width, - gint *minimum_height, - gint *natural_height) + gint width, + gint *minimum_height, + gint *natural_height) { pager_plugin_get_preferred_height (widget, minimum_height, natural_height); } diff --git a/plugins/pager/pager.h b/plugins/pager/pager.h index 4d7ba4aeb..1ce130aab 100644 --- a/plugins/pager/pager.h +++ b/plugins/pager/pager.h @@ -26,7 +26,8 @@ G_BEGIN_DECLS #define PAGER_TYPE_PLUGIN (pager_plugin_get_type ()) G_DECLARE_FINAL_TYPE (PagerPlugin, pager_plugin, PAGER, PLUGIN, XfcePanelPlugin) -void pager_plugin_register_type (XfcePanelTypeModule *type_module); +void +pager_plugin_register_type (XfcePanelTypeModule *type_module); G_END_DECLS diff --git a/plugins/separator/separator.c b/plugins/separator/separator.c index 61b33875e..c366540f2 100644 --- a/plugins/separator/separator.c +++ b/plugins/separator/separator.c @@ -34,29 +34,36 @@ #define SEPARATOR_OFFSET (0.15) -#define SEPARATOR_SIZE (8) -#define DOTS_OFFSET (4) -#define DOTS_SIZE (3) -#define HANDLE_SIZE (4) +#define SEPARATOR_SIZE (8) +#define DOTS_OFFSET (4) +#define DOTS_SIZE (3) +#define HANDLE_SIZE (4) -static void separator_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void separator_plugin_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static gboolean separator_plugin_draw (GtkWidget *widget, - cairo_t *cr); -static void separator_plugin_construct (XfcePanelPlugin *panel_plugin); -static gboolean separator_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); -static void separator_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); -static void separator_plugin_orientation_changed (XfcePanelPlugin *panel_plugin, - GtkOrientation orientation); +static void +separator_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +separator_plugin_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static gboolean +separator_plugin_draw (GtkWidget *widget, + cairo_t *cr); +static void +separator_plugin_construct (XfcePanelPlugin *panel_plugin); +static gboolean +separator_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); +static void +separator_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); +static void +separator_plugin_orientation_changed (XfcePanelPlugin *panel_plugin, + GtkOrientation orientation); @@ -80,7 +87,7 @@ struct _SeparatorPlugin XfcePanelPlugin __parent__; /* separator style */ - SeparatorPluginStyle style; + SeparatorPluginStyle style; }; enum @@ -101,8 +108,8 @@ static void separator_plugin_class_init (SeparatorPluginClass *klass) { XfcePanelPluginClass *plugin_class; - GObjectClass *gobject_class; - GtkWidgetClass *widget_class; + GObjectClass *gobject_class; + GtkWidgetClass *widget_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->set_property = separator_plugin_set_property; @@ -145,13 +152,13 @@ separator_plugin_init (SeparatorPlugin *plugin) static void -separator_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, +separator_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { SeparatorPlugin *plugin = SEPARATOR_PLUGIN (object); - gboolean expand; + gboolean expand; switch (prop_id) { @@ -173,10 +180,10 @@ separator_plugin_get_property (GObject *object, static void -separator_plugin_set_property (GObject *object, - guint prop_id, +separator_plugin_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { SeparatorPlugin *plugin = SEPARATOR_PLUGIN (object); @@ -207,14 +214,14 @@ separator_plugin_set_property (GObject *object, static gboolean separator_plugin_draw (GtkWidget *widget, - cairo_t *cr) + cairo_t *cr) { - SeparatorPlugin *plugin = SEPARATOR_PLUGIN (widget); - GtkAllocation alloc; - gdouble x, y; - guint dotcount, i; - GtkStyleContext *ctx; - GdkRGBA fg_rgba; + SeparatorPlugin *plugin = SEPARATOR_PLUGIN (widget); + GtkAllocation alloc; + gdouble x, y; + guint dotcount, i; + GtkStyleContext *ctx; + GdkRGBA fg_rgba; gtk_widget_get_allocation (widget, &alloc); @@ -233,8 +240,7 @@ separator_plugin_draw (GtkWidget *widget, case SEPARATOR_PLUGIN_STYLE_SEPARATOR: - if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == - GTK_ORIENTATION_HORIZONTAL) + if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_HORIZONTAL) { gtk_render_line (ctx, cr, (gdouble) (alloc.width - 1.0) / 2.0, @@ -259,8 +265,7 @@ separator_plugin_draw (GtkWidget *widget, /* draw the handle */ for (i = 0; i < 3; i++) { - if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == - GTK_ORIENTATION_HORIZONTAL) + if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_HORIZONTAL) { cairo_move_to (cr, x, y + (i * HANDLE_SIZE) - (HANDLE_SIZE / 2)); cairo_line_to (cr, x + HANDLE_SIZE, y + (i * HANDLE_SIZE) - (HANDLE_SIZE / 2)); @@ -277,28 +282,26 @@ separator_plugin_draw (GtkWidget *widget, case SEPARATOR_PLUGIN_STYLE_DOTS: x = (alloc.width - DOTS_SIZE) / 2; y = (alloc.height - DOTS_SIZE) / 2; - if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == - GTK_ORIENTATION_HORIZONTAL) + if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_HORIZONTAL) { - dotcount = MAX(alloc.height / (DOTS_SIZE + DOTS_OFFSET), 1); + dotcount = MAX (alloc.height / (DOTS_SIZE + DOTS_OFFSET), 1); y = (alloc.height / (double) dotcount - DOTS_SIZE) / 2; } else { - dotcount = MAX(alloc.width / (DOTS_SIZE + DOTS_OFFSET), 1); + dotcount = MAX (alloc.width / (DOTS_SIZE + DOTS_OFFSET), 1); x = (alloc.width / (double) dotcount - DOTS_SIZE) / 2; } /* draw the dots */ for (i = 0; i < dotcount; i++) { - if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == - GTK_ORIENTATION_HORIZONTAL) - cairo_arc (cr, x , y + (i * (alloc.height / (double) dotcount)) + (DOTS_SIZE / 2), - DOTS_SIZE / 2, 0, 2 * 3.14); + if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_HORIZONTAL) + cairo_arc (cr, x, y + (i * (alloc.height / (double) dotcount)) + (DOTS_SIZE / 2), + DOTS_SIZE / 2, 0, 2 * 3.14); else - cairo_arc (cr, x + (i * (alloc.width / (double) dotcount)) + (DOTS_SIZE / 2), y, - DOTS_SIZE / 2, 0, 2 * 3.14); + cairo_arc (cr, x + (i * (alloc.width / (double) dotcount)) + (DOTS_SIZE / 2), y, + DOTS_SIZE / 2, 0, 2 * 3.14); cairo_fill (cr); } break; @@ -312,9 +315,8 @@ separator_plugin_draw (GtkWidget *widget, static void separator_plugin_construct (XfcePanelPlugin *panel_plugin) { - SeparatorPlugin *plugin = SEPARATOR_PLUGIN (panel_plugin); - const PanelProperty properties[] = - { + SeparatorPlugin *plugin = SEPARATOR_PLUGIN (panel_plugin); + const PanelProperty properties[] = { { "style", G_TYPE_UINT }, { "expand", G_TYPE_BOOLEAN }, { NULL } @@ -336,11 +338,10 @@ separator_plugin_construct (XfcePanelPlugin *panel_plugin) static gboolean separator_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { /* set the minimum separator size */ - if (xfce_panel_plugin_get_orientation (panel_plugin) == - GTK_ORIENTATION_HORIZONTAL) + if (xfce_panel_plugin_get_orientation (panel_plugin) == GTK_ORIENTATION_HORIZONTAL) gtk_widget_set_size_request (GTK_WIDGET (panel_plugin), SEPARATOR_SIZE, size); else @@ -356,9 +357,9 @@ static void separator_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) { SeparatorPlugin *plugin = SEPARATOR_PLUGIN (panel_plugin); - GtkBuilder *builder; - GObject *dialog; - GObject *style, *expand; + GtkBuilder *builder; + GObject *dialog; + GObject *style, *expand; panel_return_if_fail (SEPARATOR_IS_PLUGIN (plugin)); @@ -385,7 +386,7 @@ separator_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) static void separator_plugin_orientation_changed (XfcePanelPlugin *panel_plugin, - GtkOrientation orientation) + GtkOrientation orientation) { /* for a size change to set the widget size request properly */ separator_plugin_size_changed (panel_plugin, diff --git a/plugins/separator/separator.h b/plugins/separator/separator.h index 39e3c8350..5fe3de45a 100644 --- a/plugins/separator/separator.h +++ b/plugins/separator/separator.h @@ -27,7 +27,8 @@ G_BEGIN_DECLS #define SEPARATOR_TYPE_PLUGIN (separator_plugin_get_type ()) G_DECLARE_FINAL_TYPE (SeparatorPlugin, separator_plugin, SEPARATOR, PLUGIN, XfcePanelPlugin) -void separator_plugin_register_type (XfcePanelTypeModule *type_module); +void +separator_plugin_register_type (XfcePanelTypeModule *type_module); G_END_DECLS diff --git a/plugins/showdesktop/showdesktop.c b/plugins/showdesktop/showdesktop.c index 950b362b2..3d2c1d900 100644 --- a/plugins/showdesktop/showdesktop.c +++ b/plugins/showdesktop/showdesktop.c @@ -36,30 +36,39 @@ -static void show_desktop_plugin_screen_changed (GtkWidget *widget, - GdkScreen *previous_screen); -static void show_desktop_plugin_construct (XfcePanelPlugin *panel_plugin); -static void show_desktop_plugin_free_data (XfcePanelPlugin *panel_plugin); -static gboolean show_desktop_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); -static void show_desktop_plugin_toggled (GtkToggleButton *button, - ShowDesktopPlugin *plugin); -static gboolean show_desktop_plugin_button_release_event (GtkToggleButton *button, - GdkEventButton *event, - ShowDesktopPlugin *plugin); -static void show_desktop_plugin_show_desktop_changed (XfwScreen *xfw_screen, - GParamSpec *pspec, - ShowDesktopPlugin *plugin); -static void show_desktop_plugin_drag_leave (GtkWidget *widget, - GdkDragContext *context, - guint time, - ShowDesktopPlugin *plugin); -static gboolean show_desktop_plugin_drag_motion (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time, - ShowDesktopPlugin *plugin); +static void +show_desktop_plugin_screen_changed (GtkWidget *widget, + GdkScreen *previous_screen); +static void +show_desktop_plugin_construct (XfcePanelPlugin *panel_plugin); +static void +show_desktop_plugin_free_data (XfcePanelPlugin *panel_plugin); +static gboolean +show_desktop_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); +static void +show_desktop_plugin_toggled (GtkToggleButton *button, + ShowDesktopPlugin *plugin); +static gboolean +show_desktop_plugin_button_release_event (GtkToggleButton *button, + GdkEventButton *event, + ShowDesktopPlugin *plugin); +static void +show_desktop_plugin_show_desktop_changed (XfwScreen *xfw_screen, + GParamSpec *pspec, + ShowDesktopPlugin *plugin); +static void +show_desktop_plugin_drag_leave (GtkWidget *widget, + GdkDragContext *context, + guint time, + ShowDesktopPlugin *plugin); +static gboolean +show_desktop_plugin_drag_motion (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint time, + ShowDesktopPlugin *plugin); @@ -68,11 +77,11 @@ struct _ShowDesktopPlugin XfcePanelPlugin __parent__; /* the toggle button */ - GtkWidget *button; - GtkWidget *icon; + GtkWidget *button; + GtkWidget *icon; /* Dnd timeout */ - guint drag_timeout; + guint drag_timeout; /* the xfw screen */ XfwScreen *xfw_screen; @@ -107,7 +116,7 @@ show_desktop_plugin_init (ShowDesktopPlugin *plugin) /* monitor screen changes */ g_signal_connect (G_OBJECT (plugin), "screen-changed", - G_CALLBACK (show_desktop_plugin_screen_changed), NULL); + G_CALLBACK (show_desktop_plugin_screen_changed), NULL); /* create the toggle button */ button = plugin->button = xfce_panel_create_toggle_button (); @@ -115,18 +124,18 @@ show_desktop_plugin_init (ShowDesktopPlugin *plugin) gtk_container_add (GTK_CONTAINER (plugin), button); gtk_widget_set_name (button, "showdesktop-button"); g_signal_connect (G_OBJECT (button), "toggled", - G_CALLBACK (show_desktop_plugin_toggled), plugin); + G_CALLBACK (show_desktop_plugin_toggled), plugin); g_signal_connect (G_OBJECT (button), "button-release-event", - G_CALLBACK (show_desktop_plugin_button_release_event), plugin); + G_CALLBACK (show_desktop_plugin_button_release_event), plugin); xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (plugin), button); gtk_widget_show (button); /* allow toggle the button when drag something.*/ gtk_drag_dest_set (GTK_WIDGET (plugin->button), 0, NULL, 0, 0); g_signal_connect (G_OBJECT (plugin->button), "drag_motion", - G_CALLBACK (show_desktop_plugin_drag_motion), plugin); + G_CALLBACK (show_desktop_plugin_drag_motion), plugin); g_signal_connect (G_OBJECT (plugin->button), "drag_leave", - G_CALLBACK (show_desktop_plugin_drag_leave), plugin); + G_CALLBACK (show_desktop_plugin_drag_leave), plugin); plugin->icon = gtk_image_new_from_icon_name ("org.xfce.panel.showdesktop", GTK_ICON_SIZE_MENU); gtk_container_add (GTK_CONTAINER (button), plugin->icon); @@ -148,7 +157,7 @@ show_desktop_plugin_screen_changed (GtkWidget *widget, GdkScreen *previous_screen) { ShowDesktopPlugin *plugin = SHOW_DESKTOP_PLUGIN (widget); - XfwScreen *xfw_screen; + XfwScreen *xfw_screen; panel_return_if_fail (SHOW_DESKTOP_IS_PLUGIN (widget)); @@ -167,18 +176,18 @@ show_desktop_plugin_screen_changed (GtkWidget *widget, if (plugin->xfw_screen != NULL) { g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->xfw_screen), - show_desktop_plugin_show_desktop_changed, plugin); + show_desktop_plugin_show_desktop_changed, plugin); g_object_unref (plugin->xfw_screen); } /* set the new xfw screen */ plugin->xfw_screen = xfw_screen; g_signal_connect (G_OBJECT (xfw_screen), "notify::show-desktop", - G_CALLBACK (show_desktop_plugin_show_desktop_changed), plugin); + G_CALLBACK (show_desktop_plugin_show_desktop_changed), plugin); /* toggle the button to the current state or update the tooltip */ - if (G_UNLIKELY (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button)) != - xfw_screen_get_show_desktop (xfw_screen))) + if (G_UNLIKELY (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button)) + != xfw_screen_get_show_desktop (xfw_screen))) show_desktop_plugin_show_desktop_changed (xfw_screen, NULL, plugin); else show_desktop_plugin_toggled (GTK_TOGGLE_BUTTON (plugin->button), plugin); @@ -193,13 +202,13 @@ show_desktop_plugin_free_data (XfcePanelPlugin *panel_plugin) /* disconnect screen changed signal */ g_signal_handlers_disconnect_by_func (G_OBJECT (plugin), - show_desktop_plugin_screen_changed, NULL); + show_desktop_plugin_screen_changed, NULL); /* disconnect handle */ if (plugin->xfw_screen != NULL) { g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->xfw_screen), - show_desktop_plugin_show_desktop_changed, plugin); + show_desktop_plugin_show_desktop_changed, plugin); g_object_unref (plugin->xfw_screen); } } @@ -208,10 +217,10 @@ show_desktop_plugin_free_data (XfcePanelPlugin *panel_plugin) static gboolean show_desktop_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { ShowDesktopPlugin *plugin = SHOW_DESKTOP_PLUGIN (panel_plugin); - gint icon_size; + gint icon_size; panel_return_val_if_fail (SHOW_DESKTOP_IS_PLUGIN (panel_plugin), FALSE); @@ -227,10 +236,10 @@ show_desktop_plugin_size_changed (XfcePanelPlugin *panel_plugin, static void -show_desktop_plugin_toggled (GtkToggleButton *button, +show_desktop_plugin_toggled (GtkToggleButton *button, ShowDesktopPlugin *plugin) { - gboolean active; + gboolean active; const gchar *text; panel_return_if_fail (SHOW_DESKTOP_IS_PLUGIN (plugin)); @@ -254,8 +263,8 @@ show_desktop_plugin_toggled (GtkToggleButton *button, static gboolean -show_desktop_plugin_button_release_event (GtkToggleButton *button, - GdkEventButton *event, +show_desktop_plugin_button_release_event (GtkToggleButton *button, + GdkEventButton *event, ShowDesktopPlugin *plugin) { XfwWorkspaceManager *manager; @@ -297,8 +306,8 @@ show_desktop_plugin_button_release_event (GtkToggleButton *button, static void -show_desktop_plugin_show_desktop_changed (XfwScreen *xfw_screen, - GParamSpec *pspec, +show_desktop_plugin_show_desktop_changed (XfwScreen *xfw_screen, + GParamSpec *pspec, ShowDesktopPlugin *plugin) { panel_return_if_fail (SHOW_DESKTOP_IS_PLUGIN (plugin)); @@ -307,7 +316,7 @@ show_desktop_plugin_show_desktop_changed (XfwScreen *xfw_screen, /* update button to user action */ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->button), - xfw_screen_get_show_desktop (xfw_screen)); + xfw_screen_get_show_desktop (xfw_screen)); } @@ -328,9 +337,9 @@ show_desktop_plugin_drag_timeout (gpointer data) static void -show_desktop_plugin_drag_leave (GtkWidget *widget, - GdkDragContext *context, - guint time, +show_desktop_plugin_drag_leave (GtkWidget *widget, + GdkDragContext *context, + guint time, ShowDesktopPlugin *plugin) { if (plugin->drag_timeout != 0) @@ -345,11 +354,11 @@ show_desktop_plugin_drag_leave (GtkWidget *widget, static gboolean -show_desktop_plugin_drag_motion (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time, +show_desktop_plugin_drag_motion (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint time, ShowDesktopPlugin *plugin) { if (plugin->drag_timeout == 0) diff --git a/plugins/showdesktop/showdesktop.h b/plugins/showdesktop/showdesktop.h index e85986aa6..781dad6f7 100644 --- a/plugins/showdesktop/showdesktop.h +++ b/plugins/showdesktop/showdesktop.h @@ -26,7 +26,8 @@ G_BEGIN_DECLS #define SHOW_DESKTOP_TYPE_PLUGIN (show_desktop_plugin_get_type ()) G_DECLARE_FINAL_TYPE (ShowDesktopPlugin, show_desktop_plugin, SHOW_DESKTOP, PLUGIN, XfcePanelPlugin) -void show_desktop_plugin_register_type (XfcePanelTypeModule *type_module); +void +show_desktop_plugin_register_type (XfcePanelTypeModule *type_module); G_END_DECLS diff --git a/plugins/systray/sn-backend.c b/plugins/systray/sn-backend.c index 78410a9c0..fd8c851af 100644 --- a/plugins/systray/sn-backend.c +++ b/plugins/systray/sn-backend.c @@ -30,76 +30,91 @@ -static void sn_backend_finalize (GObject *object); +static void +sn_backend_finalize (GObject *object); -static void sn_backend_watcher_bus_acquired (GDBusConnection *connection, - const gchar *name, - gpointer user_data); +static void +sn_backend_watcher_bus_acquired (GDBusConnection *connection, + const gchar *name, + gpointer user_data); -static void sn_backend_watcher_name_lost (GDBusConnection *connection, - const gchar *name, - gpointer user_data); +static void +sn_backend_watcher_name_lost (GDBusConnection *connection, + const gchar *name, + gpointer user_data); -static gboolean sn_backend_watcher_register_item (SnWatcher *watcher_skeleton, - GDBusMethodInvocation *invocation, - const gchar *service, - SnBackend *backend); +static gboolean +sn_backend_watcher_register_item (SnWatcher *watcher_skeleton, + GDBusMethodInvocation *invocation, + const gchar *service, + SnBackend *backend); -static gboolean sn_backend_watcher_register_host (SnWatcher *watcher_skeleton, - GDBusMethodInvocation *invocation, - const gchar *service); +static gboolean +sn_backend_watcher_register_host (SnWatcher *watcher_skeleton, + GDBusMethodInvocation *invocation, + const gchar *service); -static void sn_backend_watcher_update_items (SnBackend *backend); +static void +sn_backend_watcher_update_items (SnBackend *backend); -static void sn_backend_watcher_clear_items (SnBackend *backend); +static void +sn_backend_watcher_clear_items (SnBackend *backend); -static void sn_backend_host_name_appeared (GDBusConnection *connection, - const gchar *name, - const gchar *name_owner, - gpointer user_data); +static void +sn_backend_host_name_appeared (GDBusConnection *connection, + const gchar *name, + const gchar *name_owner, + gpointer user_data); -static void sn_backend_host_name_vanished (GDBusConnection *connection, - const gchar *name, - gpointer user_data); +static void +sn_backend_host_name_vanished (GDBusConnection *connection, + const gchar *name, + gpointer user_data); -static void sn_backend_host_item_registered (SnWatcher *host_proxy, - const gchar *service, - SnBackend *backend); +static void +sn_backend_host_item_registered (SnWatcher *host_proxy, + const gchar *service, + SnBackend *backend); -static void sn_backend_host_item_unregistered (SnWatcher *host_proxy, - const gchar *service, - SnBackend *backend); +static void +sn_backend_host_item_unregistered (SnWatcher *host_proxy, + const gchar *service, + SnBackend *backend); -static void sn_backend_host_items_changed (GDBusProxy *proxy, - GVariant *changed_properties, - GStrv invalidated_properties, - gpointer user_data); +static void +sn_backend_host_items_changed (GDBusProxy *proxy, + GVariant *changed_properties, + GStrv invalidated_properties, + gpointer user_data); -static void sn_backend_host_add_item (SnBackend *backend, - const gchar *service, - const gchar *bus_name, - const gchar *object_path); +static void +sn_backend_host_add_item (SnBackend *backend, + const gchar *service, + const gchar *bus_name, + const gchar *object_path); -static void sn_backend_host_remove_item (SnBackend *backend, - SnItem *item, - gboolean remove_from_table); +static void +sn_backend_host_remove_item (SnBackend *backend, + SnItem *item, + gboolean remove_from_table); -static void sn_backend_host_clear_items (SnBackend *backend); +static void +sn_backend_host_clear_items (SnBackend *backend); struct _SnBackend { - GObject __parent__; + GObject __parent__; - guint watcher_bus_owner_id; - SnWatcher *watcher_skeleton; - GHashTable *watcher_items; + guint watcher_bus_owner_id; + SnWatcher *watcher_skeleton; + GHashTable *watcher_items; - guint host_bus_watcher_id; - SnWatcher *host_proxy; - GHashTable *host_items; - GCancellable *host_cancellable; + guint host_bus_watcher_id; + SnWatcher *host_proxy; + GHashTable *host_items; + GCancellable *host_cancellable; }; G_DEFINE_FINAL_TYPE (SnBackend, sn_backend, G_TYPE_OBJECT) @@ -119,30 +134,27 @@ static guint sn_backend_signals[LAST_SIGNAL] = { 0 }; typedef struct { - const gchar *key; - SnBackend *backend; - GDBusConnection *connection; - gulong handler; -} -ItemConnectionContext; + const gchar *key; + SnBackend *backend; + GDBusConnection *connection; + gulong handler; +} ItemConnectionContext; typedef struct { - gint index; - gchar **out; -} -CollectItemKeysContext; + gint index; + gchar **out; +} CollectItemKeysContext; typedef struct { - SnBackend *backend; - const gchar *const *items; -} -RemoveComparingContext; + SnBackend *backend; + const gchar *const *items; +} RemoveComparingContext; @@ -154,21 +166,19 @@ sn_backend_class_init (SnBackendClass *klass) object_class = G_OBJECT_CLASS (klass); object_class->finalize = sn_backend_finalize; - sn_backend_signals[ITEM_ADDED] = - g_signal_new (g_intern_static_string ("item-added"), - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, SN_TYPE_ITEM); - - sn_backend_signals[ITEM_REMOVED] = - g_signal_new (g_intern_static_string ("item-removed"), - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, SN_TYPE_ITEM); + sn_backend_signals[ITEM_ADDED] = g_signal_new (g_intern_static_string ("item-added"), + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, SN_TYPE_ITEM); + + sn_backend_signals[ITEM_REMOVED] = g_signal_new (g_intern_static_string ("item-removed"), + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, SN_TYPE_ITEM); } @@ -232,32 +242,30 @@ sn_backend_start (SnBackend *backend) g_return_if_fail (backend->watcher_bus_owner_id == 0); g_return_if_fail (backend->host_bus_watcher_id == 0); - backend->watcher_bus_owner_id = - g_bus_own_name (G_BUS_TYPE_SESSION, - "org.kde.StatusNotifierWatcher", - G_BUS_NAME_OWNER_FLAGS_NONE, - sn_backend_watcher_bus_acquired, - NULL, sn_backend_watcher_name_lost, - backend, NULL); - - backend->host_bus_watcher_id = - g_bus_watch_name (G_BUS_TYPE_SESSION, - "org.kde.StatusNotifierWatcher", - G_BUS_NAME_WATCHER_FLAGS_NONE, - sn_backend_host_name_appeared, - sn_backend_host_name_vanished, - backend, NULL); + backend->watcher_bus_owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, + "org.kde.StatusNotifierWatcher", + G_BUS_NAME_OWNER_FLAGS_NONE, + sn_backend_watcher_bus_acquired, + NULL, sn_backend_watcher_name_lost, + backend, NULL); + + backend->host_bus_watcher_id = g_bus_watch_name (G_BUS_TYPE_SESSION, + "org.kde.StatusNotifierWatcher", + G_BUS_NAME_WATCHER_FLAGS_NONE, + sn_backend_host_name_appeared, + sn_backend_host_name_vanished, + backend, NULL); } static void sn_backend_watcher_bus_acquired (GDBusConnection *connection, - const gchar *name, - gpointer user_data) + const gchar *name, + gpointer user_data) { SnBackend *backend = user_data; - GError *error = NULL; + GError *error = NULL; if (backend->watcher_skeleton != NULL) g_object_unref (backend->watcher_skeleton); @@ -289,8 +297,8 @@ sn_backend_watcher_bus_acquired (GDBusConnection *connection, static void sn_backend_watcher_name_lost (GDBusConnection *connection, - const gchar *name, - gpointer user_data) + const gchar *name, + gpointer user_data) { SnBackend *backend = user_data; @@ -304,17 +312,17 @@ sn_backend_watcher_name_lost (GDBusConnection *connection, static void sn_backend_watcher_name_owner_changed (GDBusConnection *connection, - const gchar *sender_name, - const gchar *object_path, - const gchar *interface_name, - const gchar *signal_name, - GVariant *parameters, - gpointer user_data) + const gchar *sender_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) { ItemConnectionContext *context = user_data; - SnBackend *backend = context->backend; - gchar *key; - gchar *new_owner; + SnBackend *backend = context->backend; + gchar *key; + gchar *new_owner; g_variant_get (parameters, "(sss)", NULL, NULL, &new_owner); if (new_owner == NULL || strlen (new_owner) == 0) @@ -334,16 +342,16 @@ sn_backend_watcher_name_owner_changed (GDBusConnection *connection, static gboolean -sn_backend_watcher_register_item (SnWatcher *watcher_skeleton, +sn_backend_watcher_register_item (SnWatcher *watcher_skeleton, GDBusMethodInvocation *invocation, - const gchar *service, - SnBackend *backend) -{ - const gchar *bus_name; - const gchar *object_path; - const gchar *sender; - gchar *key; - GDBusConnection *connection; + const gchar *service, + SnBackend *backend) +{ + const gchar *bus_name; + const gchar *object_path; + const gchar *sender; + gchar *key; + GDBusConnection *connection; ItemConnectionContext *context; sender = g_dbus_method_invocation_get_sender (invocation); @@ -384,16 +392,15 @@ sn_backend_watcher_register_item (SnWatcher *watcher_skeleton, context->key = key; context->backend = backend; context->connection = connection; - context->handler = - g_dbus_connection_signal_subscribe (connection, - "org.freedesktop.DBus", - "org.freedesktop.DBus", - "NameOwnerChanged", - "/org/freedesktop/DBus", - bus_name, - G_DBUS_SIGNAL_FLAGS_NONE, - sn_backend_watcher_name_owner_changed, - context, NULL); + context->handler = g_dbus_connection_signal_subscribe (connection, + "org.freedesktop.DBus", + "org.freedesktop.DBus", + "NameOwnerChanged", + "/org/freedesktop/DBus", + bus_name, + G_DBUS_SIGNAL_FLAGS_NONE, + sn_backend_watcher_name_owner_changed, + context, NULL); g_hash_table_insert (backend->watcher_items, key, context); @@ -409,9 +416,9 @@ sn_backend_watcher_register_item (SnWatcher *watcher_skeleton, static gboolean -sn_backend_watcher_register_host (SnWatcher *watcher_skeleton, +sn_backend_watcher_register_host (SnWatcher *watcher_skeleton, GDBusMethodInvocation *invocation, - const gchar *service) + const gchar *service) { sn_watcher_complete_register_status_notifier_host (watcher_skeleton, invocation); @@ -444,7 +451,7 @@ sn_backend_watcher_update_items (SnBackend *backend) sn_backend_watcher_collect_item_keys, &context); sn_watcher_set_registered_status_notifier_items (backend->watcher_skeleton, - (gpointer)context.out); + (gpointer) context.out); g_free (context.out); } } @@ -474,13 +481,13 @@ sn_backend_watcher_clear_items (SnBackend *backend) static gboolean -sn_backend_host_parse_name_path (const gchar *service, - gchar **bus_name, - gchar **object_path) +sn_backend_host_parse_name_path (const gchar *service, + gchar **bus_name, + gchar **object_path) { const gchar *substring; - gchar *bus_name_val; - gint index; + gchar *bus_name_val; + gint index; substring = strstr (service, "/"); @@ -506,15 +513,15 @@ sn_backend_host_parse_name_path (const gchar *service, static void -sn_backend_host_callback (GObject *source_object, +sn_backend_host_callback (GObject *source_object, GAsyncResult *res, - gpointer user_data) + gpointer user_data) { - SnBackend *backend = user_data; - gchar *bus_name; - gchar *object_path; + SnBackend *backend = user_data; + gchar *bus_name; + gchar *object_path; const gchar *const *items; - gint i; + gint i; backend->host_proxy = sn_watcher_proxy_new_finish (res, NULL); @@ -548,9 +555,9 @@ sn_backend_host_callback (GObject *source_object, static void sn_backend_host_name_appeared (GDBusConnection *connection, - const gchar *name, - const gchar *name_owner, - gpointer user_data) + const gchar *name, + const gchar *name_owner, + gpointer user_data) { SnBackend *backend = user_data; @@ -566,8 +573,8 @@ sn_backend_host_name_appeared (GDBusConnection *connection, static void sn_backend_host_name_vanished (GDBusConnection *connection, - const gchar *name, - gpointer user_data) + const gchar *name, + gpointer user_data) { SnBackend *backend = user_data; @@ -583,7 +590,7 @@ sn_backend_host_name_vanished (GDBusConnection *connection, static void -sn_backend_host_item_expose (SnItem *item, +sn_backend_host_item_expose (SnItem *item, SnBackend *backend) { g_signal_emit (G_OBJECT (backend), sn_backend_signals[ITEM_ADDED], 0, item); @@ -592,7 +599,7 @@ sn_backend_host_item_expose (SnItem *item, static void -sn_backend_host_item_seal (SnItem *item, +sn_backend_host_item_seal (SnItem *item, SnBackend *backend) { g_signal_emit (G_OBJECT (backend), sn_backend_signals[ITEM_REMOVED], 0, item); @@ -601,7 +608,7 @@ sn_backend_host_item_seal (SnItem *item, static void -sn_backend_host_item_finish (SnItem *item, +sn_backend_host_item_finish (SnItem *item, SnBackend *backend) { sn_backend_host_remove_item (backend, item, TRUE); @@ -610,9 +617,9 @@ sn_backend_host_item_finish (SnItem *item, static void -sn_backend_host_item_registered (SnWatcher *host_proxy, +sn_backend_host_item_registered (SnWatcher *host_proxy, const gchar *service, - SnBackend *backend) + SnBackend *backend) { gchar *bus_name; gchar *object_path; @@ -629,9 +636,9 @@ sn_backend_host_item_registered (SnWatcher *host_proxy, static void -sn_backend_host_item_unregistered (SnWatcher *host_proxy, +sn_backend_host_item_unregistered (SnWatcher *host_proxy, const gchar *service, - SnBackend *backend) + SnBackend *backend) { SnItem *item; @@ -648,8 +655,8 @@ sn_backend_host_items_changed_remove_item (gpointer key, gpointer user_data) { RemoveComparingContext *context = user_data; - SnItem *item = value; - gint i; + SnItem *item = value; + gint i; for (i = 0; context->items[i] != NULL; i++) { @@ -666,16 +673,16 @@ sn_backend_host_items_changed_remove_item (gpointer key, static void sn_backend_host_items_changed (GDBusProxy *proxy, - GVariant *changed_properties, - GStrv invalidated_properties, - gpointer user_data) + GVariant *changed_properties, + GStrv invalidated_properties, + gpointer user_data) { - SnBackend *backend = user_data; - const gchar *const *items; - gchar *bus_name; - gchar *object_path; - gint i; - RemoveComparingContext context; + SnBackend *backend = user_data; + const gchar *const *items; + gchar *bus_name; + gchar *object_path; + gint i; + RemoveComparingContext context; items = sn_watcher_get_registered_status_notifier_items (backend->host_proxy); if (items != NULL) @@ -711,7 +718,7 @@ sn_backend_host_items_changed (GDBusProxy *proxy, static void -sn_backend_host_add_item (SnBackend *backend, +sn_backend_host_add_item (SnBackend *backend, const gchar *service, const gchar *bus_name, const gchar *object_path) @@ -745,10 +752,10 @@ sn_backend_host_add_item (SnBackend *backend, static void sn_backend_host_remove_item (SnBackend *backend, - SnItem *item, - gboolean remove_from_table) + SnItem *item, + gboolean remove_from_table) { - gchar *key; + gchar *key; gboolean exposed; g_object_get (item, @@ -775,7 +782,7 @@ sn_backend_host_clear_item (gpointer key, gpointer user_data) { SnBackend *backend = user_data; - SnItem *item = value; + SnItem *item = value; sn_backend_host_remove_item (backend, item, FALSE); diff --git a/plugins/systray/sn-backend.h b/plugins/systray/sn-backend.h index 51d5ea786..01985476c 100644 --- a/plugins/systray/sn-backend.h +++ b/plugins/systray/sn-backend.h @@ -26,9 +26,11 @@ G_BEGIN_DECLS #define SN_TYPE_BACKEND (sn_backend_get_type ()) G_DECLARE_FINAL_TYPE (SnBackend, sn_backend, SN, BACKEND, GObject) -SnBackend *sn_backend_new (void); +SnBackend * +sn_backend_new (void); -void sn_backend_start (SnBackend *backend); +void +sn_backend_start (SnBackend *backend); G_END_DECLS diff --git a/plugins/systray/sn-box.c b/plugins/systray/sn-box.c index 8a38e6c65..ffd239ec6 100644 --- a/plugins/systray/sn-box.c +++ b/plugins/systray/sn-box.c @@ -31,41 +31,52 @@ -static void sn_box_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void sn_box_finalize (GObject *object); +static void +sn_box_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +sn_box_finalize (GObject *object); -static void sn_box_collect_known_items (SnBox *box, - GHashTable *result); +static void +sn_box_collect_known_items (SnBox *box, + GHashTable *result); -static void sn_box_list_changed (SnBox *box, - SnConfig *config); +static void +sn_box_list_changed (SnBox *box, + SnConfig *config); -static void sn_box_add (GtkContainer *container, - GtkWidget *child); +static void +sn_box_add (GtkContainer *container, + GtkWidget *child); -static void sn_box_remove (GtkContainer *container, - GtkWidget *child); +static void +sn_box_remove (GtkContainer *container, + GtkWidget *child); -static void sn_box_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data); +static void +sn_box_forall (GtkContainer *container, + gboolean include_internals, + GtkCallback callback, + gpointer callback_data); -static GType sn_box_child_type (GtkContainer *container); +static GType +sn_box_child_type (GtkContainer *container); -static void sn_box_get_preferred_width (GtkWidget *widget, - gint *minimal_width, - gint *natural_width); +static void +sn_box_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width); -static void sn_box_get_preferred_height (GtkWidget *widget, - gint *minimal_height, - gint *natural_height); +static void +sn_box_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height); -static void sn_box_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); +static void +sn_box_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); @@ -77,17 +88,17 @@ enum struct _SnBox { - GtkContainer __parent__; + GtkContainer __parent__; - SnConfig *config; + SnConfig *config; /* in theory it's possible to have multiple items with same name */ - GHashTable *children; + GHashTable *children; /* hidden children counter */ - gint n_hidden_children; - gint n_visible_children; - gboolean show_hidden; + gint n_hidden_children; + gint n_visible_children; + gboolean show_hidden; }; G_DEFINE_FINAL_TYPE (SnBox, sn_box, GTK_TYPE_CONTAINER) @@ -97,8 +108,8 @@ G_DEFINE_FINAL_TYPE (SnBox, sn_box, GTK_TYPE_CONTAINER) static void sn_box_class_init (SnBoxClass *klass) { - GObjectClass *object_class; - GtkWidgetClass *widget_class; + GObjectClass *object_class; + GtkWidgetClass *widget_class; GtkContainerClass *container_class; object_class = G_OBJECT_CLASS (klass); @@ -139,23 +150,23 @@ sn_box_init (SnBox *box) static void -sn_box_get_property(GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +sn_box_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - SnBox *box = SN_BOX(object); + SnBox *box = SN_BOX (object); switch (prop_id) - { - case PROP_HAS_HIDDEN: - g_value_set_boolean(value, box->n_hidden_children > 0); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - break; - } + { + case PROP_HAS_HIDDEN: + g_value_set_boolean (value, box->n_hidden_children > 0); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } } @@ -191,11 +202,11 @@ sn_box_new (SnConfig *config) static void sn_box_collect_known_items_callback (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { - SnButton *button = SN_BUTTON (widget); + SnButton *button = SN_BUTTON (widget); GHashTable *table = user_data; - gchar *name; + gchar *name; name = g_strdup (sn_button_get_name (button)); g_hash_table_replace (table, name, name); @@ -204,7 +215,7 @@ sn_box_collect_known_items_callback (GtkWidget *widget, static void -sn_box_collect_known_items (SnBox *box, +sn_box_collect_known_items (SnBox *box, GHashTable *result) { gtk_container_foreach (GTK_CONTAINER (box), @@ -214,12 +225,12 @@ sn_box_collect_known_items (SnBox *box, static void -sn_box_list_changed (SnBox *box, +sn_box_list_changed (SnBox *box, SnConfig *config) { SnButton *button; - GList *known_items, *li, *li_int, *li_tmp; - gint n_hidden_children = 0, n_visible_children = 0; + GList *known_items, *li, *li_int, *li_tmp; + gint n_hidden_children = 0, n_visible_children = 0; g_return_if_fail (SN_IS_BOX (box)); g_return_if_fail (SN_IS_CONFIG (config)); @@ -234,7 +245,7 @@ sn_box_list_changed (SnBox *box, if (!sn_config_is_hidden (box->config, sn_button_get_name (button))) { - gtk_widget_map (GTK_WIDGET(button)); + gtk_widget_map (GTK_WIDGET (button)); n_visible_children++; } else @@ -244,7 +255,7 @@ sn_box_list_changed (SnBox *box, } } } - + box->n_visible_children = n_visible_children; if (box->n_hidden_children != n_hidden_children) { @@ -259,11 +270,11 @@ sn_box_list_changed (SnBox *box, static void sn_box_add (GtkContainer *container, - GtkWidget *child) + GtkWidget *child) { - SnBox *box = SN_BOX (container); - SnButton *button = SN_BUTTON (child); - GList *li; + SnBox *box = SN_BOX (container); + SnButton *button = SN_BUTTON (child); + GList *li; const gchar *name; g_return_if_fail (SN_IS_BOX (box)); @@ -284,11 +295,11 @@ sn_box_add (GtkContainer *container, static void sn_box_remove (GtkContainer *container, - GtkWidget *child) + GtkWidget *child) { - SnBox *box = SN_BOX (container); - SnButton *button = SN_BUTTON (child); - GList *li, *li_tmp; + SnBox *box = SN_BOX (container); + SnButton *button = SN_BUTTON (child); + GList *li, *li_tmp; const gchar *name; /* search the child */ @@ -311,13 +322,13 @@ sn_box_remove (GtkContainer *container, static void sn_box_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data) + gboolean include_internals, + GtkCallback callback, + gpointer callback_data) { - SnBox *box = SN_BOX (container); + SnBox *box = SN_BOX (container); SnButton *button; - GList *known_items, *li, *li_int, *li_tmp; + GList *known_items, *li, *li_int, *li_tmp; /* run callback for all children */ known_items = sn_config_get_known_items (box->config); @@ -344,21 +355,21 @@ sn_box_child_type (GtkContainer *container) static void sn_box_measure_and_allocate (GtkWidget *widget, - gint *minimum_length, - gint *natural_length, - gboolean allocate, - gint x0, - gint y0, - gboolean horizontal) + gint *minimum_length, + gint *natural_length, + gboolean allocate, + gint x0, + gint y0, + gboolean horizontal) { - SnBox *box = SN_BOX (widget); - SnButton *button; - GList *known_items, *li, *li_int, *li_tmp; - gint panel_size, config_nrows, icon_size, hx_size, hy_size, nrows; - gboolean single_row, single_horizontal, square_icons, rect_child; - gint total_length, column_length, item_length, row; - GtkRequisition child_req; - GtkAllocation child_alloc; + SnBox *box = SN_BOX (widget); + SnButton *button; + GList *known_items, *li, *li_int, *li_tmp; + gint panel_size, config_nrows, icon_size, hx_size, hy_size, nrows; + gboolean single_row, single_horizontal, square_icons, rect_child; + gint total_length, column_length, item_length, row; + GtkRequisition child_req; + GtkAllocation child_alloc; gint n_hidden_children = 0, n_visible_children = 0; @@ -474,21 +485,21 @@ sn_box_measure_and_allocate (GtkWidget *widget, box->n_visible_children = n_visible_children; if (box->n_hidden_children != n_hidden_children) - { - box->n_hidden_children = n_hidden_children; - g_object_notify(G_OBJECT(box), "has-hidden"); - } + { + box->n_hidden_children = n_hidden_children; + g_object_notify (G_OBJECT (box), "has-hidden"); + } } static void sn_box_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) + gint *minimum_width, + gint *natural_width) { SnBox *box = SN_BOX (widget); - gint panel_size; + gint panel_size; if (sn_config_get_panel_orientation (box->config) == GTK_ORIENTATION_HORIZONTAL) { @@ -509,11 +520,11 @@ sn_box_get_preferred_width (GtkWidget *widget, static void sn_box_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) + gint *minimum_height, + gint *natural_height) { SnBox *box = SN_BOX (widget); - gint panel_size; + gint panel_size; if (sn_config_get_panel_orientation (box->config) == GTK_ORIENTATION_VERTICAL) { @@ -533,7 +544,7 @@ sn_box_get_preferred_height (GtkWidget *widget, static void -sn_box_size_allocate (GtkWidget *widget, +sn_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { SnBox *box = SN_BOX (widget); @@ -542,18 +553,17 @@ sn_box_size_allocate (GtkWidget *widget, sn_box_measure_and_allocate (widget, NULL, NULL, TRUE, allocation->x, allocation->y, - sn_config_get_panel_orientation (box->config) == - GTK_ORIENTATION_HORIZONTAL); + sn_config_get_panel_orientation (box->config) == GTK_ORIENTATION_HORIZONTAL); } void -sn_box_remove_item (SnBox *box, +sn_box_remove_item (SnBox *box, SnItem *item) { SnButton *button; - GList *known_items, *li, *li_int, *li_tmp; + GList *known_items, *li, *li_int, *li_tmp; g_return_if_fail (SN_IS_BOX (box)); @@ -581,8 +591,8 @@ sn_box_has_hidden_items (SnBox *box) } void -sn_box_set_show_hidden (SnBox *box, - gboolean show_hidden) +sn_box_set_show_hidden (SnBox *box, + gboolean show_hidden) { g_return_if_fail (SN_IS_BOX (box)); diff --git a/plugins/systray/sn-box.h b/plugins/systray/sn-box.h index bd2707de7..ec7362952 100644 --- a/plugins/systray/sn-box.h +++ b/plugins/systray/sn-box.h @@ -30,13 +30,17 @@ G_BEGIN_DECLS #define SN_TYPE_BOX (sn_box_get_type ()) G_DECLARE_FINAL_TYPE (SnBox, sn_box, SN, BOX, GtkContainer) -void sn_box_remove_item (SnBox *box, - SnItem *item); - -GtkWidget *sn_box_new (SnConfig *config); -gboolean sn_box_has_hidden_items (SnBox *box); -void sn_box_set_show_hidden (SnBox *box, - gboolean show_hidden); +void +sn_box_remove_item (SnBox *box, + SnItem *item); + +GtkWidget * +sn_box_new (SnConfig *config); +gboolean +sn_box_has_hidden_items (SnBox *box); +void +sn_box_set_show_hidden (SnBox *box, + gboolean show_hidden); G_END_DECLS diff --git a/plugins/systray/sn-button.c b/plugins/systray/sn-button.c index 9ec29dd6e..8ad8d2add 100644 --- a/plugins/systray/sn-button.c +++ b/plugins/systray/sn-button.c @@ -32,47 +32,54 @@ -static void sn_button_finalize (GObject *object); +static void +sn_button_finalize (GObject *object); -static gboolean sn_button_button_press (GtkWidget *widget, - GdkEventButton *event); +static gboolean +sn_button_button_press (GtkWidget *widget, + GdkEventButton *event); -static gboolean sn_button_button_release (GtkWidget *widget, - GdkEventButton *event); +static gboolean +sn_button_button_release (GtkWidget *widget, + GdkEventButton *event); -static gboolean sn_button_scroll_event (GtkWidget *widget, - GdkEventScroll *event); +static gboolean +sn_button_scroll_event (GtkWidget *widget, + GdkEventScroll *event); -static void sn_button_unrealize (GtkWidget *widget); +static void +sn_button_unrealize (GtkWidget *widget); -static void sn_button_menu_changed (GtkWidget *widget, - SnItem *item); +static void +sn_button_menu_changed (GtkWidget *widget, + SnItem *item); -static gboolean sn_button_query_tooltip (GtkWidget *widget, - gint x, - gint y, - gboolean keyboard_mode, - GtkTooltip *tooltip, - gpointer user_data); +static gboolean +sn_button_query_tooltip (GtkWidget *widget, + gint x, + gint y, + gboolean keyboard_mode, + GtkTooltip *tooltip, + gpointer user_data); struct _SnButton { - GtkButton __parent__; + GtkButton __parent__; - SnItem *item; - SnPlugin *plugin; - SnConfig *config; + SnItem *item; + SnPlugin *plugin; + SnConfig *config; - GtkWidget *menu; - gboolean menu_only; + GtkWidget *menu; + gboolean menu_only; - GtkWidget *box; + GtkWidget *box; - guint menu_deactivate_handler; - guint menu_size_allocate_handler; - guint menu_size_allocate_idle_handler; + guint menu_deactivate_handler; + guint menu_size_allocate_handler; + guint menu_size_allocate_idle_handler; }; G_DEFINE_FINAL_TYPE (SnButton, sn_button, GTK_TYPE_BUTTON) @@ -82,7 +89,7 @@ G_DEFINE_FINAL_TYPE (SnButton, sn_button, GTK_TYPE_BUTTON) static void sn_button_class_init (SnButtonClass *klass) { - GObjectClass *object_class; + GObjectClass *object_class; GtkWidgetClass *widget_class; object_class = G_OBJECT_CLASS (klass); @@ -101,17 +108,15 @@ static void sn_button_init (SnButton *button) { GtkCssProvider *css_provider; - GdkEventMask event_mask = GDK_SCROLL_MASK; + GdkEventMask event_mask = GDK_SCROLL_MASK; gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_widget_set_name (GTK_WIDGET (button), "sn-button"); css_provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (css_provider, - "#sn-button {" - "padding: 0px;" - "border-width: 0px;" - "}", -1, NULL); + "#sn-button { padding: 0px; border-width: 0px; }", + -1, NULL); gtk_style_context_add_provider (GTK_STYLE_CONTEXT (gtk_widget_get_style_context (GTK_WIDGET (button))), GTK_STYLE_PROVIDER (css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); @@ -170,7 +175,7 @@ sn_button_get_name (SnButton *button) GtkWidget * -sn_button_new (SnItem *item, +sn_button_new (SnItem *item, SnPlugin *plugin, SnConfig *config) { @@ -222,15 +227,15 @@ sn_button_finalize (GObject *object) static void sn_button_menu_deactivate (GtkWidget *widget, - GtkMenu *menu) + GtkMenu *menu) { SnButton *button = SN_BUTTON (widget); if (button->menu_deactivate_handler != 0) - { - g_signal_handler_disconnect (menu, button->menu_deactivate_handler); - button->menu_deactivate_handler = 0; - } + { + g_signal_handler_disconnect (menu, button->menu_deactivate_handler); + button->menu_deactivate_handler = 0; + } gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_ACTIVE); } @@ -238,11 +243,11 @@ sn_button_menu_deactivate (GtkWidget *widget, static gboolean -sn_button_button_press (GtkWidget *widget, +sn_button_button_press (GtkWidget *widget, GdkEventButton *event) { SnButton *button = SN_BUTTON (widget); - gboolean menu_is_primary; + gboolean menu_is_primary; menu_is_primary = sn_config_get_menu_is_primary (button->config); @@ -262,9 +267,9 @@ sn_button_button_press (GtkWidget *widget, { if (button->menu != NULL && sn_container_has_children (button->menu)) { - button->menu_deactivate_handler = - g_signal_connect_swapped (G_OBJECT (button->menu), "deactivate", - G_CALLBACK (sn_button_menu_deactivate), button); + button->menu_deactivate_handler + = g_signal_connect_swapped (G_OBJECT (button->menu), "deactivate", + G_CALLBACK (sn_button_menu_deactivate), button); xfce_panel_plugin_popup_menu (XFCE_PANEL_PLUGIN (button->plugin), GTK_MENU (button->menu), widget, (GdkEvent *) event); @@ -288,15 +293,15 @@ sn_button_button_press (GtkWidget *widget, static gboolean -sn_button_button_release (GtkWidget *widget, +sn_button_button_release (GtkWidget *widget, GdkEventButton *event) { SnButton *button = SN_BUTTON (widget); - gboolean menu_is_primary; + gboolean menu_is_primary; /* leave if button release happens outside of systray item */ - if (event->x < 0 || event->x > gdk_window_get_width (event->window) || - event->y < 0 || event->y > gdk_window_get_height (event->window)) + if (event->x < 0 || event->x > gdk_window_get_width (event->window) + || event->y < 0 || event->y > gdk_window_get_height (event->window)) return FALSE; menu_is_primary = sn_config_get_menu_is_primary (button->config); @@ -324,16 +329,16 @@ sn_button_button_release (GtkWidget *widget, static gboolean -sn_button_scroll_event (GtkWidget *widget, +sn_button_scroll_event (GtkWidget *widget, GdkEventScroll *event) { SnButton *button = SN_BUTTON (widget); - gdouble delta_x, delta_y; + gdouble delta_x, delta_y; /* see reference to https://gitlab.xfce.org/xfce/xfwm4/-/issues/641 in init() */ if (gtk_widget_get_events (widget) & GDK_SMOOTH_SCROLL_MASK) { - if (!gdk_event_get_scroll_deltas ((GdkEvent *)event, &delta_x, &delta_y)) + if (!gdk_event_get_scroll_deltas ((GdkEvent *) event, &delta_x, &delta_y)) { delta_x = event->delta_x; delta_y = event->delta_y; @@ -344,29 +349,29 @@ sn_button_scroll_event (GtkWidget *widget, delta_x = delta_y = 0; switch (event->direction) { - case GDK_SCROLL_UP: - delta_y = -1; - break; - case GDK_SCROLL_DOWN: - delta_y = 1; - break; - case GDK_SCROLL_RIGHT: - delta_x = -1; - break; - case GDK_SCROLL_LEFT: - delta_x = 1; - break; - default: - break; + case GDK_SCROLL_UP: + delta_y = -1; + break; + case GDK_SCROLL_DOWN: + delta_y = 1; + break; + case GDK_SCROLL_RIGHT: + delta_x = -1; + break; + case GDK_SCROLL_LEFT: + delta_x = 1; + break; + default: + break; } } if (delta_x != 0 || delta_y != 0) { - delta_x = (delta_x == 0 ? 0 : delta_x > 0 ? 1 : -1) * - MAX (ABS (delta_x) + 0.5, 1); - delta_y = (delta_y == 0 ? 0 : delta_y > 0 ? 1 : -1) * - MAX (ABS (delta_y) + 0.5, 1); + delta_x = (delta_x == 0 ? 0 : (delta_x > 0 ? 1 : -1)) + * MAX (ABS (delta_x) + 0.5, 1); + delta_y = (delta_y == 0 ? 0 : (delta_y > 0 ? 1 : -1)) + * MAX (ABS (delta_y) + 0.5, 1); sn_item_scroll (button->item, (gint) delta_x, (gint) delta_y); } @@ -415,8 +420,7 @@ sn_button_menu_size_changed (GtkWidget *widget) /* defer gtk_menu_reposition call since it may not work in size event handler */ if (button->menu_size_allocate_idle_handler == 0) { - button->menu_size_allocate_idle_handler = - g_idle_add (sn_button_menu_size_changed_idle, button); + button->menu_size_allocate_idle_handler = g_idle_add (sn_button_menu_size_changed_idle, button); } } @@ -424,7 +428,7 @@ sn_button_menu_size_changed (GtkWidget *widget) static void sn_button_menu_changed (GtkWidget *widget, - SnItem *item) + SnItem *item) { SnButton *button = SN_BUTTON (widget); @@ -461,27 +465,27 @@ sn_button_menu_changed (GtkWidget *widget, { gtk_menu_attach_to_widget (GTK_MENU (button->menu), GTK_WIDGET (button), NULL); /* restore menu position to its corner if size was changed */ - button->menu_size_allocate_handler = - g_signal_connect_swapped (button->menu, "size-allocate", - G_CALLBACK (sn_button_menu_size_changed), button); + button->menu_size_allocate_handler + = g_signal_connect_swapped (button->menu, "size-allocate", + G_CALLBACK (sn_button_menu_size_changed), button); } } static gboolean -sn_button_query_tooltip (GtkWidget *widget, - gint x, - gint y, - gboolean keyboard_mode, +sn_button_query_tooltip (GtkWidget *widget, + gint x, + gint y, + gboolean keyboard_mode, GtkTooltip *tooltip, - gpointer user_data) + gpointer user_data) { - SnButton *button = SN_BUTTON (widget); + SnButton *button = SN_BUTTON (widget); const gchar *tooltip_title; const gchar *tooltip_subtitle; - gchar *tooltip_title_escaped; - gchar *full; + gchar *tooltip_title_escaped; + gchar *full; sn_item_get_tooltip (button->item, &tooltip_title, &tooltip_subtitle); diff --git a/plugins/systray/sn-button.h b/plugins/systray/sn-button.h index 990e50e82..0c787aa6c 100644 --- a/plugins/systray/sn-button.h +++ b/plugins/systray/sn-button.h @@ -31,13 +31,16 @@ G_BEGIN_DECLS #define SN_TYPE_BUTTON (sn_button_get_type ()) G_DECLARE_FINAL_TYPE (SnButton, sn_button, SN, BUTTON, GtkButton) -SnItem *sn_button_get_item (SnButton *button); +SnItem * +sn_button_get_item (SnButton *button); -const gchar *sn_button_get_name (SnButton *button); +const gchar * +sn_button_get_name (SnButton *button); -GtkWidget *sn_button_new (SnItem *item, - SnPlugin *plugin, - SnConfig *config); +GtkWidget * +sn_button_new (SnItem *item, + SnPlugin *plugin, + SnConfig *config); G_END_DECLS diff --git a/plugins/systray/sn-config.c b/plugins/systray/sn-config.c index 4752c2e15..86fdae8d2 100644 --- a/plugins/systray/sn-config.c +++ b/plugins/systray/sn-config.c @@ -35,41 +35,44 @@ -static void sn_config_finalize (GObject *object); +static void +sn_config_finalize (GObject *object); -static void sn_config_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); +static void +sn_config_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); -static void sn_config_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); +static void +sn_config_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); struct _SnConfig { - GObject __parent__; - - gint icon_size; - gboolean single_row; - gboolean square_icons; - gboolean symbolic_icons; - gboolean menu_is_primary; - gboolean hide_new_items; - GList *known_items; - GHashTable *hidden_items; - GList *known_legacy_items; - GHashTable *hidden_legacy_items; + GObject __parent__; + + gint icon_size; + gboolean single_row; + gboolean square_icons; + gboolean symbolic_icons; + gboolean menu_is_primary; + gboolean hide_new_items; + GList *known_items; + GHashTable *hidden_items; + GList *known_legacy_items; + GHashTable *hidden_legacy_items; /* not xfconf properties but it is still convenient to have them here */ - GtkOrientation orientation; - GtkOrientation panel_orientation; - gint nrows; - gint panel_size; - gint panel_icon_size; + GtkOrientation orientation; + GtkOrientation panel_orientation; + gint nrows; + gint panel_size; + gint panel_icon_size; }; G_DEFINE_FINAL_TYPE (SnConfig, sn_config, G_TYPE_OBJECT) @@ -119,115 +122,100 @@ sn_config_class_init (SnConfigClass *klass) PROP_ICON_SIZE, g_param_spec_int ("icon-size", NULL, NULL, 0, 64, DEFAULT_ICON_SIZE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_SINGLE_ROW, g_param_spec_boolean ("single-row", NULL, NULL, DEFAULT_SINGLE_ROW, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_SQUARE_ICONS, g_param_spec_boolean ("square-icons", NULL, NULL, DEFAULT_SQUARE_ICONS, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_SYMBOLIC_ICONS, g_param_spec_boolean ("symbolic-icons", NULL, NULL, DEFAULT_SYMBOLIC_ICONS, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_MENU_IS_PRIMARY, g_param_spec_boolean ("menu-is-primary", NULL, NULL, DEFAULT_MENU_IS_PRIMARY, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_HIDE_NEW_ITEMS, g_param_spec_boolean ("hide-new-items", NULL, NULL, DEFAULT_HIDE_NEW_ITEMS, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_KNOWN_ITEMS, g_param_spec_boxed ("known-items", NULL, NULL, G_TYPE_PTR_ARRAY, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_HIDDEN_ITEMS, g_param_spec_boxed ("hidden-items", NULL, NULL, G_TYPE_PTR_ARRAY, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_KNOWN_LEGACY_ITEMS, g_param_spec_boxed ("known-legacy-items", NULL, NULL, G_TYPE_PTR_ARRAY, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_HIDDEN_LEGACY_ITEMS, g_param_spec_boxed ("hidden-legacy-items", NULL, NULL, G_TYPE_PTR_ARRAY, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - sn_config_signals[CONFIGURATION_CHANGED] = - g_signal_new (g_intern_static_string ("configuration-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[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), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - sn_config_signals[COLLECT_KNOWN_ITEMS] = - g_signal_new (g_intern_static_string ("collect-known-items"), - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_generic, - G_TYPE_NONE, 1, G_TYPE_POINTER); - - sn_config_signals[LEGACY_ITEM_LIST_CHANGED] = - g_signal_new (g_intern_static_string ("legacy-items-list-changed"), - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + sn_config_signals[CONFIGURATION_CHANGED] = g_signal_new (g_intern_static_string ("configuration-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[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), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + sn_config_signals[COLLECT_KNOWN_ITEMS] = g_signal_new (g_intern_static_string ("collect-known-items"), + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, 1, G_TYPE_POINTER); + + sn_config_signals[LEGACY_ITEM_LIST_CHANGED] = g_signal_new (g_intern_static_string ("legacy-items-list-changed"), + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } @@ -235,20 +223,20 @@ sn_config_class_init (SnConfigClass *klass) static void sn_config_init (SnConfig *config) { - config->icon_size = DEFAULT_ICON_SIZE; - config->single_row = DEFAULT_SINGLE_ROW; - config->square_icons = DEFAULT_SQUARE_ICONS; - config->symbolic_icons = DEFAULT_SYMBOLIC_ICONS; - config->hide_new_items = DEFAULT_HIDE_NEW_ITEMS; - config->known_items = NULL; - config->hidden_items = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - config->known_legacy_items = NULL; - config->hidden_legacy_items = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - - config->orientation = DEFAULT_ORIENTATION; - config->panel_orientation = DEFAULT_PANEL_ORIENTATION; - config->nrows = 1; - config->panel_size = DEFAULT_PANEL_SIZE; + config->icon_size = DEFAULT_ICON_SIZE; + config->single_row = DEFAULT_SINGLE_ROW; + config->square_icons = DEFAULT_SQUARE_ICONS; + config->symbolic_icons = DEFAULT_SYMBOLIC_ICONS; + config->hide_new_items = DEFAULT_HIDE_NEW_ITEMS; + config->known_items = NULL; + config->hidden_items = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + config->known_legacy_items = NULL; + config->hidden_legacy_items = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + + config->orientation = DEFAULT_ORIENTATION; + config->panel_orientation = DEFAULT_PANEL_ORIENTATION; + config->nrows = 1; + config->panel_size = DEFAULT_PANEL_SIZE; } @@ -274,7 +262,7 @@ sn_config_finalize (GObject *object) static void sn_config_free_array_element (gpointer data) { - GValue *value = (GValue *)data; + GValue *value = (GValue *) data; g_value_unset (value); g_free (value); @@ -298,15 +286,15 @@ sn_config_collect_keys (gpointer key, static void -sn_config_get_property (GObject *object, - guint prop_id, - GValue *value, +sn_config_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { - SnConfig *config = SN_CONFIG (object); + SnConfig *config = SN_CONFIG (object); GPtrArray *array; - GList *li; - GValue *tmp; + GList *li; + GValue *tmp; switch (prop_id) { @@ -383,17 +371,17 @@ sn_config_get_property (GObject *object, static void -sn_config_set_property (GObject *object, - guint prop_id, +sn_config_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { - SnConfig *config = SN_CONFIG (object); - gint val; - GPtrArray *array; + SnConfig *config = SN_CONFIG (object); + gint val; + GPtrArray *array; const GValue *tmp; - gchar *name; - guint i; + gchar *name; + guint i; switch (prop_id) { @@ -552,31 +540,31 @@ sn_config_get_icon_size_is_automatic (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 *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); - 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); + panel_size = sn_config_get_panel_size (config); + 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) - { - nrows = single_row ? 1 : MAX(1, config_nrows); - hx_size = hy_size = panel_size / nrows; - } + { + nrows = single_row ? 1 : MAX (1, config_nrows); + hx_size = hy_size = panel_size / nrows; + } else - { - hx_size = MIN(icon_size + 2, 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)); + { + hx_size = MIN (icon_size + 2, 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) { @@ -645,9 +633,9 @@ sn_config_get_menu_is_primary (SnConfig *config) void -sn_config_set_orientation (SnConfig *config, - GtkOrientation panel_orientation, - GtkOrientation orientation) +sn_config_set_orientation (SnConfig *config, + GtkOrientation panel_orientation, + GtkOrientation orientation) { gboolean needs_update = FALSE; @@ -692,10 +680,10 @@ sn_config_get_panel_orientation (SnConfig *config) void -sn_config_set_size (SnConfig *config, - gint panel_size, - gint nrows, - gint icon_size) +sn_config_set_size (SnConfig *config, + gint panel_size, + gint nrows, + gint icon_size) { gboolean needs_update = FALSE; @@ -747,7 +735,7 @@ sn_config_get_panel_size (SnConfig *config) gboolean -sn_config_is_hidden (SnConfig *config, +sn_config_is_hidden (SnConfig *config, const gchar *name) { g_return_val_if_fail (SN_IS_CONFIG (config), FALSE); @@ -758,9 +746,9 @@ sn_config_is_hidden (SnConfig *config, void -sn_config_set_hidden (SnConfig *config, +sn_config_set_hidden (SnConfig *config, const gchar *name, - gboolean hidden) + gboolean hidden) { gchar *name_copy; @@ -782,7 +770,7 @@ sn_config_set_hidden (SnConfig *config, gboolean -sn_config_is_legacy_hidden (SnConfig *config, +sn_config_is_legacy_hidden (SnConfig *config, const gchar *name) { g_return_val_if_fail (SN_IS_CONFIG (config), FALSE); @@ -793,9 +781,9 @@ sn_config_is_legacy_hidden (SnConfig *config, void -sn_config_set_legacy_hidden (SnConfig *config, - const gchar *name, - gboolean hidden) +sn_config_set_legacy_hidden (SnConfig *config, + const gchar *name, + gboolean hidden) { gchar *name_copy; @@ -816,7 +804,7 @@ sn_config_set_legacy_hidden (SnConfig *config, -GList* +GList * sn_config_get_known_items (SnConfig *config) { g_return_val_if_fail (SN_IS_CONFIG (config), NULL); @@ -826,7 +814,7 @@ sn_config_get_known_items (SnConfig *config) -GList* +GList * sn_config_get_known_legacy_items (SnConfig *config) { g_return_val_if_fail (SN_IS_CONFIG (config), NULL); @@ -836,7 +824,7 @@ sn_config_get_known_legacy_items (SnConfig *config) -GList* +GList * sn_config_get_hidden_legacy_items (SnConfig *config) { GList *list = NULL; @@ -851,7 +839,7 @@ sn_config_get_hidden_legacy_items (SnConfig *config) void -sn_config_add_known_item (SnConfig *config, +sn_config_add_known_item (SnConfig *config, const gchar *name) { GList *li; @@ -860,7 +848,7 @@ sn_config_add_known_item (SnConfig *config, g_return_if_fail (SN_IS_CONFIG (config)); /* check if item is already known */ - for(li = config->known_items; li != NULL; li = li->next) + for (li = config->known_items; li != NULL; li = li->next) if (g_strcmp0 (li->data, name) == 0) return; @@ -880,7 +868,7 @@ sn_config_add_known_item (SnConfig *config, gboolean -sn_config_add_known_legacy_item (SnConfig *config, +sn_config_add_known_legacy_item (SnConfig *config, const gchar *name) { GList *li; @@ -889,7 +877,7 @@ sn_config_add_known_legacy_item (SnConfig *config, g_return_val_if_fail (SN_IS_CONFIG (config), TRUE); /* check if item is already known */ - for(li = config->known_legacy_items; li != NULL; li = li->next) + for (li = config->known_legacy_items; li != NULL; li = li->next) if (g_strcmp0 (li->data, name) == 0) return g_hash_table_contains (config->hidden_legacy_items, name); @@ -911,7 +899,7 @@ sn_config_add_known_legacy_item (SnConfig *config, void -sn_config_swap_known_items (SnConfig *config, +sn_config_swap_known_items (SnConfig *config, const gchar *name1, const gchar *name2) { @@ -919,7 +907,7 @@ sn_config_swap_known_items (SnConfig *config, g_return_if_fail (SN_IS_CONFIG (config)); - for(li = config->known_items; li != NULL; li = li->next) + for (li = config->known_items; li != NULL; li = li->next) if (g_strcmp0 (li->data, name1) == 0) break; @@ -936,7 +924,7 @@ sn_config_swap_known_items (SnConfig *config, /* not strictly necessary (in testing the list contents was preserved) * but searching for the index again should be safer */ - for(li = config->known_items; li != NULL; li = li->next) + for (li = config->known_items; li != NULL; li = li->next) if (g_strcmp0 (li->data, name1) == 0) break; @@ -949,40 +937,41 @@ sn_config_swap_known_items (SnConfig *config, -void sn_config_swap_known_legacy_items(SnConfig *config, - const gchar *name1, - const gchar *name2) +void +sn_config_swap_known_legacy_items (SnConfig *config, + const gchar *name1, + const gchar *name2) { GList *li, *li_tmp; - g_return_if_fail(SN_IS_CONFIG(config)); + g_return_if_fail (SN_IS_CONFIG (config)); for (li = config->known_legacy_items; li != NULL; li = li->next) - if (g_strcmp0(li->data, name1) == 0) + if (g_strcmp0 (li->data, name1) == 0) break; /* make sure that the list contains name1 followed by name2 */ - if (li == NULL || li->next == NULL || g_strcmp0(li->next->data, name2) != 0) - { - panel_debug (PANEL_DEBUG_SYSTRAY, "Couldn't swap items: %s and %s", name1, name2); - return; - } + if (li == NULL || li->next == NULL || g_strcmp0 (li->next->data, name2) != 0) + { + panel_debug (PANEL_DEBUG_SYSTRAY, "Couldn't swap items: %s and %s", name1, name2); + return; + } /* li_tmp will contain only the removed element (name2) */ li_tmp = li->next; - config->known_legacy_items = g_list_remove_link(config->known_legacy_items, li_tmp); + config->known_legacy_items = g_list_remove_link (config->known_legacy_items, li_tmp); /* not strictly necessary (in testing the list contents was preserved) * but searching for the index again should be safer */ for (li = config->known_legacy_items; li != NULL; li = li->next) - if (g_strcmp0(li->data, name1) == 0) + if (g_strcmp0 (li->data, name1) == 0) break; - config->known_legacy_items = g_list_insert_before(config->known_legacy_items, li, li_tmp->data); - g_list_free(li_tmp); + config->known_legacy_items = g_list_insert_before (config->known_legacy_items, li, li_tmp->data); + g_list_free (li_tmp); - g_object_notify(G_OBJECT(config), "known-legacy-items"); - g_signal_emit(G_OBJECT(config), sn_config_signals[LEGACY_ITEM_LIST_CHANGED], 0); + g_object_notify (G_OBJECT (config), "known-legacy-items"); + g_signal_emit (G_OBJECT (config), sn_config_signals[LEGACY_ITEM_LIST_CHANGED], 0); } @@ -1002,8 +991,8 @@ gboolean sn_config_items_clear (SnConfig *config) { GHashTable *collected_known_items; - guint initial_size; - GList *new_list, *li; + guint initial_size; + GList *new_list, *li; collected_known_items = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); @@ -1044,16 +1033,16 @@ sn_config_items_clear (SnConfig *config) gboolean -sn_config_legacy_items_clear(SnConfig *config) +sn_config_legacy_items_clear (SnConfig *config) { - g_list_free_full(config->known_legacy_items, g_free); + g_list_free_full (config->known_legacy_items, g_free); config->known_legacy_items = NULL; g_hash_table_remove_all (config->hidden_legacy_items); - g_object_notify(G_OBJECT(config), "known-legacy-items"); - g_object_notify(G_OBJECT(config), "hidden-legacy-items"); + g_object_notify (G_OBJECT (config), "known-legacy-items"); + g_object_notify (G_OBJECT (config), "hidden-legacy-items"); - g_signal_emit(G_OBJECT(config), sn_config_signals[LEGACY_ITEM_LIST_CHANGED], 0); + g_signal_emit (G_OBJECT (config), sn_config_signals[LEGACY_ITEM_LIST_CHANGED], 0); return TRUE; } @@ -1063,9 +1052,9 @@ sn_config_legacy_items_clear(SnConfig *config) SnConfig * sn_config_new (const gchar *property_base) { - SnConfig *config; + SnConfig *config; XfconfChannel *channel; - gchar *property; + gchar *property; config = g_object_new (SN_TYPE_CONFIG, NULL); diff --git a/plugins/systray/sn-config.h b/plugins/systray/sn-config.h index b52292eb3..298aea855 100644 --- a/plugins/systray/sn-config.h +++ b/plugins/systray/sn-config.h @@ -27,87 +27,114 @@ G_BEGIN_DECLS #define SN_TYPE_CONFIG (sn_config_get_type ()) G_DECLARE_FINAL_TYPE (SnConfig, sn_config, SN, CONFIG, GObject) -#define DEFAULT_ICON_SIZE 22 -#define DEFAULT_SINGLE_ROW FALSE -#define DEFAULT_SQUARE_ICONS FALSE -#define DEFAULT_SYMBOLIC_ICONS FALSE -#define DEFAULT_MENU_IS_PRIMARY FALSE -#define DEFAULT_ORIENTATION GTK_ORIENTATION_HORIZONTAL -#define DEFAULT_PANEL_ORIENTATION GTK_ORIENTATION_HORIZONTAL -#define DEFAULT_PANEL_SIZE 28 -#define DEFAULT_HIDE_NEW_ITEMS FALSE - -SnConfig *sn_config_new (const gchar *property_base); - -void sn_config_set_orientation (SnConfig *config, - GtkOrientation panel_orientation, - GtkOrientation orientation); - -GtkOrientation sn_config_get_orientation (SnConfig *config); - -GtkOrientation sn_config_get_panel_orientation (SnConfig *config); - -void sn_config_set_size (SnConfig *config, - gint panel_size, - gint nrows, - gint icon_size); - -gint sn_config_get_nrows (SnConfig *config); - -gint sn_config_get_panel_size (SnConfig *config); - -gboolean sn_config_get_single_row (SnConfig *config); - -gboolean sn_config_get_square_icons (SnConfig *config); - -gboolean sn_config_get_symbolic_icons (SnConfig *config); - -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, - gint *ret_row_size, - gint *ret_padding); - -gboolean sn_config_is_hidden (SnConfig *config, - const gchar *name); - -void sn_config_set_hidden (SnConfig *config, - const gchar *name, - gboolean filtered); - -gboolean sn_config_is_legacy_hidden (SnConfig *config, - const gchar *name); - -void sn_config_set_legacy_hidden (SnConfig *config, - const gchar *name, - gboolean filtered); - -GList *sn_config_get_known_items (SnConfig *config); - -void sn_config_add_known_item (SnConfig *config, - const gchar *name); - -GList *sn_config_get_known_legacy_items (SnConfig *config); -GList *sn_config_get_hidden_legacy_items (SnConfig *config); - -gboolean sn_config_add_known_legacy_item (SnConfig *config, - const gchar *name); - -void sn_config_swap_known_items (SnConfig *config, - const gchar *name1, - const gchar *name2); -void sn_config_swap_known_legacy_items (SnConfig *config, - const gchar *name1, - const gchar *name2); - -gboolean sn_config_items_clear (SnConfig *config); -gboolean sn_config_legacy_items_clear (SnConfig *config); +#define DEFAULT_ICON_SIZE 22 +#define DEFAULT_SINGLE_ROW FALSE +#define DEFAULT_SQUARE_ICONS FALSE +#define DEFAULT_SYMBOLIC_ICONS FALSE +#define DEFAULT_MENU_IS_PRIMARY FALSE +#define DEFAULT_ORIENTATION GTK_ORIENTATION_HORIZONTAL +#define DEFAULT_PANEL_ORIENTATION GTK_ORIENTATION_HORIZONTAL +#define DEFAULT_PANEL_SIZE 28 +#define DEFAULT_HIDE_NEW_ITEMS FALSE + +SnConfig * +sn_config_new (const gchar *property_base); + +void +sn_config_set_orientation (SnConfig *config, + GtkOrientation panel_orientation, + GtkOrientation orientation); + +GtkOrientation +sn_config_get_orientation (SnConfig *config); + +GtkOrientation +sn_config_get_panel_orientation (SnConfig *config); + +void +sn_config_set_size (SnConfig *config, + gint panel_size, + gint nrows, + gint icon_size); + +gint +sn_config_get_nrows (SnConfig *config); + +gint +sn_config_get_panel_size (SnConfig *config); + +gboolean +sn_config_get_single_row (SnConfig *config); + +gboolean +sn_config_get_square_icons (SnConfig *config); + +gboolean +sn_config_get_symbolic_icons (SnConfig *config); + +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, + gint *ret_row_size, + gint *ret_padding); + +gboolean +sn_config_is_hidden (SnConfig *config, + const gchar *name); + +void +sn_config_set_hidden (SnConfig *config, + const gchar *name, + gboolean filtered); + +gboolean +sn_config_is_legacy_hidden (SnConfig *config, + const gchar *name); + +void +sn_config_set_legacy_hidden (SnConfig *config, + const gchar *name, + gboolean filtered); + +GList * +sn_config_get_known_items (SnConfig *config); + +void +sn_config_add_known_item (SnConfig *config, + const gchar *name); + +GList * +sn_config_get_known_legacy_items (SnConfig *config); +GList * +sn_config_get_hidden_legacy_items (SnConfig *config); + +gboolean +sn_config_add_known_legacy_item (SnConfig *config, + const gchar *name); + +void +sn_config_swap_known_items (SnConfig *config, + const gchar *name1, + const gchar *name2); +void +sn_config_swap_known_legacy_items (SnConfig *config, + const gchar *name1, + const gchar *name2); + +gboolean +sn_config_items_clear (SnConfig *config); +gboolean +sn_config_legacy_items_clear (SnConfig *config); G_END_DECLS diff --git a/plugins/systray/sn-dialog.c b/plugins/systray/sn-dialog.c index bc40ddac2..a08442e61 100644 --- a/plugins/systray/sn-dialog.c +++ b/plugins/systray/sn-dialog.c @@ -34,24 +34,26 @@ -static gboolean sn_dialog_build (SnDialog *dialog); +static gboolean +sn_dialog_build (SnDialog *dialog); -static void sn_dialog_finalize (GObject *object); +static void +sn_dialog_finalize (GObject *object); struct _SnDialog { - GObject __parent__; - - GtkBuilder *builder; - GtkWidget *dialog; - GtkWidget *auto_size; - GtkWidget *size_spinbutton; - GtkWidget *size_revealer; - GObject *store; - GObject *legacy_store; - SnConfig *config; + GObject __parent__; + + GtkBuilder *builder; + GtkWidget *dialog; + GtkWidget *auto_size; + GtkWidget *size_spinbutton; + GtkWidget *size_revealer; + GObject *store; + GObject *legacy_store; + SnConfig *config; }; G_DEFINE_FINAL_TYPE (SnDialog, sn_dialog, G_TYPE_OBJECT) @@ -69,8 +71,7 @@ enum /* known applications to improve the icon and name */ -static const gchar *known_applications[][3] = -{ +static const gchar *known_applications[][3] = { /* application name, icon-name, understandable name */ { "blueman", "blueman", "Blueman Applet" }, { "nm-applet", "network-workgroup", "Network Manager Applet" }, @@ -82,8 +83,7 @@ static const gchar *known_applications[][3] = { "zoom", "Zoom", "Zoom" }, }; -static const gchar *known_legacy_applications[][3] = -{ +static const gchar *known_legacy_applications[][3] = { /* application name, icon-name, understandable name */ { "audacious2", "audacious", "Audacious" }, { "drop-down terminal", "utilities-terminal", "Xfce Dropdown Terminal" }, @@ -121,19 +121,19 @@ sn_dialog_init (SnDialog *dialog) { dialog->builder = NULL; dialog->dialog = NULL; - dialog->store = NULL; - dialog->legacy_store = NULL; + dialog->store = NULL; + dialog->legacy_store = NULL; dialog->config = NULL; } static void -sn_dialog_add_item (SnDialog *dialog, - GIcon *icon, +sn_dialog_add_item (SnDialog *dialog, + GIcon *icon, const gchar *name, const gchar *title, - gboolean hidden) + gboolean hidden) { GtkTreeIter iter; @@ -144,36 +144,36 @@ sn_dialog_add_item (SnDialog *dialog, /* insert in the store */ gtk_list_store_append (GTK_LIST_STORE (dialog->store), &iter); gtk_list_store_set (GTK_LIST_STORE (dialog->store), &iter, - COLUMN_ICON, icon, - COLUMN_TITLE, title, - COLUMN_HIDDEN, hidden, - COLUMN_TIP, name, + COLUMN_ICON, icon, + COLUMN_TITLE, title, + COLUMN_HIDDEN, hidden, + COLUMN_TIP, name, -1); } static void -sn_dialog_add_legacy_item(SnDialog *dialog, - GIcon *icon, - const gchar *name, - const gchar *title, - gboolean hidden) +sn_dialog_add_legacy_item (SnDialog *dialog, + GIcon *icon, + const gchar *name, + const gchar *title, + gboolean hidden) { GtkTreeIter iter; - g_return_if_fail(SN_IS_DIALOG(dialog)); - g_return_if_fail(GTK_IS_LIST_STORE(dialog->legacy_store)); - g_return_if_fail(name == NULL || g_utf8_validate(name, -1, NULL)); + g_return_if_fail (SN_IS_DIALOG (dialog)); + g_return_if_fail (GTK_IS_LIST_STORE (dialog->legacy_store)); + g_return_if_fail (name == NULL || g_utf8_validate (name, -1, NULL)); /* insert in the store */ - gtk_list_store_append(GTK_LIST_STORE(dialog->legacy_store), &iter); - gtk_list_store_set(GTK_LIST_STORE(dialog->legacy_store), &iter, - COLUMN_ICON, icon, - COLUMN_TITLE, title, - COLUMN_HIDDEN, hidden, - COLUMN_TIP, name, - -1); + gtk_list_store_append (GTK_LIST_STORE (dialog->legacy_store), &iter); + gtk_list_store_set (GTK_LIST_STORE (dialog->legacy_store), &iter, + COLUMN_ICON, icon, + COLUMN_TITLE, title, + COLUMN_HIDDEN, hidden, + COLUMN_TIP, name, + -1); } @@ -181,12 +181,12 @@ sn_dialog_add_legacy_item(SnDialog *dialog, static void sn_dialog_update_names (SnDialog *dialog) { - GList *li; + GList *li; const gchar *name; const gchar *title; const gchar *icon_name; - GIcon *icon; - guint i; + GIcon *icon; + guint i; g_return_if_fail (SN_IS_DIALOG (dialog)); g_return_if_fail (SN_IS_CONFIG (dialog->config)); @@ -225,7 +225,7 @@ sn_dialog_update_names (SnDialog *dialog) static void -sn_dialog_update_legacy_names(SnDialog *dialog) +sn_dialog_update_legacy_names (SnDialog *dialog) { GList *li; const gchar *name; @@ -234,53 +234,53 @@ sn_dialog_update_legacy_names(SnDialog *dialog) GIcon *icon; guint i; - g_return_if_fail(SN_IS_DIALOG(dialog)); - g_return_if_fail(SN_IS_CONFIG(dialog->config)); - g_return_if_fail(GTK_IS_LIST_STORE(dialog->legacy_store)); - - for (li = sn_config_get_known_legacy_items(dialog->config); li != NULL; li = li->next) - { - name = li->data; - title = name; - icon_name = name; - icon = NULL; + g_return_if_fail (SN_IS_DIALOG (dialog)); + g_return_if_fail (SN_IS_CONFIG (dialog->config)); + g_return_if_fail (GTK_IS_LIST_STORE (dialog->legacy_store)); - /* check if we have a better name for the application */ - for (i = 0; i < G_N_ELEMENTS(known_legacy_applications); i++) + for (li = sn_config_get_known_legacy_items (dialog->config); li != NULL; li = li->next) { - if (strcmp(name, known_legacy_applications[i][0]) == 0) - { - icon_name = known_legacy_applications[i][1]; - title = known_legacy_applications[i][2]; - break; - } - } + name = li->data; + title = name; + icon_name = name; + icon = NULL; + + /* check if we have a better name for the application */ + for (i = 0; i < G_N_ELEMENTS (known_legacy_applications); i++) + { + if (strcmp (name, known_legacy_applications[i][0]) == 0) + { + icon_name = known_legacy_applications[i][1]; + title = known_legacy_applications[i][2]; + break; + } + } - if (gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), icon_name)) - icon = g_themed_icon_new(icon_name); + if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), icon_name)) + icon = g_themed_icon_new (icon_name); - /* insert item in the store */ - sn_dialog_add_legacy_item(dialog, icon, name, title, - sn_config_is_legacy_hidden(dialog->config, name)); + /* insert item in the store */ + sn_dialog_add_legacy_item (dialog, icon, name, title, + sn_config_is_legacy_hidden (dialog->config, name)); - if (icon != NULL) - g_object_unref(G_OBJECT(icon)); - } + if (icon != NULL) + g_object_unref (G_OBJECT (icon)); + } } static void sn_dialog_selection_changed (GtkTreeSelection *selection, - SnDialog *dialog) + SnDialog *dialog) { GtkTreeModel *model; - GtkTreeIter iter; - GtkTreePath *path; - gint *indices; - gint count = 0, position = -1, depth; - gboolean item_up_sensitive, item_down_sensitive; - GObject *object; + GtkTreeIter iter; + GtkTreePath *path; + gint *indices; + gint count = 0, position = -1, depth; + gboolean item_up_sensitive, item_down_sensitive; + GObject *object; if (gtk_tree_selection_get_selected (selection, &model, &iter)) { @@ -311,15 +311,15 @@ sn_dialog_selection_changed (GtkTreeSelection *selection, static void sn_dialog_legacy_selection_changed (GtkTreeSelection *selection, - SnDialog *dialog) + SnDialog *dialog) { GtkTreeModel *model; - GtkTreeIter iter; - GtkTreePath *path; - gint *indices; - gint count = 0, position = -1, depth; - gboolean item_up_sensitive, item_down_sensitive; - GObject *object; + GtkTreeIter iter; + GtkTreePath *path; + gint *indices; + gint count = 0, position = -1, depth; + gboolean item_up_sensitive, item_down_sensitive; + GObject *object; if (gtk_tree_selection_get_selected (selection, &model, &iter)) { @@ -350,12 +350,12 @@ sn_dialog_legacy_selection_changed (GtkTreeSelection *selection, static void sn_dialog_hidden_toggled (GtkCellRendererToggle *renderer, - const gchar *path_string, - SnDialog *dialog) + const gchar *path_string, + SnDialog *dialog) { - GtkTreeIter iter; - gboolean hidden; - gchar *name; + GtkTreeIter iter; + gboolean hidden; + gchar *name; g_return_if_fail (SN_IS_DIALOG (dialog)); g_return_if_fail (SN_IS_CONFIG (dialog->config)); @@ -382,12 +382,12 @@ sn_dialog_hidden_toggled (GtkCellRendererToggle *renderer, static void sn_dialog_legacy_hidden_toggled (GtkCellRendererToggle *renderer, - const gchar *path_string, - SnDialog *dialog) + const gchar *path_string, + SnDialog *dialog) { - GtkTreeIter iter; - gboolean hidden; - gchar *name; + GtkTreeIter iter; + gboolean hidden; + gchar *name; g_return_if_fail (SN_IS_DIALOG (dialog)); g_return_if_fail (SN_IS_CONFIG (dialog->config)); @@ -413,39 +413,39 @@ sn_dialog_legacy_hidden_toggled (GtkCellRendererToggle *renderer, static void -sn_dialog_swap_rows (SnDialog *dialog, +sn_dialog_swap_rows (SnDialog *dialog, GtkTreeIter *iter_prev, GtkTreeIter *iter) { - GIcon *icon1, *icon2; - gchar *title1, *title2; - gboolean hidden1, hidden2; - gchar *tip1, *tip2; + GIcon *icon1, *icon2; + gchar *title1, *title2; + gboolean hidden1, hidden2; + gchar *tip1, *tip2; g_return_if_fail (SN_IS_DIALOG (dialog)); g_return_if_fail (SN_IS_CONFIG (dialog->config)); g_return_if_fail (GTK_IS_LIST_STORE (dialog->store)); gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), iter_prev, - COLUMN_ICON, &icon1, - COLUMN_TITLE, &title1, - COLUMN_HIDDEN, &hidden1, - COLUMN_TIP, &tip1, -1); + COLUMN_ICON, &icon1, + COLUMN_TITLE, &title1, + COLUMN_HIDDEN, &hidden1, + COLUMN_TIP, &tip1, -1); gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), iter, - COLUMN_ICON, &icon2, - COLUMN_TITLE, &title2, - COLUMN_HIDDEN, &hidden2, - COLUMN_TIP, &tip2, -1); + COLUMN_ICON, &icon2, + COLUMN_TITLE, &title2, + COLUMN_HIDDEN, &hidden2, + COLUMN_TIP, &tip2, -1); gtk_list_store_set (GTK_LIST_STORE (dialog->store), iter_prev, - COLUMN_ICON, icon2, - COLUMN_TITLE, title2, - COLUMN_HIDDEN, hidden2, - COLUMN_TIP, tip2, -1); + COLUMN_ICON, icon2, + COLUMN_TITLE, title2, + COLUMN_HIDDEN, hidden2, + COLUMN_TIP, tip2, -1); gtk_list_store_set (GTK_LIST_STORE (dialog->store), iter, - COLUMN_ICON, icon1, - COLUMN_TITLE, title1, - COLUMN_HIDDEN, hidden1, - COLUMN_TIP, tip1, -1); + COLUMN_ICON, icon1, + COLUMN_TITLE, title1, + COLUMN_HIDDEN, hidden1, + COLUMN_TIP, tip1, -1); /* do a matching operation on SnConfig */ sn_config_swap_known_items (dialog->config, tip1, tip2); @@ -454,42 +454,42 @@ sn_dialog_swap_rows (SnDialog *dialog, static void -sn_dialog_legacy_swap_rows(SnDialog *dialog, - GtkTreeIter *iter_prev, - GtkTreeIter *iter) +sn_dialog_legacy_swap_rows (SnDialog *dialog, + GtkTreeIter *iter_prev, + GtkTreeIter *iter) { GIcon *icon1, *icon2; gchar *title1, *title2; gboolean hidden1, hidden2; gchar *tip1, *tip2; - g_return_if_fail(SN_IS_DIALOG(dialog)); - g_return_if_fail(SN_IS_CONFIG(dialog->config)); - g_return_if_fail(GTK_IS_LIST_STORE(dialog->legacy_store)); - - gtk_tree_model_get(GTK_TREE_MODEL(dialog->legacy_store), iter_prev, - COLUMN_ICON, &icon1, - COLUMN_TITLE, &title1, - COLUMN_HIDDEN, &hidden1, - COLUMN_TIP, &tip1, -1); - gtk_tree_model_get(GTK_TREE_MODEL(dialog->legacy_store), iter, - COLUMN_ICON, &icon2, - COLUMN_TITLE, &title2, - COLUMN_HIDDEN, &hidden2, - COLUMN_TIP, &tip2, -1); - gtk_list_store_set(GTK_LIST_STORE(dialog->legacy_store), iter_prev, - COLUMN_ICON, icon2, - COLUMN_TITLE, title2, - COLUMN_HIDDEN, hidden2, - COLUMN_TIP, tip2, -1); - gtk_list_store_set(GTK_LIST_STORE(dialog->legacy_store), iter, - COLUMN_ICON, icon1, - COLUMN_TITLE, title1, - COLUMN_HIDDEN, hidden1, - COLUMN_TIP, tip1, -1); + g_return_if_fail (SN_IS_DIALOG (dialog)); + g_return_if_fail (SN_IS_CONFIG (dialog->config)); + g_return_if_fail (GTK_IS_LIST_STORE (dialog->legacy_store)); + + gtk_tree_model_get (GTK_TREE_MODEL (dialog->legacy_store), iter_prev, + COLUMN_ICON, &icon1, + COLUMN_TITLE, &title1, + COLUMN_HIDDEN, &hidden1, + COLUMN_TIP, &tip1, -1); + gtk_tree_model_get (GTK_TREE_MODEL (dialog->legacy_store), iter, + COLUMN_ICON, &icon2, + COLUMN_TITLE, &title2, + COLUMN_HIDDEN, &hidden2, + COLUMN_TIP, &tip2, -1); + gtk_list_store_set (GTK_LIST_STORE (dialog->legacy_store), iter_prev, + COLUMN_ICON, icon2, + COLUMN_TITLE, title2, + COLUMN_HIDDEN, hidden2, + COLUMN_TIP, tip2, -1); + gtk_list_store_set (GTK_LIST_STORE (dialog->legacy_store), iter, + COLUMN_ICON, icon1, + COLUMN_TITLE, title1, + COLUMN_HIDDEN, hidden1, + COLUMN_TIP, tip1, -1); /* do a matching operation on SnConfig */ - sn_config_swap_known_legacy_items(dialog->config, tip1, tip2); + sn_config_swap_known_legacy_items (dialog->config, tip1, tip2); } @@ -498,9 +498,9 @@ static gboolean sn_dialog_iter_equal (GtkTreeIter *iter1, GtkTreeIter *iter2) { - return (iter1->user_data == iter2->user_data && - iter1->user_data2 == iter2->user_data2 && - iter1->user_data3 == iter2->user_data3); + return iter1->user_data == iter2->user_data + && iter1->user_data2 == iter2->user_data2 + && iter1->user_data3 == iter2->user_data3; } @@ -509,9 +509,9 @@ static void sn_dialog_item_up_clicked (GtkWidget *button, SnDialog *dialog) { - GObject *treeview; + GObject *treeview; GtkTreeSelection *selection; - GtkTreeIter iter, iter_prev, iter_tmp; + GtkTreeIter iter, iter_prev, iter_tmp; g_return_if_fail (SN_IS_DIALOG (dialog)); g_return_if_fail (GTK_IS_LIST_STORE (dialog->store)); @@ -543,38 +543,38 @@ sn_dialog_item_up_clicked (GtkWidget *button, static void -sn_dialog_legacy_item_up_clicked(GtkWidget *button, - SnDialog *dialog) +sn_dialog_legacy_item_up_clicked (GtkWidget *button, + SnDialog *dialog) { GObject *treeview; GtkTreeSelection *selection; GtkTreeIter iter, iter_prev, iter_tmp; - g_return_if_fail(SN_IS_DIALOG(dialog)); - g_return_if_fail(GTK_IS_LIST_STORE(dialog->legacy_store)); + g_return_if_fail (SN_IS_DIALOG (dialog)); + g_return_if_fail (GTK_IS_LIST_STORE (dialog->legacy_store)); - treeview = gtk_builder_get_object(dialog->builder, "legacy-items-treeview"); - g_return_if_fail(GTK_IS_TREE_VIEW(treeview)); + treeview = gtk_builder_get_object (dialog->builder, "legacy-items-treeview"); + g_return_if_fail (GTK_IS_TREE_VIEW (treeview)); - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); - if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); + if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) return; /* gtk_tree_model_iter_previous available from Gtk3 */ /* so we have to search for it starting from the first iter */ - if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(dialog->legacy_store), &iter_prev)) + if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->legacy_store), &iter_prev)) return; iter_tmp = iter_prev; - while (!sn_dialog_iter_equal(&iter_tmp, &iter)) - { - iter_prev = iter_tmp; - if (!gtk_tree_model_iter_next(GTK_TREE_MODEL(dialog->legacy_store), &iter_tmp)) - return; - } - - sn_dialog_legacy_swap_rows(dialog, &iter_prev, &iter); - gtk_tree_selection_select_iter(selection, &iter_prev); + while (!sn_dialog_iter_equal (&iter_tmp, &iter)) + { + iter_prev = iter_tmp; + if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->legacy_store), &iter_tmp)) + return; + } + + sn_dialog_legacy_swap_rows (dialog, &iter_prev, &iter); + gtk_tree_selection_select_iter (selection, &iter_prev); } @@ -583,9 +583,9 @@ static void sn_dialog_item_down_clicked (GtkWidget *button, SnDialog *dialog) { - GObject *treeview; + GObject *treeview; GtkTreeSelection *selection; - GtkTreeIter iter, iter_next; + GtkTreeIter iter, iter_next; g_return_if_fail (SN_IS_DIALOG (dialog)); @@ -607,28 +607,28 @@ sn_dialog_item_down_clicked (GtkWidget *button, static void -sn_dialog_legacy_item_down_clicked(GtkWidget *button, - SnDialog *dialog) +sn_dialog_legacy_item_down_clicked (GtkWidget *button, + SnDialog *dialog) { GObject *treeview; GtkTreeSelection *selection; GtkTreeIter iter, iter_next; - g_return_if_fail(SN_IS_DIALOG(dialog)); + g_return_if_fail (SN_IS_DIALOG (dialog)); - treeview = gtk_builder_get_object(dialog->builder, "legacy-items-treeview"); - g_return_if_fail(GTK_IS_TREE_VIEW(treeview)); + treeview = gtk_builder_get_object (dialog->builder, "legacy-items-treeview"); + g_return_if_fail (GTK_IS_TREE_VIEW (treeview)); - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); - if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); + if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) return; iter_next = iter; - if (!gtk_tree_model_iter_next(GTK_TREE_MODEL(dialog->legacy_store), &iter_next)) + if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->legacy_store), &iter_next)) return; - sn_dialog_legacy_swap_rows(dialog, &iter, &iter_next); - gtk_tree_selection_select_iter(selection, &iter_next); + sn_dialog_legacy_swap_rows (dialog, &iter, &iter_next); + gtk_tree_selection_select_iter (selection, &iter_next); } @@ -637,12 +637,12 @@ static void sn_dialog_clear_clicked (GtkWidget *button, SnDialog *dialog) { + const gchar *label = _("Clear"); + g_return_if_fail (SN_IS_DIALOG (dialog)); - if (xfce_dialog_confirm (GTK_WINDOW (gtk_widget_get_toplevel (button)), - "edit-clear", _("Clear"), NULL, - _("Are you sure you want to clear the list of " - "known items?"))) + if (xfce_dialog_confirm (GTK_WINDOW (gtk_widget_get_toplevel (button)), "edit-clear", label, + NULL, _("Are you sure you want to clear the list of known items?"))) { if (sn_config_items_clear (dialog->config)) { @@ -660,8 +660,8 @@ sn_dialog_clear_clicked (GtkWidget *button, static void -sn_dialog_dialog_unref (gpointer data, - GObject *where_the_object_was) +sn_dialog_dialog_unref (gpointer data, + GObject *where_the_object_was) { SnDialog *dialog = data; @@ -672,12 +672,12 @@ sn_dialog_dialog_unref (gpointer data, static void -reveal_icon_size (GtkWidget *widget, +reveal_icon_size (GtkWidget *widget, GParamSpec *pspec, - SnDialog *dialog) + SnDialog *dialog) { gboolean active; - gint icon_size; + gint icon_size; g_return_if_fail (SN_IS_DIALOG (dialog)); @@ -697,8 +697,8 @@ reveal_icon_size (GtkWidget *widget, static gboolean sn_dialog_build (SnDialog *dialog) { - GObject *object; - GError *error = NULL; + GObject *object; + GError *error = NULL; GtkTreeSelection *selection; if (xfce_titled_dialog_get_type () == 0) @@ -728,9 +728,8 @@ sn_dialog_build (SnDialog *dialog) 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); + 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"); @@ -867,7 +866,7 @@ sn_dialog_build (SnDialog *dialog) SnDialog * -sn_dialog_new (SnConfig *config, +sn_dialog_new (SnConfig *config, GdkScreen *screen) { SnDialog *dialog; diff --git a/plugins/systray/sn-dialog.h b/plugins/systray/sn-dialog.h index c86a983ec..a1a7557f0 100644 --- a/plugins/systray/sn-dialog.h +++ b/plugins/systray/sn-dialog.h @@ -29,8 +29,9 @@ G_BEGIN_DECLS #define SN_TYPE_DIALOG (sn_dialog_get_type ()) G_DECLARE_FINAL_TYPE (SnDialog, sn_dialog, SN, DIALOG, GObject) -SnDialog *sn_dialog_new (SnConfig *config, - GdkScreen *screen); +SnDialog * +sn_dialog_new (SnConfig *config, + GdkScreen *screen); G_END_DECLS diff --git a/plugins/systray/sn-icon-box.c b/plugins/systray/sn-icon-box.c index a5f1694c2..a1e86e9a8 100644 --- a/plugins/systray/sn-icon-box.c +++ b/plugins/systray/sn-icon-box.c @@ -29,39 +29,46 @@ -static void sn_icon_box_icon_changed (GtkWidget *widget); +static void +sn_icon_box_icon_changed (GtkWidget *widget); -static void sn_icon_box_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); +static void +sn_icon_box_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width); -static void sn_icon_box_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height); +static void +sn_icon_box_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height); -static void sn_icon_box_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); +static void +sn_icon_box_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); -static void sn_icon_box_remove (GtkContainer *container, - GtkWidget *child); +static void +sn_icon_box_remove (GtkContainer *container, + GtkWidget *child); -static GType sn_icon_box_child_type (GtkContainer *container); +static GType +sn_icon_box_child_type (GtkContainer *container); -static void sn_icon_box_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data); +static void +sn_icon_box_forall (GtkContainer *container, + gboolean include_internals, + GtkCallback callback, + gpointer callback_data); struct _SnIconBox { - GtkContainer __parent__; + GtkContainer __parent__; - SnItem *item; - SnConfig *config; + SnItem *item; + SnConfig *config; - GtkWidget *icon; - GtkWidget *overlay; + GtkWidget *icon; + GtkWidget *overlay; }; G_DEFINE_FINAL_TYPE (SnIconBox, sn_icon_box, GTK_TYPE_CONTAINER) @@ -71,7 +78,7 @@ G_DEFINE_FINAL_TYPE (SnIconBox, sn_icon_box, GTK_TYPE_CONTAINER) static void sn_icon_box_class_init (SnIconBoxClass *klass) { - GtkWidgetClass *widget_class; + GtkWidgetClass *widget_class; GtkContainerClass *container_class; widget_class = GTK_WIDGET_CLASS (klass); @@ -115,9 +122,9 @@ sn_icon_box_child_type (GtkContainer *container) static void sn_icon_box_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data) + gboolean include_internals, + GtkCallback callback, + gpointer callback_data) { SnIconBox *box = XFCE_SN_ICON_BOX (container); @@ -134,7 +141,7 @@ sn_icon_box_forall (GtkContainer *container, static void sn_icon_box_remove (GtkContainer *container, - GtkWidget *child) + GtkWidget *child) { SnIconBox *box; @@ -159,10 +166,10 @@ sn_icon_box_remove (GtkContainer *container, GtkWidget * -sn_icon_box_new (SnItem *item, +sn_icon_box_new (SnItem *item, SnConfig *config) { - SnIconBox *box = g_object_new (XFCE_TYPE_SN_ICON_BOX, NULL); + SnIconBox *box = g_object_new (XFCE_TYPE_SN_ICON_BOX, NULL); GtkSettings *settings; g_return_val_if_fail (SN_IS_CONFIG (config), NULL); @@ -202,14 +209,14 @@ sn_icon_box_new (SnItem *item, static GdkPixbuf * -sn_icon_box_load_icon (GtkWidget *image, +sn_icon_box_load_icon (GtkWidget *image, GtkIconTheme *icon_theme, - const gchar *icon_name, - gint icon_size, - gboolean prefer_symbolic) + const gchar *icon_name, + gint icon_size, + gboolean prefer_symbolic) { GtkIconInfo *info; - GdkPixbuf *pixbuf = NULL; + GdkPixbuf *pixbuf = NULL; info = gtk_icon_theme_lookup_icon_for_scale (icon_theme, icon_name, icon_size, gtk_widget_get_scale_factor (image), @@ -228,18 +235,18 @@ sn_icon_box_load_icon (GtkWidget *image, static void -sn_icon_box_apply_icon (GtkWidget *image, +sn_icon_box_apply_icon (GtkWidget *image, GtkIconTheme *icon_theme, GtkIconTheme *icon_theme_from_path, - const gchar *icon_name, - GdkPixbuf *icon_pixbuf, - gint icon_size, - gboolean prefer_symbolic) + const gchar *icon_name, + GdkPixbuf *icon_pixbuf, + gint icon_size, + gboolean prefer_symbolic) { GdkPixbuf *work_pixbuf = NULL; - gchar *work_icon_name = NULL; - gint width, height, scale_factor; - gchar *s1, *s2; + gchar *work_icon_name = NULL; + gint width, height, scale_factor; + gchar *s1, *s2; gtk_image_clear (GTK_IMAGE (image)); @@ -320,16 +327,16 @@ sn_icon_box_apply_icon (GtkWidget *image, static void sn_icon_box_icon_changed (GtkWidget *widget) { - SnIconBox *box; - const gchar *icon_name; - GdkPixbuf *icon_pixbuf; - const gchar *overlay_icon_name; - GdkPixbuf *overlay_icon_pixbuf; - const gchar *theme_path; + SnIconBox *box; + const gchar *icon_name; + GdkPixbuf *icon_pixbuf; + const gchar *overlay_icon_name; + GdkPixbuf *overlay_icon_pixbuf; + const gchar *theme_path; GtkIconTheme *icon_theme; GtkIconTheme *icon_theme_from_path = NULL; - gint icon_size; - gboolean symbolic_icons; + gint icon_size; + gboolean symbolic_icons; box = XFCE_SN_ICON_BOX (widget); icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (widget))); @@ -364,22 +371,23 @@ sn_icon_box_icon_changed (GtkWidget *widget) static void sn_icon_box_get_preferred_size (GtkWidget *widget, - gint *minimum_size, - gint *natural_size, - gboolean horizontal) + gint *minimum_size, + gint *natural_size, + gboolean horizontal) { - SnIconBox *box = XFCE_SN_ICON_BOX (widget); - gint icon_size; - GtkRequisition child_req; - GdkPixbuf *pixbuf1, *pixbuf2; + SnIconBox *box = XFCE_SN_ICON_BOX (widget); + gint icon_size; + GtkRequisition child_req; + GdkPixbuf *pixbuf1, *pixbuf2; icon_size = sn_config_get_icon_size (box->config); pixbuf1 = gtk_image_get_pixbuf (GTK_IMAGE (box->icon)); pixbuf2 = gtk_image_get_pixbuf (GTK_IMAGE (box->overlay)); - if (pixbuf2 != NULL && (pixbuf1 == NULL || - gdk_pixbuf_get_width (pixbuf2) > gdk_pixbuf_get_width (pixbuf1) || - gdk_pixbuf_get_height (pixbuf2) > gdk_pixbuf_get_height (pixbuf1))) + if (pixbuf2 != NULL + && (pixbuf1 == NULL + || gdk_pixbuf_get_width (pixbuf2) > gdk_pixbuf_get_width (pixbuf1) + || gdk_pixbuf_get_height (pixbuf2) > gdk_pixbuf_get_height (pixbuf1))) { pixbuf1 = pixbuf2; } @@ -411,8 +419,8 @@ sn_icon_box_get_preferred_size (GtkWidget *widget, static void sn_icon_box_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) + gint *minimum_width, + gint *natural_width) { sn_icon_box_get_preferred_size (widget, minimum_width, natural_width, TRUE); } @@ -421,8 +429,8 @@ sn_icon_box_get_preferred_width (GtkWidget *widget, static void sn_icon_box_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) + gint *minimum_height, + gint *natural_height) { sn_icon_box_get_preferred_size (widget, minimum_height, natural_height, FALSE); } @@ -430,7 +438,7 @@ sn_icon_box_get_preferred_height (GtkWidget *widget, static void -sn_icon_box_size_allocate (GtkWidget *widget, +sn_icon_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { SnIconBox *box = XFCE_SN_ICON_BOX (widget); diff --git a/plugins/systray/sn-icon-box.h b/plugins/systray/sn-icon-box.h index 1935c2ae2..05e382505 100644 --- a/plugins/systray/sn-icon-box.h +++ b/plugins/systray/sn-icon-box.h @@ -29,8 +29,9 @@ G_BEGIN_DECLS #define XFCE_TYPE_SN_ICON_BOX (sn_icon_box_get_type ()) G_DECLARE_FINAL_TYPE (SnIconBox, sn_icon_box, XFCE, SN_ICON_BOX, GtkContainer) -GtkWidget *sn_icon_box_new (SnItem *item, - SnConfig *config); +GtkWidget * +sn_icon_box_new (SnItem *item, + SnConfig *config); G_END_DECLS diff --git a/plugins/systray/sn-item.c b/plugins/systray/sn-item.c index 75eb4bb92..53fa268bc 100644 --- a/plugins/systray/sn-item.c +++ b/plugins/systray/sn-item.c @@ -34,65 +34,70 @@ -static void sn_item_finalize (GObject *object); +static void +sn_item_finalize (GObject *object); -static void sn_item_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); +static void +sn_item_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); -static void sn_item_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); +static void +sn_item_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); -static void sn_item_signal_received (GDBusProxy *proxy, - gchar *sender_name, - gchar *signal_name, - GVariant *parameters, - gpointer user_data); +static void +sn_item_signal_received (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + gpointer user_data); -static void sn_item_get_all_properties_result (GObject *source_object, - GAsyncResult *res, - gpointer user_data); +static void +sn_item_get_all_properties_result (GObject *source_object, + GAsyncResult *res, + gpointer user_data); struct _SnItem { - GObject __parent__; - - gboolean started; - gboolean initialized; - gboolean exposed; - - GCancellable *cancellable; - GDBusProxy *item_proxy; - GDBusProxy *properties_proxy; - - gchar *bus_name; - gchar *object_path; - gchar *key; - - gchar *id; - gchar *title; - gchar *tooltip_title; - gchar *tooltip_subtitle; - gchar *icon_desc; - gchar *attention_desc; - - gchar *status; - gchar *icon_name; - gchar *attention_icon_name; - gchar *overlay_icon_name; - GdkPixbuf *icon_pixbuf; - GdkPixbuf *attention_icon_pixbuf; - GdkPixbuf *overlay_icon_pixbuf; - gchar *icon_theme_path; - - gboolean item_is_menu; - gchar *menu_object_path; - GtkWidget *cached_menu; + GObject __parent__; + + gboolean started; + gboolean initialized; + gboolean exposed; + + GCancellable *cancellable; + GDBusProxy *item_proxy; + GDBusProxy *properties_proxy; + + gchar *bus_name; + gchar *object_path; + gchar *key; + + gchar *id; + gchar *title; + gchar *tooltip_title; + gchar *tooltip_subtitle; + gchar *icon_desc; + gchar *attention_desc; + + gchar *status; + gchar *icon_name; + gchar *attention_icon_name; + gchar *overlay_icon_name; + GdkPixbuf *icon_pixbuf; + GdkPixbuf *attention_icon_pixbuf; + GdkPixbuf *overlay_icon_pixbuf; + gchar *icon_theme_path; + + gboolean item_is_menu; + gchar *menu_object_path; + GtkWidget *cached_menu; }; G_DEFINE_FINAL_TYPE (SnItem, sn_item, G_TYPE_OBJECT) @@ -125,40 +130,39 @@ static guint sn_item_signals[LAST_SIGNAL] = { 0 }; typedef struct { - GDBusConnection *connection; - guint handler; -} -SubscriptionContext; + GDBusConnection *connection; + guint handler; +} SubscriptionContext; #define free_error_and_return_if_cancelled(error) \ -if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) \ - { \ - g_error_free (error); \ - return; \ - } \ -if (error != NULL) \ - { \ - panel_debug (PANEL_DEBUG_SYSTRAY, "%s: Fatal error for item '%s': (domain '%s', code %d) %s", \ - G_STRLOC, SN_IS_ITEM (item) ? item->id : "", \ - g_quark_to_string (error->domain), error->code, error->message); \ - g_error_free (error); \ - } + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) \ + { \ + g_error_free (error); \ + return; \ + } \ + if (error != NULL) \ + { \ + panel_debug (PANEL_DEBUG_SYSTRAY, "%s: Fatal error for item '%s': (domain '%s', code %d) %s", \ + G_STRLOC, SN_IS_ITEM (item) ? item->id : "", \ + g_quark_to_string (error->domain), error->code, error->message); \ + g_error_free (error); \ + } #define finish_and_return_if_true(condition) \ -if (condition) \ - { \ - if (G_IS_OBJECT (item)) \ - { \ - panel_debug (PANEL_DEBUG_SYSTRAY, "%s: Finishing on error for item '%s'", \ - G_STRLOC, item->id); \ - g_signal_emit (item, sn_item_signals[FINISH], 0); \ - } \ - return; \ - } + if (condition) \ + { \ + if (G_IS_OBJECT (item)) \ + { \ + panel_debug (PANEL_DEBUG_SYSTRAY, "%s: Finishing on error for item '%s'", \ + G_STRLOC, item->id); \ + g_signal_emit (item, sn_item_signals[FINISH], 0); \ + } \ + return; \ + } @@ -175,74 +179,64 @@ sn_item_class_init (SnItemClass *klass) g_object_class_install_property (object_class, PROP_BUS_NAME, g_param_spec_string ("bus-name", NULL, NULL, NULL, - G_PARAM_WRITABLE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_OBJECT_PATH, g_param_spec_string ("object-path", NULL, NULL, NULL, - G_PARAM_WRITABLE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_KEY, g_param_spec_string ("key", NULL, NULL, NULL, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_EXPOSED, g_param_spec_boolean ("exposed", NULL, NULL, FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - sn_item_signals[EXPOSE] = - g_signal_new (g_intern_static_string ("expose"), - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - sn_item_signals[SEAL] = - g_signal_new (g_intern_static_string ("seal"), - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - sn_item_signals[FINISH] = - g_signal_new (g_intern_static_string ("finish"), - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - sn_item_signals[TOOLTIP_CHANGED] = - g_signal_new (g_intern_static_string ("tooltip-changed"), - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - sn_item_signals[ICON_CHANGED] = - g_signal_new (g_intern_static_string ("icon-changed"), - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - sn_item_signals[MENU_CHANGED] = - g_signal_new (g_intern_static_string ("menu-changed"), - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + sn_item_signals[EXPOSE] = g_signal_new (g_intern_static_string ("expose"), + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + sn_item_signals[SEAL] = g_signal_new (g_intern_static_string ("seal"), + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + sn_item_signals[FINISH] = g_signal_new (g_intern_static_string ("finish"), + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + sn_item_signals[TOOLTIP_CHANGED] = g_signal_new (g_intern_static_string ("tooltip-changed"), + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + sn_item_signals[ICON_CHANGED] = g_signal_new (g_intern_static_string ("icon-changed"), + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + sn_item_signals[MENU_CHANGED] = g_signal_new (g_intern_static_string ("menu-changed"), + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } @@ -335,9 +329,9 @@ sn_item_finalize (GObject *object) static void -sn_item_get_property (GObject *object, - guint prop_id, - GValue *value, +sn_item_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { SnItem *item = SN_ITEM (object); @@ -361,10 +355,10 @@ sn_item_get_property (GObject *object, static void -sn_item_set_property (GObject *object, - guint prop_id, +sn_item_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { SnItem *item = SN_ITEM (object); @@ -394,8 +388,8 @@ sn_item_set_property (GObject *object, static void -sn_item_subscription_context_unsubscribe (gpointer data, - GObject *where_the_object_was) +sn_item_subscription_context_unsubscribe (gpointer data, + GObject *where_the_object_was) { SubscriptionContext *context = data; @@ -407,16 +401,16 @@ sn_item_subscription_context_unsubscribe (gpointer data, static void sn_item_name_owner_changed (GDBusConnection *connection, - const gchar *sender_name, - const gchar *object_path, - const gchar *interface_name, - const gchar *signal_name, - GVariant *parameters, - gpointer user_data) + const gchar *sender_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) { - SnItem *item = user_data; - gchar *new_owner; - gboolean finish; + SnItem *item = user_data; + gchar *new_owner; + gboolean finish; g_variant_get (parameters, "(sss)", NULL, NULL, &new_owner); finish = new_owner == NULL || strlen (new_owner) == 0; @@ -428,9 +422,9 @@ sn_item_name_owner_changed (GDBusConnection *connection, static void -sn_item_properties_callback (GObject *source_object, +sn_item_properties_callback (GObject *source_object, GAsyncResult *res, - gpointer user_data) + gpointer user_data) { SnItem *item = user_data; GError *error = NULL; @@ -447,12 +441,12 @@ sn_item_properties_callback (GObject *source_object, static void -sn_item_item_callback (GObject *source_object, +sn_item_item_callback (GObject *source_object, GAsyncResult *res, - gpointer user_data) + gpointer user_data) { - SnItem *item = user_data; - GError *error = NULL; + SnItem *item = user_data; + GError *error = NULL; SubscriptionContext *context; item->item_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); @@ -461,16 +455,15 @@ sn_item_item_callback (GObject *source_object, context = g_new0 (SubscriptionContext, 1); context->connection = g_dbus_proxy_get_connection (item->item_proxy); - context->handler = - g_dbus_connection_signal_subscribe (g_dbus_proxy_get_connection (item->item_proxy), - "org.freedesktop.DBus", - "org.freedesktop.DBus", - "NameOwnerChanged", - "/org/freedesktop/DBus", - g_dbus_proxy_get_name (item->item_proxy), - G_DBUS_SIGNAL_FLAGS_NONE, - sn_item_name_owner_changed, - item, NULL); + context->handler = g_dbus_connection_signal_subscribe (g_dbus_proxy_get_connection (item->item_proxy), + "org.freedesktop.DBus", + "org.freedesktop.DBus", + "NameOwnerChanged", + "/org/freedesktop/DBus", + g_dbus_proxy_get_name (item->item_proxy), + G_DBUS_SIGNAL_FLAGS_NONE, + sn_item_name_owner_changed, + item, NULL); g_object_weak_ref (G_OBJECT (item->item_proxy), sn_item_subscription_context_unsubscribe, context); @@ -529,8 +522,8 @@ sn_item_start (SnItem *item) void -sn_item_invalidate (SnItem *item, - gboolean force_update) +sn_item_invalidate (SnItem *item, + gboolean force_update) { g_return_if_fail (SN_IS_ITEM (item)); @@ -562,10 +555,10 @@ sn_item_invalidate (SnItem *item, static void sn_item_signal_received (GDBusProxy *proxy, - gchar *sender_name, - gchar *signal_name, - GVariant *parameters, - gpointer user_data) + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + gpointer user_data) { sn_item_invalidate (user_data, FALSE); } @@ -577,8 +570,8 @@ sn_item_pixbuf_equals (GdkPixbuf *p1, GdkPixbuf *p2) { guchar *p1p, *p2p; - guint p1l, p2l; - guint i; + guint p1l, p2l; + guint i; if (p1 == p2 || (p1 == NULL && p2 == NULL)) return TRUE; @@ -602,8 +595,8 @@ sn_item_pixbuf_equals (GdkPixbuf *p1, static void -sn_item_free (guchar *pixels, - gpointer data) +sn_item_free (guchar *pixels, + gpointer data) { g_free (pixels); } @@ -613,15 +606,15 @@ sn_item_free (guchar *pixels, static GdkPixbuf * sn_item_extract_pixbuf (GVariant *variant) { - GVariantIter *iter; - gint width, height; - gint lwidth = 0, lheight = 0; - GVariant *array_value; - gconstpointer data; - guchar *array = NULL; - gsize size; - guchar alpha; - gint i; + GVariantIter *iter; + gint width, height; + gint lwidth = 0, lheight = 0; + GVariant *array_value; + gconstpointer data; + guchar *array = NULL; + gsize size; + guchar alpha; + gint i; if (variant == NULL) return NULL; @@ -633,12 +626,11 @@ sn_item_extract_pixbuf (GVariant *variant) while (g_variant_iter_loop (iter, "(ii@ay)", &width, &height, &array_value)) { - if (width > 0 && height > 0 && array_value != NULL && - width * height > lwidth * lheight) + if (width > 0 && height > 0 && array_value != NULL && width * height > lwidth * lheight) { size = g_variant_get_size (array_value); /* sanity check */ - if (size == (gsize)(4 * width * height)) + if (size == (gsize) (4 * width * height)) { /* find the largest image */ data = g_variant_get_data (array_value); @@ -679,27 +671,27 @@ sn_item_extract_pixbuf (GVariant *variant) static void -sn_item_get_all_properties_result (GObject *source_object, +sn_item_get_all_properties_result (GObject *source_object, GAsyncResult *res, - gpointer user_data) + gpointer user_data) { - SnItem *item = user_data; - GError *error = NULL; - GVariant *properties; + SnItem *item = user_data; + GError *error = NULL; + GVariant *properties; GVariantIter *iter = NULL; - const gchar *name; - GVariant *value; + const gchar *name; + GVariant *value; - const gchar *cstr_val1; - gchar *str_val1; - gchar *str_val2; - gboolean bool_val1; - GdkPixbuf *pb_val1; + const gchar *cstr_val1; + gchar *str_val1; + gchar *str_val2; + gboolean bool_val1; + GdkPixbuf *pb_val1; - gboolean update_exposed = FALSE; - gboolean update_tooltip = FALSE; - gboolean update_icon = FALSE; - gboolean update_menu = FALSE; + gboolean update_exposed = FALSE; + gboolean update_tooltip = FALSE; + gboolean update_icon = FALSE; + gboolean update_menu = FALSE; properties = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); if (properties == NULL) @@ -708,19 +700,19 @@ sn_item_get_all_properties_result (GObject *source_object, return; } - #define string_empty_null(s) ((s) != NULL ? (s) : "") +#define string_empty_null(s) ((s) != NULL ? (s) : "") - #define update_new_string(val, entry, update_what) \ +#define update_new_string(val, entry, update_what) \ if (g_strcmp0 (string_empty_null (val), string_empty_null (item->entry))) \ { \ g_free (item->entry); \ - item->entry = \ - val != NULL && strlen (val != NULL ? val : "") > 0 \ - ? g_strdup (val) : NULL; \ + item->entry = val != NULL && strlen (val != NULL ? val : "") > 0 \ + ? g_strdup (val) \ + : NULL; \ update_what = TRUE; \ } - #define update_new_pixbuf(val, entry, update_what) \ +#define update_new_pixbuf(val, entry, update_what) \ if (!sn_item_pixbuf_equals (val, item->entry)) \ { \ if (item->entry != NULL) \ @@ -733,125 +725,126 @@ sn_item_get_all_properties_result (GObject *source_object, g_object_unref (val); \ } - if (! g_variant_check_format_string (properties, "(a{sv})", FALSE)) + if (!g_variant_check_format_string (properties, "(a{sv})", FALSE)) { g_warning ("Could not parse properties for StatusNotifierItem."); return; } g_variant_get (properties, "(a{sv})", &iter); - while (g_variant_iter_loop (iter, "{&sv}", &name, &value)) { - if (!g_strcmp0 (name, "Id")) - { - if (item->id == NULL) - item->id = g_variant_dup_string (value, NULL); - } - else if (!g_strcmp0 (name, "Status")) - { - cstr_val1 = g_variant_get_string (value, NULL); - update_new_string (cstr_val1, status, update_icon); - bool_val1 = g_strcmp0 (item->status, "Passive") != 0; - if (bool_val1 != item->exposed) - { - item->exposed = bool_val1; - update_exposed = TRUE; - } - } - else if (!g_strcmp0 (name, "Title")) - { - cstr_val1 = g_variant_get_string (value, NULL); - update_new_string (cstr_val1, title, update_tooltip); - } - else if (!g_strcmp0 (name, "ToolTip")) - { - cstr_val1 = g_variant_get_type_string (value); - if (!g_strcmp0 (cstr_val1, "(sa(iiay)ss)")) - { - g_variant_get (value, "(sa(iiay)ss)", NULL, NULL, &str_val1, &str_val2); - update_new_string (str_val1, tooltip_title, update_tooltip); - update_new_string (str_val2, tooltip_subtitle, update_tooltip); - g_free (str_val1); - g_free (str_val2); - } - else if (!g_strcmp0 (cstr_val1, "s")) - { - cstr_val1 = g_variant_get_string (value, NULL); - update_new_string (cstr_val1, tooltip_title, update_tooltip); - update_new_string (NULL, tooltip_subtitle, update_tooltip); - } - else - { - update_new_string (NULL, tooltip_title, update_tooltip); - update_new_string (NULL, tooltip_subtitle, update_tooltip); - } - } - else if (!g_strcmp0 (name, "ItemIsMenu")) - { - bool_val1 = g_variant_get_boolean (value); - if (bool_val1 != item->item_is_menu) - { - item->item_is_menu = bool_val1; - update_menu = TRUE; - } - } - else if (!g_strcmp0 (name, "Menu")) - { - cstr_val1 = g_variant_get_string (value, NULL); - update_new_string (cstr_val1, menu_object_path, update_menu); - } - else if (!g_strcmp0 (name, "IconThemePath")) - { - cstr_val1 = g_variant_get_string (value, NULL); - update_new_string (cstr_val1, icon_theme_path, update_icon); - } - else if (!g_strcmp0 (name, "IconName")) - { - cstr_val1 = g_variant_get_string (value, NULL); - update_new_string (cstr_val1, icon_name, update_icon); - } - else if (!g_strcmp0 (name, "IconPixmap")) - { - pb_val1 = sn_item_extract_pixbuf (value); - update_new_pixbuf (pb_val1, icon_pixbuf, update_icon); - } - else if (!g_strcmp0 (name, "IconAccessibleDesc")) - { - cstr_val1 = g_variant_get_string (value, NULL); - update_new_string (cstr_val1, icon_desc, update_tooltip); - } - else if (!g_strcmp0 (name, "AttentionIconName")) - { - cstr_val1 = g_variant_get_string (value, NULL); - update_new_string (cstr_val1, attention_icon_name, update_icon); - } - else if (!g_strcmp0 (name, "AttentionIconPixmap")) - { - pb_val1 = sn_item_extract_pixbuf (value); - update_new_pixbuf (pb_val1, attention_icon_pixbuf, update_icon); - } - else if (!g_strcmp0 (name, "AttentionAccessibleDesc")) - { - cstr_val1 = g_variant_get_string (value, NULL); - update_new_string (cstr_val1, attention_desc, update_tooltip); - } - else if (!g_strcmp0 (name, "OverlayIconName")) - { - cstr_val1 = g_variant_get_string (value, NULL); - update_new_string (cstr_val1, overlay_icon_name, update_icon); - } - else if (!g_strcmp0 (name, "OverlayIconPixmap")) - { - pb_val1 = sn_item_extract_pixbuf (value); - update_new_pixbuf (pb_val1, overlay_icon_pixbuf, update_icon); - } - } + while (g_variant_iter_loop (iter, "{&sv}", &name, &value)) + { + if (!g_strcmp0 (name, "Id")) + { + if (item->id == NULL) + item->id = g_variant_dup_string (value, NULL); + } + else if (!g_strcmp0 (name, "Status")) + { + cstr_val1 = g_variant_get_string (value, NULL); + update_new_string (cstr_val1, status, update_icon); + bool_val1 = g_strcmp0 (item->status, "Passive") != 0; + if (bool_val1 != item->exposed) + { + item->exposed = bool_val1; + update_exposed = TRUE; + } + } + else if (!g_strcmp0 (name, "Title")) + { + cstr_val1 = g_variant_get_string (value, NULL); + update_new_string (cstr_val1, title, update_tooltip); + } + else if (!g_strcmp0 (name, "ToolTip")) + { + cstr_val1 = g_variant_get_type_string (value); + if (!g_strcmp0 (cstr_val1, "(sa(iiay)ss)")) + { + g_variant_get (value, "(sa(iiay)ss)", NULL, NULL, &str_val1, &str_val2); + update_new_string (str_val1, tooltip_title, update_tooltip); + update_new_string (str_val2, tooltip_subtitle, update_tooltip); + g_free (str_val1); + g_free (str_val2); + } + else if (!g_strcmp0 (cstr_val1, "s")) + { + cstr_val1 = g_variant_get_string (value, NULL); + update_new_string (cstr_val1, tooltip_title, update_tooltip); + update_new_string (NULL, tooltip_subtitle, update_tooltip); + } + else + { + update_new_string (NULL, tooltip_title, update_tooltip); + update_new_string (NULL, tooltip_subtitle, update_tooltip); + } + } + else if (!g_strcmp0 (name, "ItemIsMenu")) + { + bool_val1 = g_variant_get_boolean (value); + if (bool_val1 != item->item_is_menu) + { + item->item_is_menu = bool_val1; + update_menu = TRUE; + } + } + else if (!g_strcmp0 (name, "Menu")) + { + cstr_val1 = g_variant_get_string (value, NULL); + update_new_string (cstr_val1, menu_object_path, update_menu); + } + else if (!g_strcmp0 (name, "IconThemePath")) + { + cstr_val1 = g_variant_get_string (value, NULL); + update_new_string (cstr_val1, icon_theme_path, update_icon); + } + else if (!g_strcmp0 (name, "IconName")) + { + cstr_val1 = g_variant_get_string (value, NULL); + update_new_string (cstr_val1, icon_name, update_icon); + } + else if (!g_strcmp0 (name, "IconPixmap")) + { + pb_val1 = sn_item_extract_pixbuf (value); + update_new_pixbuf (pb_val1, icon_pixbuf, update_icon); + } + else if (!g_strcmp0 (name, "IconAccessibleDesc")) + { + cstr_val1 = g_variant_get_string (value, NULL); + update_new_string (cstr_val1, icon_desc, update_tooltip); + } + else if (!g_strcmp0 (name, "AttentionIconName")) + { + cstr_val1 = g_variant_get_string (value, NULL); + update_new_string (cstr_val1, attention_icon_name, update_icon); + } + else if (!g_strcmp0 (name, "AttentionIconPixmap")) + { + pb_val1 = sn_item_extract_pixbuf (value); + update_new_pixbuf (pb_val1, attention_icon_pixbuf, update_icon); + } + else if (!g_strcmp0 (name, "AttentionAccessibleDesc")) + { + cstr_val1 = g_variant_get_string (value, NULL); + update_new_string (cstr_val1, attention_desc, update_tooltip); + } + else if (!g_strcmp0 (name, "OverlayIconName")) + { + cstr_val1 = g_variant_get_string (value, NULL); + update_new_string (cstr_val1, overlay_icon_name, update_icon); + } + else if (!g_strcmp0 (name, "OverlayIconPixmap")) + { + pb_val1 = sn_item_extract_pixbuf (value); + update_new_pixbuf (pb_val1, overlay_icon_pixbuf, update_icon); + } + } g_variant_iter_free (iter); g_variant_unref (properties); - #undef update_new_pixbuf - #undef update_new_string - #undef string_empty_null +#undef update_new_pixbuf +#undef update_new_string +#undef string_empty_null if (!item->initialized) { @@ -910,12 +903,12 @@ sn_item_get_name (SnItem *item) void -sn_item_get_icon (SnItem *item, +sn_item_get_icon (SnItem *item, const gchar **theme_path, const gchar **icon_name, - GdkPixbuf **icon_pixbuf, + GdkPixbuf **icon_pixbuf, const gchar **overlay_icon_name, - GdkPixbuf **overlay_icon_pixbuf) + GdkPixbuf **overlay_icon_pixbuf) { g_return_if_fail (SN_IS_ITEM (item)); g_return_if_fail (item->initialized); @@ -923,15 +916,15 @@ sn_item_get_icon (SnItem *item, if (icon_name != NULL) { *icon_name = item->attention_icon_name != NULL - ? item->attention_icon_name - : item->icon_name; + ? item->attention_icon_name + : item->icon_name; } if (icon_pixbuf != NULL) { *icon_pixbuf = item->attention_icon_pixbuf != NULL - ? item->attention_icon_pixbuf - : item->icon_pixbuf; + ? item->attention_icon_pixbuf + : item->icon_pixbuf; } if (overlay_icon_name != NULL) @@ -947,7 +940,7 @@ sn_item_get_icon (SnItem *item, void -sn_item_get_tooltip (SnItem *item, +sn_item_get_tooltip (SnItem *item, const gchar **title, const gchar **subtitle) { @@ -957,11 +950,11 @@ sn_item_get_tooltip (SnItem *item, g_return_if_fail (item->initialized); if (title == NULL) - title = (gpointer)&stub; + title = (gpointer) &stub; if (subtitle == NULL) - subtitle = (gpointer)&stub; + subtitle = (gpointer) &stub; - #define sn_subtitle(subtitle) (g_strcmp0 (subtitle, *title) ? subtitle : NULL) +#define sn_subtitle(subtitle) (g_strcmp0 (subtitle, *title) ? subtitle : NULL) if (item->tooltip_title != NULL && item->tooltip_subtitle != NULL) { @@ -1006,12 +999,12 @@ sn_item_get_tooltip (SnItem *item, *subtitle = NULL; } } - else if (item->tooltip_title != NULL ) + else if (item->tooltip_title != NULL) { *title = item->tooltip_title; *subtitle = NULL; } - else if (item->title != NULL ) + else if (item->title != NULL) { *title = item->title; *subtitle = NULL; @@ -1022,7 +1015,7 @@ sn_item_get_tooltip (SnItem *item, *subtitle = NULL; } - #undef sn_subtitle +#undef sn_subtitle } @@ -1041,8 +1034,8 @@ sn_item_is_menu_only (SnItem *item) GtkWidget * sn_item_get_menu (SnItem *item) { - #ifdef HAVE_DBUSMENU - DbusmenuGtkMenu *menu; +#ifdef HAVE_DBUSMENU + DbusmenuGtkMenu *menu; DbusmenuGtkClient *client; g_return_val_if_fail (SN_IS_ITEM (item), NULL); @@ -1061,17 +1054,17 @@ sn_item_get_menu (SnItem *item) } return item->cached_menu; - #else +#else return NULL; - #endif +#endif } void sn_item_activate (SnItem *item, - gint x_root, - gint y_root) + gint x_root, + gint y_root) { g_return_if_fail (SN_IS_ITEM (item)); g_return_if_fail (item->initialized); @@ -1087,8 +1080,8 @@ sn_item_activate (SnItem *item, void sn_item_secondary_activate (SnItem *item, - gint x_root, - gint y_root) + gint x_root, + gint y_root) { g_return_if_fail (SN_IS_ITEM (item)); g_return_if_fail (item->initialized); @@ -1104,8 +1097,8 @@ sn_item_secondary_activate (SnItem *item, void sn_item_scroll (SnItem *item, - gint delta_x, - gint delta_y) + gint delta_x, + gint delta_y) { g_return_if_fail (SN_IS_ITEM (item)); g_return_if_fail (item->initialized); diff --git a/plugins/systray/sn-item.h b/plugins/systray/sn-item.h index 3e90bdb27..af573bb45 100644 --- a/plugins/systray/sn-item.h +++ b/plugins/systray/sn-item.h @@ -26,39 +26,49 @@ G_BEGIN_DECLS #define SN_TYPE_ITEM (sn_item_get_type ()) G_DECLARE_FINAL_TYPE (SnItem, sn_item, SN, ITEM, GObject) -void sn_item_start (SnItem *item); - -void sn_item_invalidate (SnItem *item, - gboolean force_update); - -const gchar *sn_item_get_name (SnItem *item); - -void sn_item_get_icon (SnItem *item, - const gchar **theme_path, - const gchar **icon_name, - GdkPixbuf **icon_pixbuf, - const gchar **overlay_icon_name, - GdkPixbuf **overlay_icon_pixbuf); - -void sn_item_get_tooltip (SnItem *item, - const gchar **title, - const gchar **subtitle); - -gboolean sn_item_is_menu_only (SnItem *item); - -GtkWidget *sn_item_get_menu (SnItem *item); - -void sn_item_activate (SnItem *item, - gint x_root, - gint y_root); - -void sn_item_secondary_activate (SnItem *item, - gint x_root, - gint y_root); - -void sn_item_scroll (SnItem *item, - gint delta_x, - gint delta_y); +void +sn_item_start (SnItem *item); + +void +sn_item_invalidate (SnItem *item, + gboolean force_update); + +const gchar * +sn_item_get_name (SnItem *item); + +void +sn_item_get_icon (SnItem *item, + const gchar **theme_path, + const gchar **icon_name, + GdkPixbuf **icon_pixbuf, + const gchar **overlay_icon_name, + GdkPixbuf **overlay_icon_pixbuf); + +void +sn_item_get_tooltip (SnItem *item, + const gchar **title, + const gchar **subtitle); + +gboolean +sn_item_is_menu_only (SnItem *item); + +GtkWidget * +sn_item_get_menu (SnItem *item); + +void +sn_item_activate (SnItem *item, + gint x_root, + gint y_root); + +void +sn_item_secondary_activate (SnItem *item, + gint x_root, + gint y_root); + +void +sn_item_scroll (SnItem *item, + gint delta_x, + gint delta_y); G_END_DECLS diff --git a/plugins/systray/sn-plugin.c b/plugins/systray/sn-plugin.c index c29f8d4a1..5280ce9ac 100644 --- a/plugins/systray/sn-plugin.c +++ b/plugins/systray/sn-plugin.c @@ -45,17 +45,22 @@ -static void sn_plugin_construct (XfcePanelPlugin *panel_plugin); +static void +sn_plugin_construct (XfcePanelPlugin *panel_plugin); -static void sn_plugin_free (XfcePanelPlugin *panel_plugin); +static void +sn_plugin_free (XfcePanelPlugin *panel_plugin); -static gboolean sn_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); +static gboolean +sn_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); -static void sn_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode); +static void +sn_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode); -static void sn_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); +static void +sn_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); @@ -124,7 +129,7 @@ sn_plugin_free (XfcePanelPlugin *panel_plugin) { gtk_container_remove (GTK_CONTAINER (plugin->box), plugin->systray_box); g_signal_handlers_disconnect_by_func (G_OBJECT (plugin), - systray_plugin_screen_changed, NULL); + systray_plugin_screen_changed, NULL); } #endif @@ -143,7 +148,7 @@ sn_plugin_free (XfcePanelPlugin *panel_plugin) static gboolean sn_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { SnPlugin *plugin = SN_PLUGIN (panel_plugin); @@ -163,16 +168,16 @@ sn_plugin_size_changed (XfcePanelPlugin *panel_plugin, static void -sn_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode) +sn_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode) { - SnPlugin *plugin = SN_PLUGIN (panel_plugin); - GtkOrientation orientation; - GtkOrientation panel_orientation; + SnPlugin *plugin = SN_PLUGIN (panel_plugin); + GtkOrientation orientation; + GtkOrientation panel_orientation; panel_orientation = xfce_panel_plugin_get_orientation (panel_plugin); - orientation = mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL - ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL; + orientation = mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL ? GTK_ORIENTATION_VERTICAL + : GTK_ORIENTATION_HORIZONTAL; sn_config_set_orientation (plugin->config, panel_orientation, orientation); #ifdef ENABLE_X11 @@ -186,8 +191,8 @@ sn_plugin_mode_changed (XfcePanelPlugin *panel_plugin, static void -sn_plugin_unblock_autohide (gpointer data, - GObject *where_the_object_was) +sn_plugin_unblock_autohide (gpointer data, + GObject *where_the_object_was) { XfcePanelPlugin *panel_plugin = data; @@ -217,7 +222,7 @@ sn_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) #ifdef HAVE_DBUSMENU static void sn_plugin_item_added (SnPlugin *plugin, - SnItem *item) + SnItem *item) { GtkWidget *button; @@ -233,7 +238,7 @@ sn_plugin_item_added (SnPlugin *plugin, gboolean -sn_plugin_legacy_item_added (SnPlugin *plugin, +sn_plugin_legacy_item_added (SnPlugin *plugin, const gchar *name) { return sn_config_add_known_legacy_item (plugin->config, name); @@ -242,7 +247,7 @@ sn_plugin_legacy_item_added (SnPlugin *plugin, #ifdef HAVE_DBUSMENU static void sn_plugin_item_removed (SnPlugin *plugin, - SnItem *item) + SnItem *item) { sn_box_remove_item (SN_BOX (plugin->sn_box), item); } @@ -253,7 +258,7 @@ static void update_button_visibility (SnPlugin *plugin) { gboolean visible = plugin->has_hidden_systray_items || plugin->has_hidden_sn_items; - gtk_widget_set_visible(GTK_WIDGET(plugin->button), visible); + gtk_widget_set_visible (GTK_WIDGET (plugin->button), visible); } @@ -261,7 +266,7 @@ update_button_visibility (SnPlugin *plugin) static void systray_has_hidden_cb (SystrayBox *box, GParamSpec *pspec, - SnPlugin *plugin) + SnPlugin *plugin) { plugin->has_hidden_systray_items = systray_box_has_hidden_items (box); update_button_visibility (plugin); @@ -270,9 +275,9 @@ systray_has_hidden_cb (SystrayBox *box, static void -snbox_has_hidden_cb (SnBox *box, +snbox_has_hidden_cb (SnBox *box, GParamSpec *pspec, - SnPlugin *plugin) + SnPlugin *plugin) { plugin->has_hidden_sn_items = sn_box_has_hidden_items (box); update_button_visibility (plugin); @@ -338,27 +343,27 @@ sn_plugin_construct (XfcePanelPlugin *panel_plugin) plugin->systray_box = systray_box_new (); gtk_box_pack_start (GTK_BOX (plugin->box), plugin->systray_box, TRUE, TRUE, 0); g_signal_connect (G_OBJECT (plugin->systray_box), "draw", - G_CALLBACK (systray_plugin_box_draw), plugin); + G_CALLBACK (systray_plugin_box_draw), plugin); gtk_container_set_border_width (GTK_CONTAINER (plugin->systray_box), 0); gtk_widget_show (plugin->systray_box); /* monitor screen changes */ g_signal_connect (G_OBJECT (plugin), "screen-changed", - G_CALLBACK (systray_plugin_screen_changed), NULL); + G_CALLBACK (systray_plugin_screen_changed), NULL); systray_plugin_screen_changed (GTK_WIDGET (plugin), NULL); /* restart internally if compositing changed */ g_signal_connect_object (gdk_screen_get_default (), "composited-changed", - G_CALLBACK (systray_plugin_composited_changed), plugin, G_CONNECT_SWAPPED); + G_CALLBACK (systray_plugin_composited_changed), plugin, G_CONNECT_SWAPPED); g_signal_connect_swapped (plugin->config, "configuration-changed", G_CALLBACK (gtk_widget_queue_resize), plugin->systray_box); g_signal_connect (plugin->config, "configuration-changed", - G_CALLBACK (systray_plugin_configuration_changed), plugin); + G_CALLBACK (systray_plugin_configuration_changed), plugin); g_signal_connect (plugin->config, "legacy-items-list-changed", - G_CALLBACK (systray_plugin_configuration_changed), plugin); - g_signal_connect (G_OBJECT(plugin->systray_box), "notify::has-hidden", - G_CALLBACK(systray_has_hidden_cb), plugin); + G_CALLBACK (systray_plugin_configuration_changed), plugin); + g_signal_connect (G_OBJECT (plugin->systray_box), "notify::has-hidden", + G_CALLBACK (systray_has_hidden_cb), plugin); } #endif @@ -380,12 +385,12 @@ sn_plugin_construct (XfcePanelPlugin *panel_plugin) #endif /* Systray arrow button */ - plugin->button = xfce_arrow_button_new(GTK_ARROW_RIGHT); - gtk_box_pack_start(GTK_BOX(plugin->box), plugin->button, FALSE, FALSE, 0); - g_signal_connect(G_OBJECT(plugin->button), "toggled", - G_CALLBACK(sn_plugin_button_toggled), plugin); - gtk_button_set_relief(GTK_BUTTON(plugin->button), GTK_RELIEF_NONE); - g_signal_connect (G_OBJECT(plugin->sn_box), "notify::has-hidden", - G_CALLBACK(snbox_has_hidden_cb), plugin); - xfce_panel_plugin_add_action_widget(XFCE_PANEL_PLUGIN(plugin), plugin->button); + plugin->button = xfce_arrow_button_new (GTK_ARROW_RIGHT); + gtk_box_pack_start (GTK_BOX (plugin->box), plugin->button, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (plugin->button), "toggled", + G_CALLBACK (sn_plugin_button_toggled), plugin); + gtk_button_set_relief (GTK_BUTTON (plugin->button), GTK_RELIEF_NONE); + g_signal_connect (G_OBJECT (plugin->sn_box), "notify::has-hidden", + G_CALLBACK (snbox_has_hidden_cb), plugin); + xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (plugin), plugin->button); } diff --git a/plugins/systray/sn-plugin.h b/plugins/systray/sn-plugin.h index e60a399d2..f75637b68 100644 --- a/plugins/systray/sn-plugin.h +++ b/plugins/systray/sn-plugin.h @@ -37,41 +37,43 @@ G_DECLARE_FINAL_TYPE (SnPlugin, sn_plugin, SN, PLUGIN, XfcePanelPlugin) struct _SnPlugin { - XfcePanelPlugin __parent__; + XfcePanelPlugin __parent__; #ifdef ENABLE_X11 /* Systray manager */ SystrayManager *manager; #endif - guint idle_startup; - gboolean has_hidden_systray_items; - gboolean has_hidden_sn_items; + guint idle_startup; + gboolean has_hidden_systray_items; + gboolean has_hidden_sn_items; /* Widgets */ - GtkWidget *box; - GtkWidget *systray_box; - GtkWidget *button; - GtkWidget *item; - GtkWidget *sn_box; + GtkWidget *box; + GtkWidget *systray_box; + GtkWidget *button; + GtkWidget *item; + GtkWidget *sn_box; /* Systray settings */ - GSList *names_ordered; - GHashTable *names_hidden; + GSList *names_ordered; + GHashTable *names_hidden; - GtkBuilder *configure_builder; + GtkBuilder *configure_builder; /* Statusnotifier settings */ #ifdef HAVE_DBUSMENU - SnBackend *backend; + SnBackend *backend; #endif - SnConfig *config; + SnConfig *config; }; -void sn_plugin_register_type (XfcePanelTypeModule *panel_type_module); +void +sn_plugin_register_type (XfcePanelTypeModule *panel_type_module); -gboolean sn_plugin_legacy_item_added (SnPlugin *plugin, - const gchar *name); +gboolean +sn_plugin_legacy_item_added (SnPlugin *plugin, + const gchar *name); G_END_DECLS diff --git a/plugins/systray/sn-util.c b/plugins/systray/sn-util.c index 6304345d8..f59d20bf2 100644 --- a/plugins/systray/sn-util.c +++ b/plugins/systray/sn-util.c @@ -26,11 +26,13 @@ -static void sn_weak_handler_destroy_data (gpointer data, - GObject *where_the_object_was); +static void +sn_weak_handler_destroy_data (gpointer data, + GObject *where_the_object_was); -static void sn_weak_handler_destroy_instance (gpointer data, - GObject *where_the_object_was); +static void +sn_weak_handler_destroy_instance (gpointer data, + GObject *where_the_object_was); @@ -38,15 +40,14 @@ typedef struct { gpointer instance; gpointer data; - gulong handler; -} -WeakHandler; + gulong handler; +} WeakHandler; static void -sn_weak_handler_destroy_data (gpointer data, - GObject *where_the_object_was) +sn_weak_handler_destroy_data (gpointer data, + GObject *where_the_object_was) { WeakHandler *weak_handler = data; @@ -62,8 +63,8 @@ sn_weak_handler_destroy_data (gpointer data, static void -sn_weak_handler_destroy_instance (gpointer data, - GObject *where_the_object_was) +sn_weak_handler_destroy_instance (gpointer data, + GObject *where_the_object_was) { WeakHandler *weak_handler = data; @@ -77,13 +78,13 @@ sn_weak_handler_destroy_instance (gpointer data, static gulong -sn_signal_connect_weak_internal (gpointer instance, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data, +sn_signal_connect_weak_internal (gpointer instance, + const gchar *detailed_signal, + GCallback c_handler, + gpointer data, GConnectFlags connect_flags) { - gulong handler; + gulong handler; WeakHandler *weak_handler; g_return_val_if_fail (G_IS_OBJECT (data), 0); @@ -113,10 +114,10 @@ sn_signal_connect_weak_internal (gpointer instance, gulong -sn_signal_connect_weak (gpointer instance, +sn_signal_connect_weak (gpointer instance, const gchar *detailed_signal, - GCallback c_handler, - gpointer data) + GCallback c_handler, + gpointer data) { return sn_signal_connect_weak_internal (instance, detailed_signal, c_handler, data, 0); @@ -125,10 +126,10 @@ sn_signal_connect_weak (gpointer instance, gulong -sn_signal_connect_weak_swapped (gpointer instance, +sn_signal_connect_weak_swapped (gpointer instance, const gchar *detailed_signal, - GCallback c_handler, - gpointer data) + GCallback c_handler, + gpointer data) { return sn_signal_connect_weak_internal (instance, detailed_signal, c_handler, data, G_CONNECT_SWAPPED); @@ -138,7 +139,7 @@ sn_signal_connect_weak_swapped (gpointer instance, static void sn_container_has_children_callback (GtkWidget *widget, - gpointer user_data) + gpointer user_data) { gboolean *has_children = user_data; *has_children = TRUE; diff --git a/plugins/systray/sn-util.h b/plugins/systray/sn-util.h index 9cf81cb7e..b58c1e8b8 100644 --- a/plugins/systray/sn-util.h +++ b/plugins/systray/sn-util.h @@ -23,17 +23,20 @@ G_BEGIN_DECLS -gulong sn_signal_connect_weak (gpointer instance, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data); - -gulong sn_signal_connect_weak_swapped (gpointer instance, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data); - -gboolean sn_container_has_children (GtkWidget *widget); +gulong +sn_signal_connect_weak (gpointer instance, + const gchar *detailed_signal, + GCallback c_handler, + gpointer data); + +gulong +sn_signal_connect_weak_swapped (gpointer instance, + const gchar *detailed_signal, + GCallback c_handler, + gpointer data); + +gboolean +sn_container_has_children (GtkWidget *widget); G_END_DECLS diff --git a/plugins/systray/systray-box.c b/plugins/systray/systray-box.c index 77ab527b4..1fc22c925 100644 --- a/plugins/systray/systray-box.c +++ b/plugins/systray/systray-box.c @@ -27,42 +27,53 @@ #include "common/panel-debug.h" #include "common/panel-private.h" -#define SPACING (2) -#define OFFSCREEN (-9999) +#define SPACING (2) +#define OFFSCREEN (-9999) /* some icon implementations request a 1x1 size for invisible icons */ #define REQUISITION_IS_INVISIBLE(child_req) ((child_req).width <= 1 && (child_req).height <= 1) -static void systray_box_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void systray_box_finalize (GObject *object); -static void systray_box_get_preferred_length (GtkWidget *widget, - gint *minimum_length, - gint *natural_length); -static void systray_box_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static void systray_box_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height); -static void systray_box_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static void systray_box_add (GtkContainer *container, - GtkWidget *child); -static void systray_box_remove (GtkContainer *container, - GtkWidget *child); -static void systray_box_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data); -static GType systray_box_child_type (GtkContainer *container); -static gint systray_box_compare_function (gconstpointer a, - gconstpointer b, - gpointer user_data); +static void +systray_box_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +systray_box_finalize (GObject *object); +static void +systray_box_get_preferred_length (GtkWidget *widget, + gint *minimum_length, + gint *natural_length); +static void +systray_box_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width); +static void +systray_box_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height); +static void +systray_box_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static void +systray_box_add (GtkContainer *container, + GtkWidget *child); +static void +systray_box_remove (GtkContainer *container, + GtkWidget *child); +static void +systray_box_forall (GtkContainer *container, + gboolean include_internals, + GtkCallback callback, + gpointer callback_data); +static GType +systray_box_child_type (GtkContainer *container); +static gint +systray_box_compare_function (gconstpointer a, + gconstpointer b, + gpointer user_data); @@ -74,39 +85,39 @@ enum struct _SystrayBox { - GtkContainer __parent__; + GtkContainer __parent__; /* all the icons packed in this box */ - GSList *children; + GSList *children; /* table of item indexes */ - GHashTable *names_ordered; + GHashTable *names_ordered; /* orientation of the box */ - guint horizontal : 1; + guint horizontal : 1; /* hidden children counter */ - gint n_hidden_children; - gint n_visible_children; + gint n_hidden_children; + gint n_visible_children; /* whether hidden icons are visible */ - guint show_hidden : 1; + guint show_hidden : 1; /* dimensions */ - gint size_max; - gint nrows; - gint row_size; - gint row_padding; + gint size_max; + gint nrows; + gint row_size; + gint row_padding; /* whether icons are squared */ - guint square_icons : 1; + guint square_icons : 1; /* whether icons are in a single row */ - guint single_row : 1; + guint single_row : 1; /* allocated size by the plugin */ - gint size_alloc_init; - gint size_alloc; + gint size_alloc_init; + gint size_alloc; }; @@ -118,8 +129,8 @@ G_DEFINE_FINAL_TYPE (SystrayBox, systray_box, GTK_TYPE_CONTAINER) static void systray_box_class_init (SystrayBoxClass *klass) { - GObjectClass *gobject_class; - GtkWidgetClass *gtkwidget_class; + GObjectClass *gobject_class; + GtkWidgetClass *gtkwidget_class; GtkContainerClass *gtkcontainer_class; gobject_class = G_OBJECT_CLASS (klass); @@ -167,10 +178,10 @@ systray_box_init (SystrayBox *box) static void -systray_box_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +systray_box_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { SystrayBox *box = SYSTRAY_BOX (object); @@ -210,10 +221,10 @@ systray_box_finalize (GObject *object) static void systray_box_size_get_max_child_size (SystrayBox *box, - gint *rows_ret, - gint *icon_size_ret, - gint *row_size_ret, - gint *offset_ret) + gint *rows_ret, + gint *icon_size_ret, + gint *row_size_ret, + gint *offset_ret) { if (rows_ret != NULL) *rows_ret = box->nrows; @@ -231,9 +242,9 @@ systray_box_size_get_max_child_size (SystrayBox *box, static void -systray_box_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) +systray_box_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width) { SystrayBox *box = SYSTRAY_BOX (widget); @@ -253,9 +264,9 @@ systray_box_get_preferred_width (GtkWidget *widget, static void -systray_box_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) +systray_box_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height) { SystrayBox *box = SYSTRAY_BOX (widget); @@ -275,25 +286,25 @@ systray_box_get_preferred_height (GtkWidget *widget, static void -systray_box_get_preferred_length (GtkWidget *widget, - gint *minimum_length, - gint *natural_length) +systray_box_get_preferred_length (GtkWidget *widget, + gint *minimum_length, + gint *natural_length) { - SystrayBox *box = SYSTRAY_BOX (widget); - GtkWidget *child; - GtkRequisition child_req; - gint n_hidden_children = 0; - gint rows; - gdouble cols; - gint icon_size; - gdouble cells; - gint min_seq_cells = -1; - gdouble ratio; - GSList *li; - gboolean hidden; - gint length; - GtkStyleContext *ctx; - GtkBorder padding; + SystrayBox *box = SYSTRAY_BOX (widget); + GtkWidget *child; + GtkRequisition child_req; + gint n_hidden_children = 0; + gint rows; + gdouble cols; + gint icon_size; + gdouble cells; + gint min_seq_cells = -1; + gdouble ratio; + GSList *li; + gboolean hidden; + gint length; + GtkStyleContext *ctx; + GtkBorder padding; box->n_visible_children = 0; @@ -354,8 +365,8 @@ systray_box_get_preferred_length (GtkWidget *widget, } panel_debug_filtered (PANEL_DEBUG_SYSTRAY, - "requested cells=%g, rows=%d, icon_size=%d, children=%d", - cells, rows, icon_size, box->n_visible_children); + "requested cells=%g, rows=%d, icon_size=%d, children=%d", + cells, rows, icon_size, box->n_visible_children); if (cells > 0.00) { @@ -383,8 +394,8 @@ systray_box_get_preferred_length (GtkWidget *widget, if (box->n_hidden_children != n_hidden_children) { panel_debug_filtered (PANEL_DEBUG_SYSTRAY, - "hidden children changed (%d -> %d)", - n_hidden_children, box->n_hidden_children); + "hidden children changed (%d -> %d)", + n_hidden_children, box->n_hidden_children); box->n_hidden_children = n_hidden_children; g_object_notify (G_OBJECT (box), "has-hidden"); @@ -393,7 +404,7 @@ systray_box_get_preferred_length (GtkWidget *widget, /* add border size */ ctx = gtk_widget_get_style_context (widget); gtk_style_context_get_padding (ctx, gtk_widget_get_state_flags (widget), &padding); - length += MAX (padding.left+padding.right, padding.top+padding.bottom); + length += MAX (padding.left + padding.right, padding.top + padding.bottom); if (minimum_length != NULL) *minimum_length = length; @@ -405,26 +416,26 @@ systray_box_get_preferred_length (GtkWidget *widget, static void -systray_box_size_allocate (GtkWidget *widget, +systray_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - SystrayBox *box = SYSTRAY_BOX (widget); - GtkWidget *child; - GtkAllocation child_alloc; - GtkRequisition child_req; - gint rows; - gint icon_size; - gint row_size; - gdouble ratio; - gint x, x_start, x_end; - gint y, y_start, y_end; - gint offset; - GSList *li; - gint alloc_size; - gint idx; - GtkStyleContext *ctx; - GtkBorder padding; - gint spacing; + SystrayBox *box = SYSTRAY_BOX (widget); + GtkWidget *child; + GtkAllocation child_alloc; + GtkRequisition child_req; + gint rows; + gint icon_size; + gint row_size; + gdouble ratio; + gint x, x_start, x_end; + gint y, y_start, y_end; + gint offset; + GSList *li; + gint alloc_size; + gint idx; + GtkStyleContext *ctx; + GtkBorder padding; + gint spacing; gtk_widget_set_allocation (widget, allocation); @@ -453,7 +464,7 @@ systray_box_size_allocate (GtkWidget *widget, else x_start += offset; - restart_allocation: +restart_allocation: x = x_start; y = y_start; @@ -564,8 +575,8 @@ systray_box_size_allocate (GtkWidget *widget, icon_size--; panel_debug_filtered (PANEL_DEBUG_SYSTRAY, - "y overflow (%d > %d), restart with icon_size=%d", - y, y_end, icon_size); + "y overflow (%d > %d), restart with icon_size=%d", + y, y_end, icon_size); goto restart_allocation; } @@ -582,8 +593,8 @@ systray_box_size_allocate (GtkWidget *widget, icon_size--; panel_debug_filtered (PANEL_DEBUG_SYSTRAY, - "x overflow (%d > %d), restart with icon_size=%d", - x, x_end, icon_size); + "x overflow (%d > %d), restart with icon_size=%d", + x, x_end, icon_size); goto restart_allocation; } @@ -600,8 +611,8 @@ systray_box_size_allocate (GtkWidget *widget, } panel_debug_filtered (PANEL_DEBUG_SYSTRAY, "allocated %s[%p] at (%d,%d;%d,%d)", - systray_socket_get_name (SYSTRAY_SOCKET (child)), child, - child_alloc.x, child_alloc.y, child_alloc.width, child_alloc.height); + systray_socket_get_name (SYSTRAY_SOCKET (child)), child, + child_alloc.x, child_alloc.y, child_alloc.width, child_alloc.height); gtk_widget_size_allocate (child, &child_alloc); } @@ -618,7 +629,7 @@ systray_box_size_allocate (GtkWidget *widget, static void systray_box_add (GtkContainer *container, - GtkWidget *child) + GtkWidget *child) { SystrayBox *box = SYSTRAY_BOX (container); @@ -627,8 +638,8 @@ systray_box_add (GtkContainer *container, panel_return_if_fail (gtk_widget_get_parent (child) == NULL); box->children = g_slist_insert_sorted_with_data (box->children, child, - systray_box_compare_function, - box); + systray_box_compare_function, + box); gtk_widget_set_parent (child, GTK_WIDGET (box)); @@ -639,10 +650,10 @@ systray_box_add (GtkContainer *container, static void systray_box_remove (GtkContainer *container, - GtkWidget *child) + GtkWidget *child) { SystrayBox *box = SYSTRAY_BOX (container); - GSList *li; + GSList *li; /* search the child */ li = g_slist_find (box->children, child); @@ -663,12 +674,12 @@ systray_box_remove (GtkContainer *container, static void systray_box_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data) + gboolean include_internals, + GtkCallback callback, + gpointer callback_data) { SystrayBox *box = SYSTRAY_BOX (container); - GSList *li, *lnext; + GSList *li, *lnext; /* run callback for all children */ for (li = box->children; li != NULL; li = lnext) @@ -692,13 +703,13 @@ systray_box_child_type (GtkContainer *container) static gint systray_box_compare_function (gconstpointer a, gconstpointer b, - gpointer user_data) + gpointer user_data) { - SystrayBox *box = user_data; + SystrayBox *box = user_data; const gchar *name_a, *name_b; - gint index_a = -1, index_b = -1; - gboolean hidden_a, hidden_b; - gpointer value; + gint index_a = -1, index_b = -1; + gboolean hidden_a, hidden_b; + gpointer value; /* sort hidden icons before visible ones */ hidden_a = systray_socket_get_hidden ((SystraySocket *) (a)); @@ -737,8 +748,8 @@ systray_box_new (void) void -systray_box_set_orientation (SystrayBox *box, - GtkOrientation orientation) +systray_box_set_orientation (SystrayBox *box, + GtkOrientation orientation) { gboolean horizontal; @@ -758,10 +769,10 @@ systray_box_set_orientation (SystrayBox *box, void systray_box_set_dimensions (SystrayBox *box, - gint icon_size, - gint n_rows, - gint row_size, - gint padding) + gint icon_size, + gint n_rows, + gint row_size, + gint padding) { panel_return_if_fail (SYSTRAY_IS_BOX (box)); @@ -783,7 +794,7 @@ systray_box_set_dimensions (SystrayBox *box, void systray_box_set_size_alloc (SystrayBox *box, - gint size_alloc) + gint size_alloc) { panel_return_if_fail (SYSTRAY_IS_BOX (box)); @@ -801,7 +812,7 @@ systray_box_set_size_alloc (SystrayBox *box, void systray_box_set_show_hidden (SystrayBox *box, - gboolean show_hidden) + gboolean show_hidden) { panel_return_if_fail (SYSTRAY_IS_BOX (box)); @@ -828,7 +839,7 @@ systray_box_get_show_hidden (SystrayBox *box) void systray_box_set_squared (SystrayBox *box, - gboolean square_icons) + gboolean square_icons) { panel_return_if_fail (SYSTRAY_IS_BOX (box)); @@ -855,10 +866,10 @@ systray_box_get_squared (SystrayBox *box) void systray_box_update (SystrayBox *box, - GSList *names_ordered) + GSList *names_ordered) { GSList *li; - gint i; + gint i; panel_return_if_fail (SYSTRAY_IS_BOX (box)); @@ -868,8 +879,8 @@ systray_box_update (SystrayBox *box, g_hash_table_replace (box->names_ordered, g_strdup (li->data), GINT_TO_POINTER (i)); box->children = g_slist_sort_with_data (box->children, - systray_box_compare_function, - box); + systray_box_compare_function, + box); /* update the box, so we update the has-hidden property */ gtk_widget_queue_resize (GTK_WIDGET (box)); @@ -887,7 +898,7 @@ systray_box_has_hidden_items (SystrayBox *box) void systray_box_set_single_row (SystrayBox *box, - gboolean single_row) + gboolean single_row) { box->single_row = single_row; gtk_widget_queue_resize (GTK_WIDGET (box)); diff --git a/plugins/systray/systray-box.h b/plugins/systray/systray-box.h index 0fae35c80..03a3b1215 100644 --- a/plugins/systray/systray-box.h +++ b/plugins/systray/systray-box.h @@ -28,39 +28,51 @@ G_BEGIN_DECLS #define SYSTRAY_TYPE_BOX (systray_box_get_type ()) G_DECLARE_FINAL_TYPE (SystrayBox, systray_box, SYSTRAY, BOX, GtkContainer) -void systray_box_register_type (XfcePanelTypeModule *module); +void +systray_box_register_type (XfcePanelTypeModule *module); -GtkWidget *systray_box_new (void) G_GNUC_MALLOC; +GtkWidget * +systray_box_new (void) G_GNUC_MALLOC; -void systray_box_set_orientation (SystrayBox *box, - GtkOrientation orientation); +void +systray_box_set_orientation (SystrayBox *box, + GtkOrientation orientation); -void systray_box_set_dimensions (SystrayBox *box, - gint icon_size, - gint n_rows, - gint row_size, - gint padding); +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); +void +systray_box_set_size_alloc (SystrayBox *box, + gint size_alloc); -void systray_box_set_show_hidden (SystrayBox *box, - gboolean show_hidden); +void +systray_box_set_show_hidden (SystrayBox *box, + gboolean show_hidden); -gboolean systray_box_get_show_hidden (SystrayBox *box); +gboolean +systray_box_get_show_hidden (SystrayBox *box); -void systray_box_set_squared (SystrayBox *box, - gboolean square_icons); +void +systray_box_set_squared (SystrayBox *box, + gboolean square_icons); -gboolean systray_box_get_squared (SystrayBox *box); +gboolean +systray_box_get_squared (SystrayBox *box); -void systray_box_update (SystrayBox *box, - GSList *names_ordered); +void +systray_box_update (SystrayBox *box, + GSList *names_ordered); -gboolean systray_box_has_hidden_items (SystrayBox *box); +gboolean +systray_box_has_hidden_items (SystrayBox *box); -void systray_box_set_single_row (SystrayBox *box, - gboolean single_row); +void +systray_box_set_single_row (SystrayBox *box, + gboolean single_row); G_END_DECLS diff --git a/plugins/systray/systray-manager.c b/plugins/systray/systray-manager.c index 8a42dcea1..ca038d951 100644 --- a/plugins/systray/systray-manager.c +++ b/plugins/systray/systray-manager.c @@ -37,44 +37,57 @@ -#define SYSTRAY_MANAGER_REQUEST_DOCK 0 -#define SYSTRAY_MANAGER_BEGIN_MESSAGE 1 +#define SYSTRAY_MANAGER_REQUEST_DOCK 0 +#define SYSTRAY_MANAGER_BEGIN_MESSAGE 1 #define SYSTRAY_MANAGER_CANCEL_MESSAGE 2 #define SYSTRAY_MANAGER_ORIENTATION_HORIZONTAL 0 -#define SYSTRAY_MANAGER_ORIENTATION_VERTICAL 1 +#define SYSTRAY_MANAGER_ORIENTATION_VERTICAL 1 -#define SYSTRAY_MANAGER_ERROR (systray_manager_error_quark()) +#define SYSTRAY_MANAGER_ERROR (systray_manager_error_quark ()) typedef struct _SystrayMessage SystrayMessage; -static void systray_manager_finalize (GObject *object); -static void systray_manager_remove_socket (gpointer key, - gpointer value, - gpointer user_data); -static GdkFilterReturn systray_manager_window_filter (GdkXEvent *xev, - GdkEvent *event, - gpointer user_data); -static GdkFilterReturn systray_manager_handle_client_message_opcode (GdkXEvent *xevent, - GdkEvent *event, - gpointer user_data); -static GdkFilterReturn systray_manager_handle_client_message_message_data (GdkXEvent *xevent, - GdkEvent *event, - gpointer user_data); -static void systray_manager_handle_begin_message (SystrayManager *manager, - XClientMessageEvent *xevent); -static void systray_manager_handle_cancel_message (SystrayManager *manager, - XClientMessageEvent *xevent); -static void systray_manager_handle_dock_request (SystrayManager *manager, - XClientMessageEvent *xevent); -static gboolean systray_manager_handle_undock_request (GtkSocket *socket, - gpointer user_data); -static void systray_manager_set_visual (SystrayManager *manager); -static void systray_manager_set_colors_property (SystrayManager *manager); -static void systray_manager_message_free (SystrayMessage *message); -static void systray_manager_message_remove_from_list (SystrayManager *manager, - XClientMessageEvent *xevent); +static void +systray_manager_finalize (GObject *object); +static void +systray_manager_remove_socket (gpointer key, + gpointer value, + gpointer user_data); +static GdkFilterReturn +systray_manager_window_filter (GdkXEvent *xev, + GdkEvent *event, + gpointer user_data); +static GdkFilterReturn +systray_manager_handle_client_message_opcode (GdkXEvent *xevent, + GdkEvent *event, + gpointer user_data); +static GdkFilterReturn +systray_manager_handle_client_message_message_data (GdkXEvent *xevent, + GdkEvent *event, + gpointer user_data); +static void +systray_manager_handle_begin_message (SystrayManager *manager, + XClientMessageEvent *xevent); +static void +systray_manager_handle_cancel_message (SystrayManager *manager, + XClientMessageEvent *xevent); +static void +systray_manager_handle_dock_request (SystrayManager *manager, + XClientMessageEvent *xevent); +static gboolean +systray_manager_handle_undock_request (GtkSocket *socket, + gpointer user_data); +static void +systray_manager_set_visual (SystrayManager *manager); +static void +systray_manager_set_colors_property (SystrayManager *manager); +static void +systray_manager_message_free (SystrayMessage *message); +static void +systray_manager_message_remove_from_list (SystrayManager *manager, + XClientMessageEvent *xevent); @@ -98,10 +111,10 @@ struct _SystrayManager GObject __parent__; /* invisible window */ - GtkWidget *invisible; + GtkWidget *invisible; /* list of client sockets */ - GHashTable *sockets; + GHashTable *sockets; /* symbolic colors */ GdkRGBA fg; @@ -110,41 +123,41 @@ struct _SystrayManager GdkRGBA success; /* orientation of the tray */ - GtkOrientation orientation; + GtkOrientation orientation; /* list of pending messages */ - GSList *messages; + GSList *messages; /* _net_system_tray_opcode atom */ - Atom opcode_atom; + Atom opcode_atom; /* _net_system_tray_message_data atom */ - Atom data_atom; + Atom data_atom; /* _net_system_tray_s%d atom */ - GdkAtom selection_atom; + GdkAtom selection_atom; }; struct _SystrayMessage { /* message string */ - gchar *string; + gchar *string; /* message id */ - glong id; + glong id; /* x11 window */ - Window window; + Window window; /* numb3rs */ - glong length; - glong remaining_length; - glong timeout; + glong length; + glong remaining_length; + glong timeout; }; -static guint systray_manager_signals[LAST_SIGNAL]; +static guint systray_manager_signals[LAST_SIGNAL]; @@ -160,53 +173,40 @@ systray_manager_class_init (SystrayManagerClass *klass) gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = systray_manager_finalize; - systray_manager_signals[ICON_ADDED] = - g_signal_new (g_intern_static_string ("icon-added"), - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - GTK_TYPE_SOCKET); - - systray_manager_signals[ICON_REMOVED] = - g_signal_new (g_intern_static_string ("icon-removed"), - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - GTK_TYPE_SOCKET); - - systray_manager_signals[MESSAGE_SENT] = - g_signal_new (g_intern_static_string ("message-sent"), - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - _systray_marshal_VOID__OBJECT_STRING_LONG_LONG, - G_TYPE_NONE, 4, - GTK_TYPE_SOCKET, - G_TYPE_STRING, - G_TYPE_LONG, - G_TYPE_LONG); - - systray_manager_signals[MESSAGE_CANCELLED] = - g_signal_new (g_intern_static_string ("message-cancelled"), - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - _systray_marshal_VOID__OBJECT_LONG, - G_TYPE_NONE, 2, - GTK_TYPE_SOCKET, - G_TYPE_LONG); - - systray_manager_signals[LOST_SELECTION] = - g_signal_new (g_intern_static_string ("lost-selection"), - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + systray_manager_signals[ICON_ADDED] = g_signal_new (g_intern_static_string ("icon-added"), + G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, GTK_TYPE_SOCKET); + + systray_manager_signals[ICON_REMOVED] = g_signal_new (g_intern_static_string ("icon-removed"), + G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, GTK_TYPE_SOCKET); + + systray_manager_signals[MESSAGE_SENT] = g_signal_new (g_intern_static_string ("message-sent"), + G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + _systray_marshal_VOID__OBJECT_STRING_LONG_LONG, + G_TYPE_NONE, 4, GTK_TYPE_SOCKET, G_TYPE_STRING, G_TYPE_LONG, G_TYPE_LONG); + + systray_manager_signals[MESSAGE_CANCELLED] = g_signal_new (g_intern_static_string ("message-cancelled"), + G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + _systray_marshal_VOID__OBJECT_LONG, + G_TYPE_NONE, 2, GTK_TYPE_SOCKET, G_TYPE_LONG); + + systray_manager_signals[LOST_SELECTION] = g_signal_new (g_intern_static_string ("lost-selection"), + G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } @@ -279,20 +279,20 @@ systray_manager_new (void) gboolean -systray_manager_register (SystrayManager *manager, - GdkScreen *screen, - GError **error) +systray_manager_register (SystrayManager *manager, + GdkScreen *screen, + GError **error) { - GdkDisplay *display; - gchar *selection_name; - gboolean succeed; - gint screen_number; - GtkWidget *invisible; - guint32 timestamp; - GdkAtom opcode_atom; - GdkAtom data_atom; - XClientMessageEvent xevent; - Window root_window; + GdkDisplay *display; + gchar *selection_name; + gboolean succeed; + gint screen_number; + GtkWidget *invisible; + guint32 timestamp; + GdkAtom opcode_atom; + GdkAtom data_atom; + XClientMessageEvent xevent; + Window root_window; panel_return_val_if_fail (SYSTRAY_IS_MANAGER (manager), FALSE); panel_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); @@ -356,7 +356,7 @@ systray_manager_register (SystrayManager *manager, /* send the message */ XSendEvent (GDK_DISPLAY_XDISPLAY (display), root_window, - False, StructureNotifyMask, (XEvent *)&xevent); + False, StructureNotifyMask, (XEvent *) &xevent); /* system_tray_request_dock, system_tray_begin_message, system_tray_cancel_message and selectionclear */ gdk_window_add_filter (gtk_widget_get_window (GTK_WIDGET (invisible)), @@ -398,7 +398,7 @@ systray_manager_remove_socket (gpointer key, gpointer user_data) { SystrayManager *manager = SYSTRAY_MANAGER (user_data); - GtkSocket *socket = GTK_SOCKET (value); + GtkSocket *socket = GTK_SOCKET (value); panel_return_if_fail (SYSTRAY_IS_MANAGER (manager)); panel_return_if_fail (GTK_IS_SOCKET (socket)); @@ -413,8 +413,8 @@ void systray_manager_unregister (SystrayManager *manager) { GdkDisplay *display; - GtkWidget *invisible = manager->invisible; - GdkWindow *owner; + GtkWidget *invisible = manager->invisible; + GdkWindow *owner; panel_return_if_fail (SYSTRAY_IS_MANAGER (manager)); @@ -441,11 +441,10 @@ systray_manager_unregister (SystrayManager *manager) /* remove window filter */ gdk_window_remove_filter (gtk_widget_get_window (GTK_WIDGET (invisible)), - systray_manager_window_filter, manager); + systray_manager_window_filter, manager); /* remove all sockets from the hash table */ - g_hash_table_foreach (manager->sockets, - systray_manager_remove_socket, manager); + g_hash_table_foreach (manager->sockets, systray_manager_remove_socket, manager); /* destroy and unref the invisible window */ manager->invisible = NULL; @@ -459,10 +458,10 @@ systray_manager_unregister (SystrayManager *manager) static GdkFilterReturn systray_manager_window_filter (GdkXEvent *xev, - GdkEvent *event, - gpointer user_data) + GdkEvent *event, + gpointer user_data) { - XEvent *xevent = (XEvent *)xev; + XEvent *xevent = (XEvent *) xev; SystrayManager *manager = SYSTRAY_MANAGER (user_data); panel_return_val_if_fail (SYSTRAY_IS_MANAGER (manager), GDK_FILTER_CONTINUE); @@ -491,11 +490,11 @@ systray_manager_window_filter (GdkXEvent *xev, static GdkFilterReturn systray_manager_handle_client_message_opcode (GdkXEvent *xevent, - GdkEvent *event, - gpointer user_data) + GdkEvent *event, + gpointer user_data) { XClientMessageEvent *xev; - SystrayManager *manager = SYSTRAY_MANAGER (user_data); + SystrayManager *manager = SYSTRAY_MANAGER (user_data); panel_return_val_if_fail (SYSTRAY_IS_MANAGER (manager), GDK_FILTER_REMOVE); @@ -505,19 +504,19 @@ systray_manager_handle_client_message_opcode (GdkXEvent *xevent, switch (xev->data.l[1]) { case SYSTRAY_MANAGER_REQUEST_DOCK: - systray_manager_handle_dock_request (manager, xev); - return GDK_FILTER_REMOVE; + systray_manager_handle_dock_request (manager, xev); + return GDK_FILTER_REMOVE; case SYSTRAY_MANAGER_BEGIN_MESSAGE: - systray_manager_handle_begin_message (manager, xev); - return GDK_FILTER_REMOVE; + systray_manager_handle_begin_message (manager, xev); + return GDK_FILTER_REMOVE; case SYSTRAY_MANAGER_CANCEL_MESSAGE: - systray_manager_handle_cancel_message (manager, xev); - return GDK_FILTER_REMOVE; + systray_manager_handle_cancel_message (manager, xev); + return GDK_FILTER_REMOVE; default: - break; + break; } return GDK_FILTER_CONTINUE; @@ -527,15 +526,15 @@ systray_manager_handle_client_message_opcode (GdkXEvent *xevent, static GdkFilterReturn systray_manager_handle_client_message_message_data (GdkXEvent *xevent, - GdkEvent *event, - gpointer user_data) + GdkEvent *event, + gpointer user_data) { XClientMessageEvent *xev = xevent; - SystrayManager *manager = SYSTRAY_MANAGER (user_data); - GSList *li; - SystrayMessage *message; - glong length; - GtkSocket *socket; + SystrayManager *manager = SYSTRAY_MANAGER (user_data); + GSList *li; + SystrayMessage *message; + glong length; + GtkSocket *socket; panel_return_val_if_fail (SYSTRAY_IS_MANAGER (manager), GDK_FILTER_REMOVE); @@ -582,12 +581,12 @@ systray_manager_handle_client_message_message_data (GdkXEvent *xevent, static void -systray_manager_handle_begin_message (SystrayManager *manager, +systray_manager_handle_begin_message (SystrayManager *manager, XClientMessageEvent *xevent) { - GtkSocket *socket; + GtkSocket *socket; SystrayMessage *message; - glong length, timeout, id; + glong length, timeout, id; panel_return_if_fail (SYSTRAY_IS_MANAGER (manager)); @@ -618,13 +617,13 @@ systray_manager_handle_begin_message (SystrayManager *manager, message = g_slice_new0 (SystrayMessage); /* set message data */ - message->window = xevent->window; - message->timeout = timeout; - message->length = length; - message->id = id; + message->window = xevent->window; + message->timeout = timeout; + message->length = length; + message->id = id; message->remaining_length = length; - message->string = g_malloc (length + 1); - message->string[length] = '\0'; + message->string = g_malloc (length + 1); + message->string[length] = '\0'; /* add this message to the list of pending messages */ manager->messages = g_slist_prepend (manager->messages, message); @@ -634,11 +633,11 @@ systray_manager_handle_begin_message (SystrayManager *manager, static void -systray_manager_handle_cancel_message (SystrayManager *manager, +systray_manager_handle_cancel_message (SystrayManager *manager, XClientMessageEvent *xevent) { - GtkSocket *socket; - Window window = xevent->data.l[2]; + GtkSocket *socket; + Window window = xevent->data.l[2]; panel_return_if_fail (SYSTRAY_IS_MANAGER (manager)); @@ -657,12 +656,12 @@ systray_manager_handle_cancel_message (SystrayManager *manager, static void -systray_manager_handle_dock_request (SystrayManager *manager, +systray_manager_handle_dock_request (SystrayManager *manager, XClientMessageEvent *xevent) { - GtkWidget *socket; - GdkScreen *screen; - Window window = xevent->data.l[2]; + GtkWidget *socket; + GdkScreen *screen; + Window window = xevent->data.l[2]; panel_return_if_fail (SYSTRAY_IS_MANAGER (manager)); panel_return_if_fail (GTK_IS_INVISIBLE (manager->invisible)); @@ -686,7 +685,7 @@ systray_manager_handle_dock_request (SystrayManager *manager, { /* signal to monitor if the client is removed from the socket */ g_signal_connect (G_OBJECT (socket), "plug-removed", - G_CALLBACK (systray_manager_handle_undock_request), manager); + G_CALLBACK (systray_manager_handle_undock_request), manager); /* register the xembed client window id for this socket */ gtk_socket_add_id (GTK_SOCKET (socket), window); @@ -708,10 +707,10 @@ systray_manager_handle_dock_request (SystrayManager *manager, static gboolean systray_manager_handle_undock_request (GtkSocket *socket, - gpointer user_data) + gpointer user_data) { - SystrayManager *manager = SYSTRAY_MANAGER (user_data); - Window *window; + SystrayManager *manager = SYSTRAY_MANAGER (user_data); + Window *window; panel_return_val_if_fail (SYSTRAY_IS_MANAGER (manager), FALSE); @@ -731,12 +730,12 @@ systray_manager_handle_undock_request (GtkSocket *socket, static void systray_manager_set_visual (SystrayManager *manager) { - GdkDisplay *display; - GdkVisual *visual; - Visual *xvisual; - Atom visual_atom; - gulong data[1]; - GdkScreen *screen; + GdkDisplay *display; + GdkVisual *visual; + Visual *xvisual; + Atom visual_atom; + gulong data[1]; + GdkScreen *screen; panel_return_if_fail (SYSTRAY_IS_MANAGER (manager)); panel_return_if_fail (GTK_IS_INVISIBLE (manager->invisible)); @@ -747,8 +746,7 @@ systray_manager_set_visual (SystrayManager *manager) screen = gtk_invisible_get_screen (GTK_INVISIBLE (manager->invisible)); /* get the xatom for the visual property */ - visual_atom = gdk_x11_get_xatom_by_name_for_display (display, - "_NET_SYSTEM_TRAY_VISUAL"); + visual_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_SYSTEM_TRAY_VISUAL"); visual = gdk_screen_get_rgba_visual (screen); panel_debug (PANEL_DEBUG_SYSTRAY, "rgba visual is %p", visual); @@ -776,10 +774,10 @@ systray_manager_set_visual (SystrayManager *manager) void systray_manager_set_colors (SystrayManager *manager, - GdkRGBA *fg, - GdkRGBA *error, - GdkRGBA *warning, - GdkRGBA *success) + GdkRGBA *fg, + GdkRGBA *error, + GdkRGBA *warning, + GdkRGBA *success) { panel_return_if_fail (SYSTRAY_IS_MANAGER (manager)); @@ -796,10 +794,10 @@ systray_manager_set_colors (SystrayManager *manager, static void systray_manager_set_colors_property (SystrayManager *manager) { - GdkWindow *window; + GdkWindow *window; GdkDisplay *display; - Atom atom; - gulong data[12]; + Atom atom; + gulong data[12]; g_return_if_fail (manager->invisible != NULL); window = gtk_widget_get_window (manager->invisible); @@ -833,11 +831,11 @@ systray_manager_set_colors_property (SystrayManager *manager) void systray_manager_set_orientation (SystrayManager *manager, - GtkOrientation orientation) + GtkOrientation orientation) { GdkDisplay *display; - Atom orientation_atom; - gulong data[1]; + Atom orientation_atom; + gulong data[1]; panel_return_if_fail (SYSTRAY_IS_MANAGER (manager)); panel_return_if_fail (GTK_IS_INVISIBLE (manager->invisible)); @@ -850,13 +848,11 @@ systray_manager_set_orientation (SystrayManager *manager, display = gtk_widget_get_display (manager->invisible); /* get the xatom for the orientation property */ - orientation_atom = gdk_x11_get_xatom_by_name_for_display (display, - "_NET_SYSTEM_TRAY_ORIENTATION"); + orientation_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_SYSTEM_TRAY_ORIENTATION"); /* set the data we're going to send to x */ - data[0] = (manager->orientation == GTK_ORIENTATION_HORIZONTAL ? - SYSTRAY_MANAGER_ORIENTATION_HORIZONTAL - : SYSTRAY_MANAGER_ORIENTATION_VERTICAL); + data[0] = (manager->orientation == GTK_ORIENTATION_HORIZONTAL ? SYSTRAY_MANAGER_ORIENTATION_HORIZONTAL + : SYSTRAY_MANAGER_ORIENTATION_VERTICAL); /* change the x property */ XChangeProperty (GDK_DISPLAY_XDISPLAY (display), @@ -882,10 +878,10 @@ systray_manager_message_free (SystrayMessage *message) static void -systray_manager_message_remove_from_list (SystrayManager *manager, +systray_manager_message_remove_from_list (SystrayManager *manager, XClientMessageEvent *xevent) { - GSList *li; + GSList *li; SystrayMessage *message; panel_return_if_fail (SYSTRAY_IS_MANAGER (manager)); diff --git a/plugins/systray/systray-manager.h b/plugins/systray/systray-manager.h index 8a7ca4e1e..30f113312 100644 --- a/plugins/systray/systray-manager.h +++ b/plugins/systray/systray-manager.h @@ -29,29 +29,36 @@ G_BEGIN_DECLS -#define SYSTRAY_TYPE_MANAGER (systray_manager_get_type ()) +#define SYSTRAY_TYPE_MANAGER (systray_manager_get_type ()) G_DECLARE_FINAL_TYPE (SystrayManager, systray_manager, SYSTRAY, MANAGER, GObject) -void systray_manager_register_type (XfcePanelTypeModule *type_module); +void +systray_manager_register_type (XfcePanelTypeModule *type_module); -GQuark systray_manager_error_quark (void); +GQuark +systray_manager_error_quark (void); -SystrayManager *systray_manager_new (void) G_GNUC_MALLOC; +SystrayManager * +systray_manager_new (void) G_GNUC_MALLOC; -gboolean systray_manager_register (SystrayManager *manager, - GdkScreen *screen, - GError **error); +gboolean +systray_manager_register (SystrayManager *manager, + GdkScreen *screen, + GError **error); -void systray_manager_unregister (SystrayManager *manager); +void +systray_manager_unregister (SystrayManager *manager); -void systray_manager_set_colors (SystrayManager *manager, - GdkRGBA *fg, - GdkRGBA *error, - GdkRGBA *warning, - GdkRGBA *success); +void +systray_manager_set_colors (SystrayManager *manager, + GdkRGBA *fg, + GdkRGBA *error, + GdkRGBA *warning, + GdkRGBA *success); -void systray_manager_set_orientation (SystrayManager *manager, - GtkOrientation orientation); +void +systray_manager_set_orientation (SystrayManager *manager, + GtkOrientation orientation); G_END_DECLS diff --git a/plugins/systray/systray-socket.c b/plugins/systray/systray-socket.c index ec9f722b6..c360c5908 100644 --- a/plugins/systray/systray-socket.c +++ b/plugins/systray/systray-socket.c @@ -36,23 +36,27 @@ struct _SystraySocket GtkSocket __parent__; /* plug window */ - Window window; + Window window; - gchar *name; + gchar *name; - guint is_composited : 1; - guint parent_relative_bg : 1; - guint hidden : 1; + guint is_composited : 1; + guint parent_relative_bg : 1; + guint hidden : 1; }; -static void systray_socket_finalize (GObject *object); -static void systray_socket_realize (GtkWidget *widget); -static void systray_socket_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gboolean systray_socket_draw (GtkWidget *widget, - cairo_t *cr); +static void +systray_socket_finalize (GObject *object); +static void +systray_socket_realize (GtkWidget *widget); +static void +systray_socket_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static gboolean +systray_socket_draw (GtkWidget *widget, + cairo_t *cr); @@ -64,7 +68,7 @@ static void systray_socket_class_init (SystraySocketClass *klass) { GtkWidgetClass *gtkwidget_class; - GObjectClass *gobject_class; + GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = systray_socket_finalize; @@ -102,8 +106,8 @@ static void systray_socket_realize (GtkWidget *widget) { SystraySocket *socket = SYSTRAY_SOCKET (widget); - GdkRGBA transparent = { 0.0, 0.0, 0.0, 0.0 }; - GdkWindow *window; + GdkRGBA transparent = { 0.0, 0.0, 0.0, 0.0 }; + GdkWindow *window; GTK_WIDGET_CLASS (systray_socket_parent_class)->realize (widget); @@ -111,19 +115,18 @@ systray_socket_realize (GtkWidget *widget) if (socket->is_composited) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS gdk_window_set_background_rgba (window, &transparent); gdk_window_set_composited (window, TRUE); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS socket->parent_relative_bg = FALSE; } - else if (gtk_widget_get_visual (widget) == - gdk_window_get_visual (gdk_window_get_parent (window))) + else if (gtk_widget_get_visual (widget) == gdk_window_get_visual (gdk_window_get_parent (window))) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS gdk_window_set_background_pattern (window, NULL); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS socket->parent_relative_bg = TRUE; } @@ -132,40 +135,39 @@ G_GNUC_END_IGNORE_DEPRECATIONS socket->parent_relative_bg = FALSE; } -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS gdk_window_set_composited (window, socket->is_composited); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS - gtk_widget_set_app_paintable (widget, - socket->parent_relative_bg || socket->is_composited); + gtk_widget_set_app_paintable (widget, socket->parent_relative_bg || socket->is_composited); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_widget_set_double_buffered (widget, socket->parent_relative_bg); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS panel_debug_filtered (PANEL_DEBUG_SYSTRAY, - "socket %s[%p] (composited=%s, relative-bg=%s", - systray_socket_get_name (socket), socket, - PANEL_DEBUG_BOOL (socket->is_composited), - PANEL_DEBUG_BOOL (socket->parent_relative_bg)); + "socket %s[%p] (composited=%s, relative-bg=%s", + systray_socket_get_name (socket), socket, + PANEL_DEBUG_BOOL (socket->is_composited), + PANEL_DEBUG_BOOL (socket->parent_relative_bg)); } static void -systray_socket_size_allocate (GtkWidget *widget, +systray_socket_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { SystraySocket *socket = SYSTRAY_SOCKET (widget); - GtkAllocation widget_allocation; - gboolean moved; - gboolean resized; + GtkAllocation widget_allocation; + gboolean moved; + gboolean resized; gtk_widget_get_allocation (widget, &widget_allocation); moved = allocation->x != widget_allocation.x - || allocation->y != widget_allocation.y; + || allocation->y != widget_allocation.y; resized = allocation->width != widget_allocation.width - ||allocation->height != widget_allocation.height; + || allocation->height != widget_allocation.height; if ((moved || resized) && gtk_widget_get_mapped (widget)) @@ -192,7 +194,7 @@ systray_socket_size_allocate (GtkWidget *widget, static gboolean systray_socket_draw (GtkWidget *widget, - cairo_t *cr) + cairo_t *cr) { SystraySocket *socket = SYSTRAY_SOCKET (widget); @@ -217,16 +219,16 @@ systray_socket_draw (GtkWidget *widget, GtkWidget * -systray_socket_new (GdkScreen *screen, - Window window) +systray_socket_new (GdkScreen *screen, + Window window) { - SystraySocket *socket; - GdkDisplay *display; - XWindowAttributes attr; - gint result; - GdkVisual *visual; - gint red_prec, green_prec, blue_prec; - gboolean supports_composite = FALSE; + SystraySocket *socket; + GdkDisplay *display; + XWindowAttributes attr; + gint result; + GdkVisual *visual; + gint red_prec, green_prec, blue_prec; + gboolean supports_composite = FALSE; panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); @@ -256,9 +258,9 @@ systray_socket_new (GdkScreen *screen, gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec); gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec); gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS + G_GNUC_BEGIN_IGNORE_DEPRECATIONS supports_composite = gdk_display_supports_composite (gdk_screen_get_display (screen)); -G_GNUC_END_IGNORE_DEPRECATIONS + G_GNUC_END_IGNORE_DEPRECATIONS if (red_prec + blue_prec + green_prec < gdk_visual_get_depth (visual) && supports_composite) socket->is_composited = TRUE; @@ -271,10 +273,10 @@ G_GNUC_END_IGNORE_DEPRECATIONS void systray_socket_force_redraw (SystraySocket *socket) { - GtkWidget *widget = GTK_WIDGET (socket); - XEvent xev; - GdkDisplay *display; - GtkAllocation allocation; + GtkWidget *widget = GTK_WIDGET (socket); + XEvent xev; + GdkDisplay *display; + GtkAllocation allocation; panel_return_if_fail (SYSTRAY_IS_SOCKET (socket)); @@ -319,17 +321,17 @@ systray_socket_is_composited (SystraySocket *socket) static gchar * systray_socket_get_name_prop (SystraySocket *socket, - const gchar *prop_name, - const gchar *type_name) + const gchar *prop_name, + const gchar *type_name) { GdkDisplay *display; - Atom req_type, type; - gint result; - gchar *val; - gint format; - gulong nitems; - gulong bytes_after; - gchar *name = NULL; + Atom req_type, type; + gint result; + gchar *val; + gint format; + gulong nitems; + gulong bytes_after; + gchar *name = NULL; panel_return_val_if_fail (SYSTRAY_IS_SOCKET (socket), NULL); panel_return_val_if_fail (type_name != NULL && prop_name != NULL, NULL); @@ -360,10 +362,10 @@ systray_socket_get_name_prop (SystraySocket *socket, && format == 8 && nitems > 0 && g_utf8_validate (val, nitems, NULL)) - { - /* lowercase the result */ - name = g_utf8_strdown (val, nitems); - } + { + /* lowercase the result */ + name = g_utf8_strdown (val, nitems); + } XFree (val); @@ -413,7 +415,7 @@ systray_socket_get_hidden (SystraySocket *socket) void systray_socket_set_hidden (SystraySocket *socket, - gboolean hidden) + gboolean hidden) { panel_return_if_fail (SYSTRAY_IS_SOCKET (socket)); diff --git a/plugins/systray/systray-socket.h b/plugins/systray/systray-socket.h index f573432b4..68d60d276 100644 --- a/plugins/systray/systray-socket.h +++ b/plugins/systray/systray-socket.h @@ -30,23 +30,31 @@ G_BEGIN_DECLS #define SYSTRAY_TYPE_SOCKET (systray_socket_get_type ()) G_DECLARE_FINAL_TYPE (SystraySocket, systray_socket, SYSTRAY, SOCKET, GtkSocket) -void systray_socket_register_type (GTypeModule *type_module); +void +systray_socket_register_type (GTypeModule *type_module); -GtkWidget *systray_socket_new (GdkScreen *screen, - Window window) G_GNUC_MALLOC; +GtkWidget * +systray_socket_new (GdkScreen *screen, + Window window) G_GNUC_MALLOC; -void systray_socket_force_redraw (SystraySocket *socket); +void +systray_socket_force_redraw (SystraySocket *socket); -gboolean systray_socket_is_composited (SystraySocket *socket); +gboolean +systray_socket_is_composited (SystraySocket *socket); -const gchar *systray_socket_get_name (SystraySocket *socket); +const gchar * +systray_socket_get_name (SystraySocket *socket); -Window *systray_socket_get_window (SystraySocket *socket); +Window * +systray_socket_get_window (SystraySocket *socket); -gboolean systray_socket_get_hidden (SystraySocket *socket); +gboolean +systray_socket_get_hidden (SystraySocket *socket); -void systray_socket_set_hidden (SystraySocket *socket, - gboolean hidden); +void +systray_socket_set_hidden (SystraySocket *socket, + gboolean hidden); G_END_DECLS diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c index ff9eac043..c4dbe688a 100644 --- a/plugins/systray/systray.c +++ b/plugins/systray/systray.c @@ -34,25 +34,31 @@ #include <libxfce4ui/libxfce4ui.h> #include <libxfce4util/libxfce4util.h> -#define BUTTON_SIZE (16) +#define BUTTON_SIZE (16) -static void systray_plugin_names_update (SnPlugin *plugin); -static gboolean systray_plugin_names_get_hidden (SnPlugin *plugin, - const gchar *name); -static void systray_plugin_icon_added (SystrayManager *manager, - GtkWidget *icon, - SnPlugin *plugin); -static void systray_plugin_icon_removed (SystrayManager *manager, - GtkWidget *icon, - SnPlugin *plugin); -static void systray_plugin_lost_selection (SystrayManager *manager, - SnPlugin *plugin); +static void +systray_plugin_names_update (SnPlugin *plugin); +static gboolean +systray_plugin_names_get_hidden (SnPlugin *plugin, + const gchar *name); +static void +systray_plugin_icon_added (SystrayManager *manager, + GtkWidget *icon, + SnPlugin *plugin); +static void +systray_plugin_icon_removed (SystrayManager *manager, + GtkWidget *icon, + SnPlugin *plugin); +static void +systray_plugin_lost_selection (SystrayManager *manager, + SnPlugin *plugin); -void systray_plugin_configuration_changed (SnConfig *config, - SnPlugin *plugin) +void +systray_plugin_configuration_changed (SnConfig *config, + SnPlugin *plugin) { gint icon_size, n_rows, row_size, padding; gboolean square_icons; @@ -117,18 +123,18 @@ void systray_plugin_configuration_changed (SnConfig *config, static gboolean systray_plugin_screen_changed_idle (gpointer user_data) { - SnPlugin *plugin = SN_PLUGIN (user_data); - GdkScreen *screen; - GError *error = NULL; + SnPlugin *plugin = SN_PLUGIN (user_data); + GdkScreen *screen; + GError *error = NULL; /* create a new manager and register this screen */ plugin->manager = systray_manager_new (); g_signal_connect (G_OBJECT (plugin->manager), "icon-added", - G_CALLBACK (systray_plugin_icon_added), plugin); + G_CALLBACK (systray_plugin_icon_added), plugin); g_signal_connect (G_OBJECT (plugin->manager), "icon-removed", - G_CALLBACK (systray_plugin_icon_removed), plugin); + G_CALLBACK (systray_plugin_icon_removed), plugin); g_signal_connect (G_OBJECT (plugin->manager), "lost-selection", - G_CALLBACK (systray_plugin_lost_selection), plugin); + G_CALLBACK (systray_plugin_lost_selection), plugin); /* try to register the systray */ screen = gtk_widget_get_screen (GTK_WIDGET (plugin)); @@ -136,7 +142,7 @@ systray_plugin_screen_changed_idle (gpointer user_data) { /* send the plugin orientation */ systray_plugin_orientation_changed (XFCE_PANEL_PLUGIN (plugin), - xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin))); + xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin))); } else { @@ -189,7 +195,7 @@ systray_plugin_composited_changed (GtkWidget *widget) void systray_plugin_orientation_changed (XfcePanelPlugin *panel_plugin, - GtkOrientation orientation) + GtkOrientation orientation) { SnPlugin *plugin = SN_PLUGIN (panel_plugin); @@ -200,21 +206,22 @@ systray_plugin_orientation_changed (XfcePanelPlugin *panel_plugin, systray_manager_set_orientation (plugin->manager, orientation); /* apply symbolic colors */ - if (G_LIKELY (plugin->manager != NULL)) { - GtkStyleContext *context; - GdkRGBA rgba, fg, error, warning, success; + if (G_LIKELY (plugin->manager != NULL)) + { + GtkStyleContext *context; + GdkRGBA rgba, fg, error, warning, success; - context = gtk_widget_get_style_context (GTK_WIDGET (plugin->systray_box)); - gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &rgba); + context = gtk_widget_get_style_context (GTK_WIDGET (plugin->systray_box)); + gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &rgba); - rgba.red *= G_MAXUSHORT; - rgba.green *= G_MAXUSHORT; - rgba.blue *= G_MAXUSHORT; + rgba.red *= G_MAXUSHORT; + rgba.green *= G_MAXUSHORT; + rgba.blue *= G_MAXUSHORT; - fg = error = warning = success = rgba; + fg = error = warning = success = rgba; - systray_manager_set_colors (plugin->manager, &fg, &error, &warning, &success); - } + systray_manager_set_colors (plugin->manager, &fg, &error, &warning, &success); + } if (orientation == GTK_ORIENTATION_HORIZONTAL) gtk_widget_set_size_request (plugin->button, BUTTON_SIZE, -1); @@ -226,12 +233,12 @@ systray_plugin_orientation_changed (XfcePanelPlugin *panel_plugin, gboolean systray_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { - SnPlugin *plugin = SN_PLUGIN (panel_plugin); - GtkStyleContext *context; - GtkBorder padding; - gint border = 0; + SnPlugin *plugin = SN_PLUGIN (panel_plugin); + GtkStyleContext *context; + GtkBorder padding; + gint border = 0; /* because the allocated size, used in size_requested is always 1 step * behind the allocated size when resizing and during startup, we @@ -250,10 +257,10 @@ systray_plugin_size_changed (XfcePanelPlugin *panel_plugin, static void systray_plugin_box_draw_icon (GtkWidget *child, - gpointer user_data) + gpointer user_data) { - cairo_t *cr = user_data; - GtkAllocation alloc; + cairo_t *cr = user_data; + GtkAllocation alloc; if (systray_socket_is_composited (SYSTRAY_SOCKET (child))) { @@ -274,8 +281,8 @@ systray_plugin_box_draw_icon (GtkWidget *child, void systray_plugin_box_draw (GtkWidget *box, - cairo_t *cr, - gpointer user_data) + cairo_t *cr, + gpointer user_data) { SnPlugin *plugin = SN_PLUGIN (user_data); panel_return_if_fail (SN_IS_PLUGIN (plugin)); @@ -284,25 +291,24 @@ systray_plugin_box_draw (GtkWidget *box, /* separately draw all the composed tray icons after gtk * handled the draw event */ gtk_container_foreach (GTK_CONTAINER (box), - (GtkCallback) (void (*)(void)) systray_plugin_box_draw_icon, cr); + (GtkCallback) (void (*) (void)) systray_plugin_box_draw_icon, cr); } static void systray_plugin_names_update_icon (GtkWidget *icon, - gpointer data) + gpointer data) { SnPlugin *plugin = SN_PLUGIN (data); SystraySocket *socket = SYSTRAY_SOCKET (icon); - const gchar *name; + const gchar *name; panel_return_if_fail (SN_IS_PLUGIN (plugin)); panel_return_if_fail (SYSTRAY_IS_SOCKET (icon)); name = systray_socket_get_name (socket); - systray_socket_set_hidden (socket, - systray_plugin_names_get_hidden (plugin, name)); + systray_socket_set_hidden (socket, systray_plugin_names_get_hidden (plugin, name)); } @@ -313,22 +319,21 @@ systray_plugin_names_update (SnPlugin *plugin) panel_return_if_fail (SN_IS_PLUGIN (plugin)); gtk_container_foreach (GTK_CONTAINER (plugin->systray_box), - systray_plugin_names_update_icon, plugin); - systray_box_update (SYSTRAY_BOX (plugin->systray_box), - plugin->names_ordered); + systray_plugin_names_update_icon, plugin); + systray_box_update (SYSTRAY_BOX (plugin->systray_box), plugin->names_ordered); } static gboolean -systray_plugin_names_get_hidden (SnPlugin *plugin, - const gchar *name) +systray_plugin_names_get_hidden (SnPlugin *plugin, + const gchar *name) { if (xfce_str_is_empty (name)) return FALSE; /* lookup the name in the list */ - if (g_slist_find_custom (plugin->names_ordered, name, (GCompareFunc)g_strcmp0) == NULL) + if (g_slist_find_custom (plugin->names_ordered, name, (GCompareFunc) g_strcmp0) == NULL) { /* add the new name */ plugin->names_ordered = g_slist_prepend (plugin->names_ordered, g_strdup (name)); @@ -352,8 +357,8 @@ systray_plugin_names_get_hidden (SnPlugin *plugin, static void systray_plugin_icon_added (SystrayManager *manager, - GtkWidget *icon, - SnPlugin *plugin) + GtkWidget *icon, + SnPlugin *plugin) { panel_return_if_fail (SYSTRAY_IS_MANAGER (manager)); panel_return_if_fail (SN_IS_PLUGIN (plugin)); @@ -366,15 +371,15 @@ systray_plugin_icon_added (SystrayManager *manager, gtk_widget_show (icon); panel_debug_filtered (PANEL_DEBUG_SYSTRAY, "added %s[%p] icon", - systray_socket_get_name (SYSTRAY_SOCKET (icon)), icon); + systray_socket_get_name (SYSTRAY_SOCKET (icon)), icon); } static void systray_plugin_icon_removed (SystrayManager *manager, - GtkWidget *icon, - SnPlugin *plugin) + GtkWidget *icon, + SnPlugin *plugin) { panel_return_if_fail (SYSTRAY_IS_MANAGER (manager)); panel_return_if_fail (SN_IS_PLUGIN (plugin)); @@ -385,14 +390,14 @@ systray_plugin_icon_removed (SystrayManager *manager, gtk_container_remove (GTK_CONTAINER (plugin->systray_box), icon); panel_debug_filtered (PANEL_DEBUG_SYSTRAY, "removed %s[%p] icon", - systray_socket_get_name (SYSTRAY_SOCKET (icon)), icon); + systray_socket_get_name (SYSTRAY_SOCKET (icon)), icon); } static void systray_plugin_lost_selection (SystrayManager *manager, - SnPlugin *plugin) + SnPlugin *plugin) { GError error; diff --git a/plugins/systray/systray.h b/plugins/systray/systray.h index 4d5fbd34b..99bf96314 100644 --- a/plugins/systray/systray.h +++ b/plugins/systray/systray.h @@ -28,18 +28,24 @@ G_BEGIN_DECLS -void systray_plugin_box_draw (GtkWidget *box, - cairo_t *cr, - gpointer user_data); -void systray_plugin_screen_changed (GtkWidget *widget, - GdkScreen *previous_screen); -void systray_plugin_composited_changed (GtkWidget *widget); -void systray_plugin_configuration_changed (SnConfig *config, - SnPlugin *plugin); -void systray_plugin_orientation_changed (XfcePanelPlugin *panel_plugin, - GtkOrientation orientation); -gboolean systray_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); +void +systray_plugin_box_draw (GtkWidget *box, + cairo_t *cr, + gpointer user_data); +void +systray_plugin_screen_changed (GtkWidget *widget, + GdkScreen *previous_screen); +void +systray_plugin_composited_changed (GtkWidget *widget); +void +systray_plugin_configuration_changed (SnConfig *config, + SnPlugin *plugin); +void +systray_plugin_orientation_changed (XfcePanelPlugin *panel_plugin, + GtkOrientation orientation); +gboolean +systray_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); G_END_DECLS #endif /* !__SYSTRAY_H__ */ diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c index 74da5a813..d420ac293 100644 --- a/plugins/tasklist/tasklist-widget.c +++ b/plugins/tasklist/tasklist-widget.c @@ -34,7 +34,8 @@ #include <X11/Xlib.h> #include <X11/extensions/shape.h> #include <libxfce4windowing/xfw-x11.h> -#define tasklist_window_get_xid(window) (xfw_windowing_get () == XFW_WINDOWING_X11 ? xfw_window_x11_get_xid (window) : 0LU) +#define tasklist_window_get_xid(window) \ + (xfw_windowing_get () == XFW_WINDOWING_X11 ? xfw_window_x11_get_xid (window) : 0LU) #else #define tasklist_window_get_xid(window) 0LU #endif @@ -45,36 +46,41 @@ -#define MIN_MAX_BUTTON_SIZE (-1) -#define MAX_MAX_BUTTON_SIZE (G_MAXINT) -#define DEFAULT_MAX_BUTTON_SIZE (32) -#define MIN_MAX_BUTTON_LENGTH (-1) -#define MAX_MAX_BUTTON_LENGTH (G_MAXINT) -#define DEFAULT_MAX_BUTTON_LENGTH (200) -#define MIN_MIN_BUTTON_LENGTH (0) -#define MAX_MIN_BUTTON_LENGTH (G_MAXINT) -#define DEFAULT_MIN_BUTTON_LENGTH (DEFAULT_MAX_BUTTON_LENGTH / 4) -#define MIN_MINIMIZED_ICON_LUCENCY (0) -#define MAX_MINIMIZED_ICON_LUCENCY (100) +#define MIN_MAX_BUTTON_SIZE (-1) +#define MAX_MAX_BUTTON_SIZE (G_MAXINT) +#define DEFAULT_MAX_BUTTON_SIZE (32) +#define MIN_MAX_BUTTON_LENGTH (-1) +#define MAX_MAX_BUTTON_LENGTH (G_MAXINT) +#define DEFAULT_MAX_BUTTON_LENGTH (200) +#define MIN_MIN_BUTTON_LENGTH (0) +#define MAX_MIN_BUTTON_LENGTH (G_MAXINT) +#define DEFAULT_MIN_BUTTON_LENGTH (DEFAULT_MAX_BUTTON_LENGTH / 4) +#define MIN_MINIMIZED_ICON_LUCENCY (0) +#define MAX_MINIMIZED_ICON_LUCENCY (100) #define DEFAULT_MINIMIZED_ICON_LUCENCY (50) -#define DEFAULT_ELLIPSIZE_MODE (PANGO_ELLIPSIZE_END) -#define MIN_MENU_MAX_WIDTH_CHARS (-1) -#define MAX_MENU_MAX_WIDTH_CHARS (G_MAXINT) -#define DEFAULT_MENU_MAX_WIDTH_CHARS (24) -#define ARROW_BUTTON_SIZE (20) -#define WIREFRAME_SIZE (5) /* same as xfwm4 */ -#define DRAG_ACTIVATE_TIMEOUT (500) +#define DEFAULT_ELLIPSIZE_MODE (PANGO_ELLIPSIZE_END) +#define MIN_MENU_MAX_WIDTH_CHARS (-1) +#define MAX_MENU_MAX_WIDTH_CHARS (G_MAXINT) +#define DEFAULT_MENU_MAX_WIDTH_CHARS (24) +#define ARROW_BUTTON_SIZE (20) +#define WIREFRAME_SIZE (5) /* same as xfwm4 */ +#define DRAG_ACTIVATE_TIMEOUT (500) /* locking helpers for tasklist->locked */ -#define xfce_taskbar_lock(tasklist) G_STMT_START { XFCE_TASKLIST (tasklist)->locked++; } G_STMT_END -#define xfce_taskbar_unlock(tasklist) G_STMT_START { \ - if (XFCE_TASKLIST (tasklist)->locked > 0) \ - XFCE_TASKLIST (tasklist)->locked--; \ - else \ - panel_assert_not_reached (); \ - } G_STMT_END +#define xfce_taskbar_lock(tasklist) \ + G_STMT_START { XFCE_TASKLIST (tasklist)->locked++; } \ + G_STMT_END +#define xfce_taskbar_unlock(tasklist) \ + G_STMT_START \ + { \ + if (XFCE_TASKLIST (tasklist)->locked > 0) \ + XFCE_TASKLIST (tasklist)->locked--; \ + else \ + panel_assert_not_reached (); \ + } \ + G_STMT_END #define xfce_taskbar_is_locked(tasklist) (XFCE_TASKLIST (tasklist)->locked > 0) #define xfce_tasklist_get_panel_plugin(tasklist) XFCE_PANEL_PLUGIN (gtk_widget_get_ancestor (GTK_WIDGET (tasklist), XFCE_TYPE_PANEL_PLUGIN)) @@ -136,104 +142,104 @@ struct _XfceTasklist GtkContainer __parent__; /* lock counter */ - gint locked; + gint locked; /* the screen of this tasklist */ - XfwScreen *screen; - XfwWorkspaceGroup *workspace_group; - GdkDisplay *display; + XfwScreen *screen; + XfwWorkspaceGroup *workspace_group; + GdkDisplay *display; /* window children in the tasklist */ - GList *windows; + GList *windows; /* windows we monitor, but that are excluded from the tasklist */ - GSList *skipped_windows; + GSList *skipped_windows; /* arrow button of the overflow menu */ - GtkWidget *arrow_button; + GtkWidget *arrow_button; /* applications of all the windows in the taskbar */ - GHashTable *apps; + GHashTable *apps; /* normal or iconbox style */ - guint show_labels : 1; + guint show_labels : 1; /* size of the panel pluin */ - gint size; + gint size; /* mode (orientation) of the tasklist */ - XfcePanelPluginMode mode; + XfcePanelPluginMode mode; /* relief of the tasklist buttons */ - GtkReliefStyle button_relief; + GtkReliefStyle button_relief; /* whether we show windows from all workspaces or * only the active workspace */ - guint all_workspaces : 1; + guint all_workspaces : 1; /* whether we switch to another workspace when we try to * unminimize a window on another workspace */ - guint switch_workspace : 1; + guint switch_workspace : 1; /* whether we only show monimized windows in the * tasklist */ - guint only_minimized : 1; + guint only_minimized : 1; /* number of rows of window buttons */ - gint nrows; - gdouble nrows_ratio; + gint nrows; + gdouble nrows_ratio; /* switch window with the mouse wheel */ - guint window_scrolling : 1; - guint wrap_windows : 1; + guint window_scrolling : 1; + guint wrap_windows : 1; /* whether we show blinking windows from all workspaces * or only the active workspace */ - guint all_blinking : 1; + guint all_blinking : 1; /* action to preform when middle clicking */ - XfceTasklistMClick middle_click; + XfceTasklistMClick middle_click; /* whether decorate labels when window is not visible */ - guint label_decorations : 1; + guint label_decorations : 1; /* whether we only show windows that are in the geometry of * the monitor the tasklist is on */ - guint all_monitors : 1; - guint n_monitors; + guint all_monitors : 1; + guint n_monitors; /* whether we show wireframes when hovering a button in * the tasklist */ - guint show_wireframes : 1; + guint show_wireframes : 1; /* icon geometries update timeout */ - guint update_icon_geometries_id; + guint update_icon_geometries_id; /* idle monitor geometry update */ - guint update_monitor_geometry_id; + guint update_monitor_geometry_id; /* button grouping */ - guint grouping : 1; + guint grouping : 1; /* sorting order of the buttons */ XfceTasklistSortOrder sort_order; /* dummy properties */ - guint show_handle : 1; - guint show_tooltips : 1; + guint show_handle : 1; + guint show_tooltips : 1; #ifdef ENABLE_X11 /* wireframe window */ - Window wireframe_window; + Window wireframe_window; #endif /* gtk style properties */ - gint max_button_length; - gint min_button_length; - gint max_button_size; - PangoEllipsizeMode ellipsize_mode; - gint minimized_icon_lucency; - gint menu_max_width_chars; + gint max_button_length; + gint min_button_length; + gint max_button_size; + PangoEllipsizeMode ellipsize_mode; + gint minimized_icon_lucency; + gint menu_max_width_chars; gint n_windows; }; @@ -244,175 +250,225 @@ typedef enum CHILD_TYPE_GROUP, CHILD_TYPE_OVERFLOW_MENU, CHILD_TYPE_GROUP_MENU -} -XfceTasklistChildType; +} XfceTasklistChildType; typedef struct _XfceTasklistChild { /* type of this button */ - XfceTasklistChildType type; + XfceTasklistChildType type; /* pointer to the tasklist */ - XfceTasklist *tasklist; + XfceTasklist *tasklist; /* button widgets */ - GtkWidget *button; - GtkWidget *box; - GtkWidget *icon; - GtkWidget *label; + GtkWidget *button; + GtkWidget *box; + GtkWidget *icon; + GtkWidget *label; /* we use a surface for icon rendering so keep original pixbuf around */ - GdkPixbuf *pixbuf; + GdkPixbuf *pixbuf; /* drag motion window activate */ - guint motion_timeout_id; - guint motion_timestamp; + guint motion_timeout_id; + guint motion_timestamp; /* unique id for sorting by insert time, * simply increased for each new button */ - guint unique_id; + guint unique_id; /* last time this window was focused */ - gint64 last_focused; + gint64 last_focused; /* list of windows in case of a group button */ - GSList *windows; - gint n_windows; + GSList *windows; + gint n_windows; /* xfw information */ - XfwWindow *window; - XfwApplication *app; + XfwWindow *window; + XfwApplication *app; } XfceTasklistChild; -static const GtkTargetEntry source_targets[] = -{ +static const GtkTargetEntry source_targets[] = { { "application/x-wnck-window-id", 0, 0 } }; -static void xfce_tasklist_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void xfce_tasklist_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void xfce_tasklist_finalize (GObject *object); -static void xfce_tasklist_get_preferred_length (GtkWidget *widget, - gint *minimum_length, - gint *natural_length); -static void xfce_tasklist_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static void xfce_tasklist_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height); -static void xfce_tasklist_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static void xfce_tasklist_style_updated (GtkWidget *widget); -static void xfce_tasklist_realize (GtkWidget *widget); -static void xfce_tasklist_unrealize (GtkWidget *widget); -static gboolean xfce_tasklist_scroll_event (GtkWidget *widget, - GdkEventScroll *event); -static void xfce_tasklist_remove (GtkContainer *container, - GtkWidget *widget); -static void xfce_tasklist_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data); -static GType xfce_tasklist_child_type (GtkContainer *container); -static void xfce_tasklist_arrow_button_toggled (GtkWidget *button, - XfceTasklist *tasklist); -static void xfce_tasklist_connect_screen (XfceTasklist *tasklist); -static void xfce_tasklist_disconnect_screen (XfceTasklist *tasklist); -static gboolean xfce_tasklist_configure_event (GtkWidget *widget, - GdkEvent *event, - XfceTasklist *tasklist); -static void xfce_tasklist_active_window_changed (XfwScreen *screen, - XfwWindow *previous_window, - XfceTasklist *tasklist); -static void xfce_tasklist_active_workspace_changed (XfwWorkspaceGroup *group, - XfwWorkspace *previous_workspace, - XfceTasklist *tasklist); -static void xfce_tasklist_window_added (XfwScreen *screen, - XfwWindow *window, - XfceTasklist *tasklist); -static void xfce_tasklist_window_removed (XfwScreen *screen, - XfwWindow *window, - XfceTasklist *tasklist); -static void xfce_tasklist_viewports_changed (XfwWorkspaceGroup *group, - XfceTasklist *tasklist); -static void xfce_tasklist_button_state_changed (XfwWindow *window, - XfwWindowState changed_state, - XfwWindowState new_state, - XfceTasklistChild *child); -static void xfce_tasklist_skipped_windows_state_changed (XfwWindow *window, - XfwWindowState changed_state, - XfwWindowState new_state, - XfceTasklist *tasklist); -static void xfce_tasklist_sort (XfceTasklist *tasklist, - gboolean sort_groups); -static void xfce_tasklist_group_button_sort (XfceTasklistChild *group_child); -static gboolean xfce_tasklist_update_icon_geometries (gpointer data); -static void xfce_tasklist_update_icon_geometries_destroyed (gpointer data); +static void +xfce_tasklist_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +xfce_tasklist_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +xfce_tasklist_finalize (GObject *object); +static void +xfce_tasklist_get_preferred_length (GtkWidget *widget, + gint *minimum_length, + gint *natural_length); +static void +xfce_tasklist_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width); +static void +xfce_tasklist_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height); +static void +xfce_tasklist_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static void +xfce_tasklist_style_updated (GtkWidget *widget); +static void +xfce_tasklist_realize (GtkWidget *widget); +static void +xfce_tasklist_unrealize (GtkWidget *widget); +static gboolean +xfce_tasklist_scroll_event (GtkWidget *widget, + GdkEventScroll *event); +static void +xfce_tasklist_remove (GtkContainer *container, + GtkWidget *widget); +static void +xfce_tasklist_forall (GtkContainer *container, + gboolean include_internals, + GtkCallback callback, + gpointer callback_data); +static GType +xfce_tasklist_child_type (GtkContainer *container); +static void +xfce_tasklist_arrow_button_toggled (GtkWidget *button, + XfceTasklist *tasklist); +static void +xfce_tasklist_connect_screen (XfceTasklist *tasklist); +static void +xfce_tasklist_disconnect_screen (XfceTasklist *tasklist); +static gboolean +xfce_tasklist_configure_event (GtkWidget *widget, + GdkEvent *event, + XfceTasklist *tasklist); +static void +xfce_tasklist_active_window_changed (XfwScreen *screen, + XfwWindow *previous_window, + XfceTasklist *tasklist); +static void +xfce_tasklist_active_workspace_changed (XfwWorkspaceGroup *group, + XfwWorkspace *previous_workspace, + XfceTasklist *tasklist); +static void +xfce_tasklist_window_added (XfwScreen *screen, + XfwWindow *window, + XfceTasklist *tasklist); +static void +xfce_tasklist_window_removed (XfwScreen *screen, + XfwWindow *window, + XfceTasklist *tasklist); +static void +xfce_tasklist_viewports_changed (XfwWorkspaceGroup *group, + XfceTasklist *tasklist); +static void +xfce_tasklist_button_state_changed (XfwWindow *window, + XfwWindowState changed_state, + XfwWindowState new_state, + XfceTasklistChild *child); +static void +xfce_tasklist_skipped_windows_state_changed (XfwWindow *window, + XfwWindowState changed_state, + XfwWindowState new_state, + XfceTasklist *tasklist); +static void +xfce_tasklist_sort (XfceTasklist *tasklist, + gboolean sort_groups); +static void +xfce_tasklist_group_button_sort (XfceTasklistChild *group_child); +static gboolean +xfce_tasklist_update_icon_geometries (gpointer data); +static void +xfce_tasklist_update_icon_geometries_destroyed (gpointer data); /* wireframe */ #ifdef ENABLE_X11 -static void xfce_tasklist_wireframe_hide (XfceTasklist *tasklist); -static void xfce_tasklist_wireframe_destroy (XfceTasklist *tasklist); -static void xfce_tasklist_wireframe_update (XfceTasklist *tasklist, - XfceTasklistChild *child); +static void +xfce_tasklist_wireframe_hide (XfceTasklist *tasklist); +static void +xfce_tasklist_wireframe_destroy (XfceTasklist *tasklist); +static void +xfce_tasklist_wireframe_update (XfceTasklist *tasklist, + XfceTasklistChild *child); #endif /* tasklist buttons */ -static inline gboolean xfce_tasklist_button_visible (XfceTasklistChild *child, - XfwWorkspace *active_ws); -static gint xfce_tasklist_button_compare (gconstpointer child_a, - gconstpointer child_b, - gpointer user_data); -static GtkWidget *xfce_tasklist_button_proxy_menu_item (XfceTasklistChild *child, - gboolean allow_wireframe); -static gboolean xfce_tasklist_button_activate (XfceTasklistChild *child, - guint32 timestamp); -static XfceTasklistChild *xfce_tasklist_button_new (XfwWindow *window, - XfceTasklist *tasklist); +static inline gboolean +xfce_tasklist_button_visible (XfceTasklistChild *child, + XfwWorkspace *active_ws); +static gint +xfce_tasklist_button_compare (gconstpointer child_a, + gconstpointer child_b, + gpointer user_data); +static GtkWidget * +xfce_tasklist_button_proxy_menu_item (XfceTasklistChild *child, + gboolean allow_wireframe); +static gboolean +xfce_tasklist_button_activate (XfceTasklistChild *child, + guint32 timestamp); +static XfceTasklistChild * +xfce_tasklist_button_new (XfwWindow *window, + XfceTasklist *tasklist); /* tasklist group buttons */ -static void xfce_tasklist_group_button_menu_close (GtkWidget *menuitem, - XfceTasklistChild *child, - guint32 time); -static gboolean xfce_tasklist_group_button_button_draw (GtkWidget *widget, - cairo_t *cr, - XfceTasklistChild *group_child); -static void xfce_tasklist_group_button_remove (XfceTasklistChild *group_child); -static void xfce_tasklist_group_button_add_window (XfceTasklistChild *group_child, - XfceTasklistChild *window_child); -static void xfce_tasklist_button_icon_changed (XfwWindow *window, - XfceTasklistChild *child); -static void xfce_tasklist_group_button_icon_changed (XfwApplication *app, - XfceTasklistChild *group_child); -static XfceTasklistChild *xfce_tasklist_group_button_new (XfwApplication *app, - XfceTasklist *tasklist); +static void +xfce_tasklist_group_button_menu_close (GtkWidget *menuitem, + XfceTasklistChild *child, + guint32 time); +static gboolean +xfce_tasklist_group_button_button_draw (GtkWidget *widget, + cairo_t *cr, + XfceTasklistChild *group_child); +static void +xfce_tasklist_group_button_remove (XfceTasklistChild *group_child); +static void +xfce_tasklist_group_button_add_window (XfceTasklistChild *group_child, + XfceTasklistChild *window_child); +static void +xfce_tasklist_button_icon_changed (XfwWindow *window, + XfceTasklistChild *child); +static void +xfce_tasklist_group_button_icon_changed (XfwApplication *app, + XfceTasklistChild *group_child); +static XfceTasklistChild * +xfce_tasklist_group_button_new (XfwApplication *app, + XfceTasklist *tasklist); /* potential public functions */ -static void xfce_tasklist_set_include_all_workspaces (XfceTasklist *tasklist, - gboolean all_workspaces); -static void xfce_tasklist_set_include_all_monitors (XfceTasklist *tasklist, - gboolean all_monitors); -static void xfce_tasklist_set_button_relief (XfceTasklist *tasklist, - GtkReliefStyle button_relief); -static void xfce_tasklist_set_show_labels (XfceTasklist *tasklist, - gboolean show_labels); -static void xfce_tasklist_set_show_only_minimized (XfceTasklist *tasklist, - gboolean only_minimized); -static void xfce_tasklist_set_show_wireframes (XfceTasklist *tasklist, - gboolean show_wireframes); -static void xfce_tasklist_set_label_decorations (XfceTasklist *tasklist, - gboolean label_decorations); -static void xfce_tasklist_set_grouping (XfceTasklist *tasklist, - gboolean grouping); +static void +xfce_tasklist_set_include_all_workspaces (XfceTasklist *tasklist, + gboolean all_workspaces); +static void +xfce_tasklist_set_include_all_monitors (XfceTasklist *tasklist, + gboolean all_monitors); +static void +xfce_tasklist_set_button_relief (XfceTasklist *tasklist, + GtkReliefStyle button_relief); +static void +xfce_tasklist_set_show_labels (XfceTasklist *tasklist, + gboolean show_labels); +static void +xfce_tasklist_set_show_only_minimized (XfceTasklist *tasklist, + gboolean only_minimized); +static void +xfce_tasklist_set_show_wireframes (XfceTasklist *tasklist, + gboolean show_wireframes); +static void +xfce_tasklist_set_label_decorations (XfceTasklist *tasklist, + gboolean label_decorations); +static void +xfce_tasklist_set_grouping (XfceTasklist *tasklist, + gboolean grouping); G_DEFINE_FINAL_TYPE (XfceTasklist, xfce_tasklist, GTK_TYPE_CONTAINER) @@ -422,8 +478,8 @@ G_DEFINE_FINAL_TYPE (XfceTasklist, xfce_tasklist, GTK_TYPE_CONTAINER) static void xfce_tasklist_class_init (XfceTasklistClass *klass) { - GObjectClass *gobject_class; - GtkWidgetClass *gtkwidget_class; + GObjectClass *gobject_class; + GtkWidgetClass *gtkwidget_class; GtkContainerClass *gtkcontainer_class; gobject_class = G_OBJECT_CLASS (klass); @@ -608,7 +664,6 @@ xfce_tasklist_class_init (XfceTasklistClass *klass) MIN_MENU_MAX_WIDTH_CHARS, MAX_MENU_MAX_WIDTH_CHARS, DEFAULT_MENU_MAX_WIDTH_CHARS, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - } @@ -667,16 +722,16 @@ xfce_tasklist_init (XfceTasklist *tasklist) gtk_widget_set_name (tasklist->arrow_button, "panel-tasklist-arrow"); gtk_button_set_relief (GTK_BUTTON (tasklist->arrow_button), tasklist->button_relief); g_signal_connect (G_OBJECT (tasklist->arrow_button), "toggled", - G_CALLBACK (xfce_tasklist_arrow_button_toggled), tasklist); + G_CALLBACK (xfce_tasklist_arrow_button_toggled), tasklist); gtk_widget_show (tasklist->arrow_button); } static void -xfce_tasklist_get_property (GObject *object, - guint prop_id, - GValue *value, +xfce_tasklist_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { XfceTasklist *tasklist = XFCE_TASKLIST (object); @@ -756,13 +811,13 @@ xfce_tasklist_get_property (GObject *object, static void -xfce_tasklist_set_property (GObject *object, - guint prop_id, +xfce_tasklist_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { - XfceTasklist *tasklist = XFCE_TASKLIST (object); - XfceTasklistSortOrder sort_order; + XfceTasklist *tasklist = XFCE_TASKLIST (object); + XfceTasklistSortOrder sort_order; switch (prop_id) { @@ -780,8 +835,7 @@ xfce_tasklist_set_property (GObject *object, case PROP_FLAT_BUTTONS: xfce_tasklist_set_button_relief (tasklist, - g_value_get_boolean (value) ? - GTK_RELIEF_NONE : GTK_RELIEF_NORMAL); + g_value_get_boolean (value) ? GTK_RELIEF_NONE : GTK_RELIEF_NORMAL); break; case PROP_SHOW_LABELS: @@ -830,7 +884,7 @@ xfce_tasklist_set_property (GObject *object, break; case PROP_MIDDLE_CLICK: - tasklist->middle_click= g_value_get_uint (value); + tasklist->middle_click = g_value_get_uint (value); break; case PROP_LABEL_DECORATIONS: @@ -873,8 +927,8 @@ xfce_tasklist_finalize (GObject *object) static void xfce_tasklist_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) + gint *minimum_width, + gint *natural_width) { XfceTasklist *tasklist = XFCE_TASKLIST (widget); @@ -896,8 +950,8 @@ xfce_tasklist_get_preferred_width (GtkWidget *widget, static void xfce_tasklist_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) + gint *minimum_height, + gint *natural_height) { XfceTasklist *tasklist = XFCE_TASKLIST (widget); @@ -919,19 +973,19 @@ xfce_tasklist_get_preferred_height (GtkWidget *widget, static void xfce_tasklist_get_preferred_length (GtkWidget *widget, - gint *minimum_length, - gint *natural_length) + gint *minimum_length, + gint *natural_length) { - XfceTasklist *tasklist = XFCE_TASKLIST (widget); - gint rows, cols; - gint n_windows; - GtkRequisition child_req; - gint length = 0; - GList *li; + XfceTasklist *tasklist = XFCE_TASKLIST (widget); + gint rows, cols; + gint n_windows; + GtkRequisition child_req; + gint length = 0; + GList *li; XfceTasklistChild *child; - gint child_size = tasklist->size / tasklist->nrows; - gint child_length = 0; - gdouble nrows_ratio = tasklist->nrows_ratio; + gint child_size = tasklist->size / tasklist->nrows; + gint child_length = 0; + gdouble nrows_ratio = tasklist->nrows_ratio; for (li = tasklist->windows, n_windows = 0; li != NULL; li = li->next) { @@ -1002,7 +1056,7 @@ xfce_tasklist_size_sort_window (gconstpointer a, { const XfceTasklistChild *child_a = a; const XfceTasklistChild *child_b = b; - glong diff; + glong diff; diff = child_a->last_focused - child_b->last_focused; return CLAMP (diff, -1, 1); @@ -1011,21 +1065,21 @@ xfce_tasklist_size_sort_window (gconstpointer a, static void -xfce_tasklist_size_layout (XfceTasklist *tasklist, +xfce_tasklist_size_layout (XfceTasklist *tasklist, GtkAllocation *alloc, - gint *n_rows, - gint *n_cols, - gint *arrow_position) + gint *n_rows, + gint *n_cols, + gint *arrow_position) { - gint rows; - gint min_button_length; - gint cols; - GSList *windows_scored = NULL, *lp; - GList *li; + gint rows; + gint min_button_length; + gint cols; + GSList *windows_scored = NULL, *lp; + GList *li; XfceTasklistChild *child; - gint max_button_length; - gint n_buttons; - gint n_buttons_target; + gint max_button_length; + gint n_buttons; + gint n_buttons_target; /* if we're in deskbar mode, there are no columns */ if (xfce_tasklist_deskbar (tasklist) && tasklist->show_labels) @@ -1132,22 +1186,22 @@ xfce_tasklist_size_layout (XfceTasklist *tasklist, static void -xfce_tasklist_size_allocate (GtkWidget *widget, +xfce_tasklist_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - XfceTasklist *tasklist = XFCE_TASKLIST (widget); - gint rows, cols; - gint row; - GtkAllocation area = *allocation; - GList *li; + XfceTasklist *tasklist = XFCE_TASKLIST (widget); + gint rows, cols; + gint row; + GtkAllocation area = *allocation; + GList *li; XfceTasklistChild *child; - gint i; - GtkAllocation child_alloc; - gboolean direction_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL; - gint w, x, y, h; - gint area_x, area_width; - gint arrow_position; - GtkRequisition child_req; + gint i; + GtkAllocation child_alloc; + gboolean direction_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL; + gint w, x, y, h; + gint area_x, area_width; + gint arrow_position; + GtkRequisition child_req; panel_return_if_fail (gtk_widget_get_visible (tasklist->arrow_button)); @@ -1207,8 +1261,7 @@ xfce_tasklist_size_allocate (GtkWidget *widget, if (!gtk_widget_get_visible (child->button)) continue; - if (G_LIKELY (child->type == CHILD_TYPE_WINDOW - || child->type == CHILD_TYPE_GROUP)) + if (G_LIKELY (child->type == CHILD_TYPE_WINDOW || child->type == CHILD_TYPE_GROUP)) { row = (i % rows); if (row == 0) @@ -1346,14 +1399,14 @@ xfce_tasklist_unrealize (GtkWidget *widget) static gboolean -xfce_tasklist_scroll_event (GtkWidget *widget, +xfce_tasklist_scroll_event (GtkWidget *widget, GdkEventScroll *event) { - XfceTasklist *tasklist = XFCE_TASKLIST (widget); - XfceTasklistChild *child = NULL; - GList *li, *lnew = NULL; - GdkScrollDirection scrolling_direction; - gboolean wrap_windows = tasklist->wrap_windows; + XfceTasklist *tasklist = XFCE_TASKLIST (widget); + XfceTasklistChild *child = NULL; + GList *li, *lnew = NULL; + GdkScrollDirection scrolling_direction; + gboolean wrap_windows = tasklist->wrap_windows; if (!tasklist->window_scrolling) return TRUE; @@ -1391,7 +1444,7 @@ xfce_tasklist_scroll_event (GtkWidget *widget, { case GDK_SCROLL_UP: /* find previous button on the tasklist */ - for (lnew = g_list_previous (li); ; lnew = lnew->prev) + for (lnew = g_list_previous (li);; lnew = lnew->prev) { if (lnew == NULL) { @@ -1417,7 +1470,7 @@ xfce_tasklist_scroll_event (GtkWidget *widget, case GDK_SCROLL_DOWN: /* find the next button on the tasklist */ - for (lnew = g_list_next (li); ; lnew = lnew->next) + for (lnew = g_list_next (li);; lnew = lnew->next) { if (lnew == NULL) { @@ -1452,7 +1505,6 @@ xfce_tasklist_scroll_event (GtkWidget *widget, default: panel_debug_filtered (PANEL_DEBUG_TASKLIST, "unknown scrolling event type"); break; - } if (lnew != NULL) @@ -1474,12 +1526,12 @@ xfce_tasklist_free_child (gpointer data) static void xfce_tasklist_remove (GtkContainer *container, - GtkWidget *widget) + GtkWidget *widget) { - XfceTasklist *tasklist = XFCE_TASKLIST (container); - gboolean was_visible; + XfceTasklist *tasklist = XFCE_TASKLIST (container); + gboolean was_visible; XfceTasklistChild *child; - GList *li; + GList *li; for (li = tasklist->windows; li != NULL; li = li->next) { @@ -1517,23 +1569,23 @@ xfce_tasklist_remove (GtkContainer *container, static void xfce_tasklist_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data) + gboolean include_internals, + GtkCallback callback, + gpointer callback_data) { - XfceTasklist *tasklist = XFCE_TASKLIST (container); - GList *children = tasklist->windows; + XfceTasklist *tasklist = XFCE_TASKLIST (container); + GList *children = tasklist->windows; XfceTasklistChild *child; if (include_internals) - (* callback) (tasklist->arrow_button, callback_data); + (*callback) (tasklist->arrow_button, callback_data); while (children != NULL) { child = children->data; children = children->next; - (* callback) (child->button, callback_data); + (*callback) (child->button, callback_data); } } @@ -1548,7 +1600,7 @@ xfce_tasklist_child_type (GtkContainer *container) static void -xfce_tasklist_arrow_button_menu_destroy (GtkWidget *menu, +xfce_tasklist_arrow_button_menu_destroy (GtkWidget *menu, XfceTasklist *tasklist) { panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -1568,13 +1620,13 @@ xfce_tasklist_arrow_button_menu_destroy (GtkWidget *menu, static void -xfce_tasklist_arrow_button_toggled (GtkWidget *button, +xfce_tasklist_arrow_button_toggled (GtkWidget *button, XfceTasklist *tasklist) { - GList *li; + GList *li; XfceTasklistChild *child; - GtkWidget *mi; - GtkWidget *menu; + GtkWidget *mi; + GtkWidget *menu; panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); panel_return_if_fail (GTK_IS_TOGGLE_BUTTON (button)); @@ -1584,7 +1636,7 @@ xfce_tasklist_arrow_button_toggled (GtkWidget *button, { menu = gtk_menu_new (); g_signal_connect (G_OBJECT (menu), "deactivate", - G_CALLBACK (xfce_tasklist_arrow_button_menu_destroy), tasklist); + G_CALLBACK (xfce_tasklist_arrow_button_menu_destroy), tasklist); for (li = tasklist->windows; li != NULL; li = li->next) { @@ -1639,22 +1691,22 @@ xfce_tasklist_connect_screen (XfceTasklist *tasklist) /* monitor screen changes */ xfce_tasklist_active_window_changed (tasklist->screen, NULL, tasklist); g_signal_connect (G_OBJECT (tasklist->screen), "active-window-changed", - G_CALLBACK (xfce_tasklist_active_window_changed), tasklist); + G_CALLBACK (xfce_tasklist_active_window_changed), tasklist); g_signal_connect (G_OBJECT (tasklist->workspace_group), "active-workspace-changed", - G_CALLBACK (xfce_tasklist_active_workspace_changed), tasklist); + G_CALLBACK (xfce_tasklist_active_workspace_changed), tasklist); g_signal_connect (G_OBJECT (tasklist->screen), "window-opened", - G_CALLBACK (xfce_tasklist_window_added), tasklist); + G_CALLBACK (xfce_tasklist_window_added), tasklist); g_signal_connect (G_OBJECT (tasklist->screen), "window-closed", - G_CALLBACK (xfce_tasklist_window_removed), tasklist); + G_CALLBACK (xfce_tasklist_window_removed), tasklist); g_signal_connect (G_OBJECT (tasklist->workspace_group), "viewports-changed", - G_CALLBACK (xfce_tasklist_viewports_changed), tasklist); + G_CALLBACK (xfce_tasklist_viewports_changed), tasklist); /* update the viewport if not all monitors are shown */ if (!tasklist->all_monitors) - { - /* update the monitor geometry */ - xfce_tasklist_update_monitor_geometry (tasklist); - } + { + /* update the monitor geometry */ + xfce_tasklist_update_monitor_geometry (tasklist); + } } @@ -1662,25 +1714,25 @@ xfce_tasklist_connect_screen (XfceTasklist *tasklist) static void xfce_tasklist_disconnect_screen (XfceTasklist *tasklist) { - GSList *li, *lnext; - GList *wi, *wnext; + GSList *li, *lnext; + GList *wi, *wnext; XfceTasklistChild *child; - guint n; + guint n; panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); panel_return_if_fail (XFW_IS_SCREEN (tasklist->screen)); /* disconnect configure-event signal */ g_signal_handlers_disconnect_by_func ( - G_OBJECT (gtk_widget_get_toplevel (GTK_WIDGET (tasklist))), - G_CALLBACK (xfce_tasklist_configure_event), tasklist); + G_OBJECT (gtk_widget_get_toplevel (GTK_WIDGET (tasklist))), + G_CALLBACK (xfce_tasklist_configure_event), tasklist); /* disconnect monitor signals */ n = g_signal_handlers_disconnect_matched (G_OBJECT (tasklist->screen), - G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, tasklist); + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, tasklist); panel_return_if_fail (n == 3); n = g_signal_handlers_disconnect_matched (G_OBJECT (tasklist->workspace_group), - G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, tasklist); + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, tasklist); panel_return_if_fail (n == 2); /* delete all known apps (and their buttons) */ @@ -1713,15 +1765,15 @@ xfce_tasklist_disconnect_screen (XfceTasklist *tasklist) panel_assert (tasklist->windows == NULL); panel_assert (tasklist->skipped_windows == NULL); - g_clear_object(&tasklist->screen); + g_clear_object (&tasklist->screen); tasklist->display = NULL; } static gboolean -xfce_tasklist_configure_event (GtkWidget *widget, - GdkEvent *event, +xfce_tasklist_configure_event (GtkWidget *widget, + GdkEvent *event, XfceTasklist *tasklist) { panel_return_val_if_fail (XFCE_IS_TASKLIST (tasklist), FALSE); @@ -1737,13 +1789,13 @@ xfce_tasklist_configure_event (GtkWidget *widget, static void -xfce_tasklist_active_window_changed (XfwScreen *screen, - XfwWindow *previous_window, +xfce_tasklist_active_window_changed (XfwScreen *screen, + XfwWindow *previous_window, XfceTasklist *tasklist) { - XfwWindow *active_window; - XfwApplication *app = NULL; - GList *li; + XfwWindow *active_window; + XfwApplication *app = NULL; + GList *li; XfceTasklistChild *child; panel_return_if_fail (XFW_IS_SCREEN (screen)); @@ -1780,17 +1832,17 @@ xfce_tasklist_active_window_changed (XfwScreen *screen, if (app) { for (li = tasklist->windows; li != NULL; li = li->next) - { - child = li->data; - if (child->type == CHILD_TYPE_GROUP - && child->app == app) - { - /* update the button's state and icon, the latter makes sure it is rendered correctly - if all previous group windows were minimized */ - xfce_tasklist_group_button_icon_changed (child->app, child); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (child->button), TRUE); - } - } + { + child = li->data; + if (child->type == CHILD_TYPE_GROUP + && child->app == app) + { + /* update the button's state and icon, the latter makes sure it is rendered correctly + if all previous group windows were minimized */ + xfce_tasklist_group_button_icon_changed (child->app, child); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (child->button), TRUE); + } + } } /* release the lock */ @@ -1804,8 +1856,8 @@ xfce_tasklist_active_workspace_changed (XfwWorkspaceGroup *group, XfwWorkspace *previous_workspace, XfceTasklist *tasklist) { - GList *windows, *li; - XfwWorkspace *active_ws; + GList *windows, *li; + XfwWorkspace *active_ws; XfceTasklistChild *child; panel_return_if_fail (XFW_IS_WORKSPACE_GROUP (group)); @@ -1844,8 +1896,8 @@ xfce_tasklist_active_workspace_changed (XfwWorkspaceGroup *group, static void -xfce_tasklist_window_added (XfwScreen *screen, - XfwWindow *window, +xfce_tasklist_window_added (XfwScreen *screen, + XfwWindow *window, XfceTasklist *tasklist) { XfceTasklistChild *child; @@ -1861,7 +1913,7 @@ xfce_tasklist_window_added (XfwScreen *screen, { tasklist->skipped_windows = g_slist_prepend (tasklist->skipped_windows, window); g_signal_connect (G_OBJECT (window), "state-changed", - G_CALLBACK (xfce_tasklist_skipped_windows_state_changed), tasklist); + G_CALLBACK (xfce_tasklist_skipped_windows_state_changed), tasklist); return; } @@ -1897,14 +1949,14 @@ xfce_tasklist_window_added (XfwScreen *screen, static void -xfce_tasklist_window_removed (XfwScreen *screen, - XfwWindow *window, +xfce_tasklist_window_removed (XfwScreen *screen, + XfwWindow *window, XfceTasklist *tasklist) { - GList *li; - GSList *lp; + GList *li; + GSList *lp; XfceTasklistChild *child; - guint n; + guint n; panel_return_if_fail (XFW_IS_SCREEN (screen)); panel_return_if_fail (XFW_IS_WINDOW (window)); @@ -1916,8 +1968,7 @@ xfce_tasklist_window_removed (XfwScreen *screen, && (lp = g_slist_find (tasklist->skipped_windows, window)) != NULL) { tasklist->skipped_windows = g_slist_delete_link (tasklist->skipped_windows, lp); - g_signal_handlers_disconnect_by_func (G_OBJECT (window), - G_CALLBACK (xfce_tasklist_skipped_windows_state_changed), tasklist); + g_signal_handlers_disconnect_by_func (window, xfce_tasklist_skipped_windows_state_changed, tasklist); return; } @@ -1932,7 +1983,7 @@ xfce_tasklist_window_removed (XfwScreen *screen, /* disconnect from all the window watch functions */ panel_return_if_fail (XFW_IS_WINDOW (window)); n = g_signal_handlers_disconnect_matched (G_OBJECT (window), - G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, child); + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, child); #ifdef ENABLE_X11 /* hide the wireframe */ @@ -1953,7 +2004,7 @@ xfce_tasklist_window_removed (XfwScreen *screen, } } - gtk_widget_queue_resize (GTK_WIDGET (tasklist)); + gtk_widget_queue_resize (GTK_WIDGET (tasklist)); } @@ -1977,10 +2028,10 @@ xfce_tasklist_viewports_changed (XfwWorkspaceGroup *group, static void -xfce_tasklist_skipped_windows_state_changed (XfwWindow *window, - XfwWindowState changed_state, - XfwWindowState new_state, - XfceTasklist *tasklist) +xfce_tasklist_skipped_windows_state_changed (XfwWindow *window, + XfwWindowState changed_state, + XfwWindowState new_state, + XfceTasklist *tasklist) { panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); panel_return_if_fail (XFW_IS_WINDOW (window)); @@ -1990,8 +2041,7 @@ xfce_tasklist_skipped_windows_state_changed (XfwWindow *window, { /* remove from list */ tasklist->skipped_windows = g_slist_remove (tasklist->skipped_windows, window); - g_signal_handlers_disconnect_by_func (G_OBJECT (window), - G_CALLBACK (xfce_tasklist_skipped_windows_state_changed), tasklist); + g_signal_handlers_disconnect_by_func (window, xfce_tasklist_skipped_windows_state_changed, tasklist); /* pretend a normal window insert */ xfce_tasklist_window_added (xfw_window_get_screen (window), window, tasklist); @@ -2002,7 +2052,7 @@ xfce_tasklist_skipped_windows_state_changed (XfwWindow *window, static void xfce_tasklist_sort (XfceTasklist *tasklist, - gboolean sort_groups) + gboolean sort_groups) { panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -2029,12 +2079,11 @@ xfce_tasklist_sort (XfceTasklist *tasklist, static gboolean xfce_tasklist_update_icon_geometries (gpointer data) { - - XfceTasklist *tasklist = XFCE_TASKLIST (data); - GList *li; - GSList *lp; - gint root_x, root_y; - GtkWidget *toplevel; + XfceTasklist *tasklist = XFCE_TASKLIST (data); + GList *li; + GSList *lp; + gint root_x, root_y; + GtkWidget *toplevel; toplevel = gtk_widget_get_toplevel (GTK_WIDGET (tasklist)); gtk_window_get_position (GTK_WINDOW (toplevel), &root_x, &root_y); @@ -2043,8 +2092,8 @@ xfce_tasklist_update_icon_geometries (gpointer data) for (li = tasklist->windows; li != NULL; li = li->next) { XfceTasklistChild *child, *child2; - GtkAllocation alloc; - GdkWindow *window; + GtkAllocation alloc; + GdkWindow *window; child = li->data; @@ -2141,7 +2190,7 @@ xfce_tasklist_child_drag_motion_timeout (gpointer data) } else if (child->type == CHILD_TYPE_GROUP) { - /* TODO popup menu */ + /* TODO popup menu */ } return FALSE; @@ -2162,10 +2211,10 @@ xfce_tasklist_child_drag_motion_timeout_destroyed (gpointer data) static gboolean xfce_tasklist_child_drag_motion (XfceTasklistChild *child, - GdkDragContext *context, - gint x, - gint y, - guint timestamp) + GdkDragContext *context, + gint x, + gint y, + guint timestamp) { GtkWidget *dnd_widget; @@ -2175,7 +2224,7 @@ xfce_tasklist_child_drag_motion (XfceTasklistChild *child, dnd_widget = gtk_drag_get_source_widget (context); if (dnd_widget == NULL || (gtk_widget_get_parent (dnd_widget) != GTK_WIDGET (child->tasklist) - && !XFCE_IS_PANEL_PLUGIN (dnd_widget))) + && !XFCE_IS_PANEL_PLUGIN (dnd_widget))) { child->motion_timestamp = timestamp; if (child->motion_timeout_id == 0 @@ -2208,8 +2257,8 @@ xfce_tasklist_child_drag_motion (XfceTasklistChild *child, static void xfce_tasklist_child_drag_leave (XfceTasklistChild *child, - GdkDragContext *context, - GtkDragResult result) + GdkDragContext *context, + GtkDragResult result) { panel_return_if_fail (XFCE_IS_TASKLIST (child->tasklist)); @@ -2220,9 +2269,9 @@ xfce_tasklist_child_drag_leave (XfceTasklistChild *child, static void -xfce_tasklist_child_drag_begin_event (GtkWidget *widget, +xfce_tasklist_child_drag_begin_event (GtkWidget *widget, GdkDragContext *context, - gpointer user_data) + gpointer user_data) { GtkWidget *plugin = user_data; @@ -2233,9 +2282,9 @@ xfce_tasklist_child_drag_begin_event (GtkWidget *widget, static void -xfce_tasklist_child_drag_end_event (GtkWidget *widget, +xfce_tasklist_child_drag_end_event (GtkWidget *widget, GdkDragContext *context, - gpointer user_data) + gpointer user_data) { GtkWidget *plugin = user_data; @@ -2249,9 +2298,9 @@ static XfceTasklistChild * xfce_tasklist_child_new (XfceTasklist *tasklist) { XfceTasklistChild *child; - XfcePanelPlugin *plugin; - GtkCssProvider *provider; - gchar *css_string; + XfcePanelPlugin *plugin; + GtkCssProvider *provider; + gchar *css_string; panel_return_val_if_fail (XFCE_IS_TASKLIST (tasklist), NULL); @@ -2263,13 +2312,13 @@ xfce_tasklist_child_new (XfceTasklist *tasklist) gtk_widget_set_parent (child->button, GTK_WIDGET (tasklist)); gtk_button_set_relief (GTK_BUTTON (child->button), tasklist->button_relief); - gtk_widget_add_events (GTK_WIDGET(child->button), GDK_SCROLL_MASK - | GDK_SMOOTH_SCROLL_MASK); + gtk_widget_add_events (GTK_WIDGET (child->button), GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK); g_object_bind_property (tasklist, "show_tooltips", child->button, "has-tooltip", G_BINDING_SYNC_CREATE); - child->box = gtk_box_new (!xfce_tasklist_vertical (tasklist) ? - GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, 6); + child->box = gtk_box_new (!xfce_tasklist_vertical (tasklist) ? GTK_ORIENTATION_HORIZONTAL + : GTK_ORIENTATION_VERTICAL, + 6); gtk_container_add (GTK_CONTAINER (child->button), child->box); gtk_widget_show (child->box); @@ -2383,20 +2432,20 @@ xfce_tasklist_wireframe_destroy (XfceTasklist *tasklist) static void -xfce_tasklist_wireframe_update (XfceTasklist *tasklist, +xfce_tasklist_wireframe_update (XfceTasklist *tasklist, XfceTasklistChild *child) { - Display *dpy; - GdkDisplay *gdpy; - GdkWindow *gdkwindow; - GdkRectangle rect; - gint x_root, y_root; - XSetWindowAttributes attrs; - GC gc; - XRectangle xrect; - GtkBorder extents; - GtkAllocation alloc; - guint scale_factor; + Display *dpy; + GdkDisplay *gdpy; + GdkWindow *gdkwindow; + GdkRectangle rect; + gint x_root, y_root; + XSetWindowAttributes attrs; + GC gc; + XRectangle xrect; + GtkBorder extents; + GtkAllocation alloc; + guint scale_factor; panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); panel_return_if_fail (tasklist->show_wireframes); @@ -2505,7 +2554,7 @@ xfce_tasklist_wireframe_update (XfceTasklist *tasklist, **/ static inline gboolean xfce_tasklist_button_visible (XfceTasklistChild *child, - XfwWorkspace *active_ws) + XfwWorkspace *active_ws) { XfceTasklist *tasklist = XFCE_TASKLIST (child->tasklist); @@ -2521,14 +2570,14 @@ xfce_tasklist_button_visible (XfceTasklistChild *child, GList *monitors = xfw_window_get_monitors (child->window); if (!g_list_find (monitors, monitor)) - return FALSE; + return FALSE; } if (tasklist->all_workspaces || (active_ws != NULL && (G_UNLIKELY (xfw_workspace_get_state (active_ws) & XFW_WORKSPACE_STATE_VIRTUAL) - ? xfw_window_is_in_viewport (child->window, active_ws) - : xfw_window_is_on_workspace (child->window, active_ws))) + ? xfw_window_is_in_viewport (child->window, active_ws) + : xfw_window_is_on_workspace (child->window, active_ws))) || (tasklist->all_blinking && xfce_arrow_button_get_blinking (XFCE_ARROW_BUTTON (child->button)))) { @@ -2544,20 +2593,18 @@ xfce_tasklist_button_visible (XfceTasklistChild *child, static gint xfce_tasklist_button_compare (gconstpointer child_a, gconstpointer child_b, - gpointer user_data) + gpointer user_data) { const XfceTasklistChild *a = child_a, *b = child_b; - XfceTasklist *tasklist = XFCE_TASKLIST (user_data); - gint retval; - XfwApplication *app_a, *app_b; - const gchar *name_a, *name_b; - XfwWorkspace *workspace_a, *workspace_b; - gint num_a = -1, num_b = -1; - - panel_return_val_if_fail (a->type == CHILD_TYPE_GROUP - || XFW_IS_WINDOW (a->window), 0); - panel_return_val_if_fail (b->type == CHILD_TYPE_GROUP - || XFW_IS_WINDOW (b->window), 0); + XfceTasklist *tasklist = XFCE_TASKLIST (user_data); + gint retval; + XfwApplication *app_a, *app_b; + const gchar *name_a, *name_b; + XfwWorkspace *workspace_a, *workspace_b; + gint num_a = -1, num_b = -1; + + panel_return_val_if_fail (a->type == CHILD_TYPE_GROUP || XFW_IS_WINDOW (a->window), 0); + panel_return_val_if_fail (b->type == CHILD_TYPE_GROUP || XFW_IS_WINDOW (b->window), 0); /* just append to the list */ if (tasklist->sort_order == XFCE_TASKLIST_SORT_ORDER_DND) @@ -2616,7 +2663,7 @@ xfce_tasklist_button_compare (gconstpointer child_a, name_a = xfw_window_get_name (a->window); if (xfce_str_is_empty (name_b) && b->window != NULL) - name_b = xfw_window_get_name (b->window) ; + name_b = xfw_window_get_name (b->window); if (name_a == NULL) name_a = ""; @@ -2670,7 +2717,7 @@ xfce_tasklist_button_compare (gconstpointer child_a, static void force_box_layout_update (XfceTasklistChild *child) { - gint box_baseline; + gint box_baseline; GtkAllocation box_allocation; /* Workarounds needed in order to force the box to layout its children. @@ -2684,14 +2731,14 @@ force_box_layout_update (XfceTasklistChild *child) static void -xfce_tasklist_button_icon_changed (XfwWindow *window, +xfce_tasklist_button_icon_changed (XfwWindow *window, XfceTasklistChild *child) { GtkStyleContext *context; - GdkPixbuf *pixbuf; + GdkPixbuf *pixbuf; cairo_surface_t *surface; - XfceTasklist *tasklist = child->tasklist; - gint icon_size, scale_factor, old_width = -1, old_height = -1; + XfceTasklist *tasklist = child->tasklist; + gint icon_size, scale_factor, old_width = -1, old_height = -1; panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); panel_return_if_fail (GTK_IS_WIDGET (child->icon)); @@ -2705,7 +2752,7 @@ xfce_tasklist_button_icon_changed (XfwWindow *window, context = gtk_widget_get_style_context (GTK_WIDGET (child->icon)); scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (child->tasklist)); if (child->type == CHILD_TYPE_GROUP_MENU - && ! gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_size, NULL)) + && !gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_size, NULL)) icon_size = 16; else icon_size = xfce_panel_plugin_get_icon_size (xfce_tasklist_get_panel_plugin (tasklist)) @@ -2739,9 +2786,9 @@ xfce_tasklist_button_icon_changed (XfwWindow *window, if (child->pixbuf != NULL) { - old_width = gdk_pixbuf_get_width (child->pixbuf); - old_height = gdk_pixbuf_get_height (child->pixbuf); - g_object_unref (child->pixbuf); + old_width = gdk_pixbuf_get_width (child->pixbuf); + old_height = gdk_pixbuf_get_height (child->pixbuf); + g_object_unref (child->pixbuf); } child->pixbuf = g_object_ref (pixbuf); @@ -2756,11 +2803,11 @@ xfce_tasklist_button_icon_changed (XfwWindow *window, static void -xfce_tasklist_button_name_changed (XfwWindow *window, +xfce_tasklist_button_name_changed (XfwWindow *window, XfceTasklistChild *child) { - const gchar *name; - gchar *label = NULL; + const gchar *name; + gchar *label = NULL; GtkStyleContext *ctx; panel_return_if_fail (window == NULL || child->window == window); @@ -2785,8 +2832,7 @@ xfce_tasklist_button_name_changed (XfwWindow *window, } else { - if ((!child->tasklist->only_minimized - && xfw_window_is_minimized (child->window)) + if ((!child->tasklist->only_minimized && xfw_window_is_minimized (child->window)) || xfw_window_is_shaded (child->window)) gtk_style_context_add_class (ctx, "label-hidden"); } @@ -2805,15 +2851,15 @@ xfce_tasklist_button_name_changed (XfwWindow *window, static void -xfce_tasklist_button_state_changed (XfwWindow *window, - XfwWindowState changed_state, - XfwWindowState new_state, +xfce_tasklist_button_state_changed (XfwWindow *window, + XfwWindowState changed_state, + XfwWindowState new_state, XfceTasklistChild *child) { - gboolean blink; - XfwScreen *screen; - XfceTasklist *tasklist; - XfwWorkspace *active_ws; + gboolean blink; + XfwScreen *screen; + XfceTasklist *tasklist; + XfwWorkspace *active_ws; XfceTasklistChild *temp_child; panel_return_if_fail (XFW_IS_WINDOW (window)); @@ -2890,7 +2936,7 @@ xfce_tasklist_button_state_changed (XfwWindow *window, XfceTasklistChild *group_child = g_hash_table_lookup (child->tasklist->apps, child->app); /* stop blinking only if no window in group needs attention */ - if (! blink) + if (!blink) for (GSList *lp = group_child->windows; lp != NULL; lp = lp->next) { temp_child = lp->data; @@ -2914,7 +2960,7 @@ xfce_tasklist_button_state_changed (XfwWindow *window, static void -xfce_tasklist_button_workspace_changed (XfwWindow *window, +xfce_tasklist_button_workspace_changed (XfwWindow *window, XfceTasklistChild *child) { XfceTasklist *tasklist = XFCE_TASKLIST (child->tasklist); @@ -2931,7 +2977,7 @@ xfce_tasklist_button_workspace_changed (XfwWindow *window, static void -xfce_tasklist_button_geometry_changed2 (XfwWindow *window, +xfce_tasklist_button_geometry_changed2 (XfwWindow *window, XfceTasklistChild *child) { XfwWorkspace *active_ws; @@ -2955,7 +3001,7 @@ xfce_tasklist_button_geometry_changed2 (XfwWindow *window, #ifdef ENABLE_X11 static void -xfce_tasklist_button_geometry_changed (XfwWindow *window, +xfce_tasklist_button_geometry_changed (XfwWindow *window, XfceTasklistChild *child) { panel_return_if_fail (child->window == window); @@ -2967,18 +3013,16 @@ xfce_tasklist_button_geometry_changed (XfwWindow *window, static gboolean -xfce_tasklist_button_leave_notify_event (GtkWidget *button, - GdkEventCrossing *event, +xfce_tasklist_button_leave_notify_event (GtkWidget *button, + GdkEventCrossing *event, XfceTasklistChild *child) { panel_return_val_if_fail (XFCE_IS_TASKLIST (child->tasklist), FALSE); panel_return_val_if_fail (child->type != CHILD_TYPE_GROUP, FALSE); /* disconnect signals */ - g_signal_handlers_disconnect_by_func (button, - xfce_tasklist_button_leave_notify_event, child); - g_signal_handlers_disconnect_by_func (child->window, - xfce_tasklist_button_geometry_changed, child); + g_signal_handlers_disconnect_by_func (button, xfce_tasklist_button_leave_notify_event, child); + g_signal_handlers_disconnect_by_func (child->window, xfce_tasklist_button_geometry_changed, child); /* unmap and destroy the wireframe window */ xfce_tasklist_wireframe_hide (child->tasklist); @@ -2990,8 +3034,8 @@ xfce_tasklist_button_leave_notify_event (GtkWidget *button, static gboolean -xfce_tasklist_button_enter_notify_event (GtkWidget *button, - GdkEventCrossing *event, +xfce_tasklist_button_enter_notify_event (GtkWidget *button, + GdkEventCrossing *event, XfceTasklistChild *child) { panel_return_val_if_fail (XFCE_IS_TASKLIST (child->tasklist), FALSE); @@ -3009,11 +3053,11 @@ xfce_tasklist_button_enter_notify_event (GtkWidget *button, /* connect signal to destroy the window when the user leaves the button */ g_signal_connect (G_OBJECT (button), "leave-notify-event", - G_CALLBACK (xfce_tasklist_button_leave_notify_event), child); + G_CALLBACK (xfce_tasklist_button_leave_notify_event), child); /* watch geometry changes */ g_signal_connect (G_OBJECT (child->window), "geometry-changed", - G_CALLBACK (xfce_tasklist_button_geometry_changed), child); + G_CALLBACK (xfce_tasklist_button_geometry_changed), child); #endif return FALSE; @@ -3033,7 +3077,7 @@ xfce_tasklist_button_get_child_path (XfceTasklistChild *child) if (pid > 0) { path = g_strdup_printf ("/proc/%d/exe", pid); - if (! g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_SYMLINK)) + if (!g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_SYMLINK)) { g_free (path); path = NULL; @@ -3047,7 +3091,7 @@ xfce_tasklist_button_get_child_path (XfceTasklistChild *child) static void -xfce_tasklist_button_start_new_instance_clicked (GtkWidget *widget, +xfce_tasklist_button_start_new_instance_clicked (GtkWidget *widget, XfceTasklistChild *child) { GError *error = NULL; @@ -3058,13 +3102,12 @@ xfce_tasklist_button_start_new_instance_clicked (GtkWidget *widget, if (!g_spawn_command_line_async (path, &error)) { - GtkWidget *dialog = - gtk_message_dialog_new (NULL, - 0, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Unable to start new instance of '%s'"), - path); + GtkWidget *dialog = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + _("Unable to start new instance of '%s'"), + path); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message); gtk_window_set_title (GTK_WINDOW (dialog), _("Error")); @@ -3080,10 +3123,10 @@ xfce_tasklist_button_start_new_instance_clicked (GtkWidget *widget, static void xfce_tasklist_button_add_launch_new_instance_item (XfceTasklistChild *child, - GtkWidget *menu, - gboolean append) + GtkWidget *menu, + gboolean append) { - gchar *path; + gchar *path; GtkWidget *sep; GtkWidget *item; @@ -3120,7 +3163,7 @@ xfce_tasklist_button_add_launch_new_instance_item (XfceTasklistChild *child, static void -xfce_tasklist_button_menu_destroy (GtkWidget *menu, +xfce_tasklist_button_menu_destroy (GtkWidget *menu, XfceTasklistChild *child) { panel_return_if_fail (XFCE_IS_TASKLIST (child->tasklist)); @@ -3128,19 +3171,19 @@ xfce_tasklist_button_menu_destroy (GtkWidget *menu, panel_return_if_fail (GTK_IS_WIDGET (menu)); panel_utils_destroy_later (menu); - if (! xfw_window_is_active (child->window)) + if (!xfw_window_is_active (child->window)) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (child->button), FALSE); } static gboolean -xfce_tasklist_button_button_press_event (GtkWidget *button, - GdkEventButton *event, +xfce_tasklist_button_button_press_event (GtkWidget *button, + GdkEventButton *event, XfceTasklistChild *child) { XfcePanelPlugin *plugin; - GtkWidget *menu; + GtkWidget *menu; panel_return_val_if_fail (XFCE_IS_TASKLIST (child->tasklist), FALSE); panel_return_val_if_fail (child->type != CHILD_TYPE_GROUP, FALSE); @@ -3165,7 +3208,7 @@ xfce_tasklist_button_button_press_event (GtkWidget *button, menu = xfw_window_action_menu_new (child->window); xfce_tasklist_button_add_launch_new_instance_item (child, menu, FALSE); g_signal_connect (G_OBJECT (menu), "deactivate", - G_CALLBACK (xfce_tasklist_button_menu_destroy), child); + G_CALLBACK (xfce_tasklist_button_menu_destroy), child); gtk_menu_attach_to_widget (GTK_MENU (menu), button, NULL); xfce_panel_plugin_popup_menu (plugin, GTK_MENU (menu), button, (GdkEvent *) event); @@ -3180,8 +3223,8 @@ xfce_tasklist_button_button_press_event (GtkWidget *button, static gboolean -xfce_tasklist_button_button_release_event (GtkWidget *button, - GdkEventButton *event, +xfce_tasklist_button_button_release_event (GtkWidget *button, + GdkEventButton *event, XfceTasklistChild *child) { GtkAllocation allocation; @@ -3198,10 +3241,10 @@ xfce_tasklist_button_button_release_event (GtkWidget *button, && event->x >= 0 && event->x < allocation.width && event->y >= 0 && event->y < allocation.height) { - if (event->button == 1 && ! GTK_IS_MENU_ITEM (button)) + if (event->button == 1 && !GTK_IS_MENU_ITEM (button)) { /* press the button */ - return ! xfce_tasklist_button_activate (child, event->time); + return !xfce_tasklist_button_activate (child, event->time); } else if (event->button == 2) { @@ -3236,7 +3279,7 @@ xfce_tasklist_button_button_release_event (GtkWidget *button, static void -xfce_tasklist_button_enter_notify_event_disconnected (gpointer data, +xfce_tasklist_button_enter_notify_event_disconnected (gpointer data, GClosure *closure) { XfceTasklistChild *child = data; @@ -3247,8 +3290,7 @@ xfce_tasklist_button_enter_notify_event_disconnected (gpointer data, /* we need to detach the geometry watch because that is connected * to the window we proxy and thus not disconnected when the * proxy dies */ - g_signal_handlers_disconnect_by_func (child->window, - xfce_tasklist_button_geometry_changed, child); + g_signal_handlers_disconnect_by_func (child->window, xfce_tasklist_button_geometry_changed, child); #endif g_object_unref (G_OBJECT (child->window)); @@ -3257,7 +3299,7 @@ xfce_tasklist_button_enter_notify_event_disconnected (gpointer data, static void -xfce_tasklist_button_proxy_menu_item_activate (GtkMenuItem *mi, +xfce_tasklist_button_proxy_menu_item_activate (GtkMenuItem *mi, XfceTasklistChild *child) { gint64 timestamp; @@ -3273,20 +3315,21 @@ xfce_tasklist_button_proxy_menu_item_activate (GtkMenuItem *mi, static GtkWidget * xfce_tasklist_button_proxy_menu_item (XfceTasklistChild *child, - gboolean allow_wireframe) + gboolean allow_wireframe) { - GtkWidget *mi; - GtkWidget *image; - GtkWidget *label; + GtkWidget *mi; + GtkWidget *image; + GtkWidget *label; GtkStyleContext *context_button; GtkStyleContext *context_menuitem; - GtkCssProvider *provider; - gchar *label_text = NULL, *css_string; - XfceTasklist *tasklist = child->tasklist; + GtkCssProvider *provider; + gchar *label_text = NULL, *css_string; + XfceTasklist *tasklist = child->tasklist; panel_return_val_if_fail (XFCE_IS_TASKLIST (child->tasklist), NULL); panel_return_val_if_fail (child->type == CHILD_TYPE_OVERFLOW_MENU - || child->type == CHILD_TYPE_GROUP_MENU, NULL); + || child->type == CHILD_TYPE_GROUP_MENU, + NULL); panel_return_val_if_fail (GTK_IS_LABEL (child->label), NULL); panel_return_val_if_fail (XFW_IS_WINDOW (child->window), NULL); @@ -3356,14 +3399,14 @@ xfce_tasklist_button_proxy_menu_item (XfceTasklistChild *child, { g_object_ref (G_OBJECT (child->window)); g_signal_connect_data (G_OBJECT (mi), "enter-notify-event", - G_CALLBACK (xfce_tasklist_button_enter_notify_event), child, - xfce_tasklist_button_enter_notify_event_disconnected, 0); + G_CALLBACK (xfce_tasklist_button_enter_notify_event), child, + xfce_tasklist_button_enter_notify_event_disconnected, 0); } g_signal_connect (G_OBJECT (mi), "activate", - G_CALLBACK (xfce_tasklist_button_proxy_menu_item_activate), child); + G_CALLBACK (xfce_tasklist_button_proxy_menu_item_activate), child); g_signal_connect (G_OBJECT (mi), "button-release-event", - G_CALLBACK (xfce_tasklist_button_button_release_event), child); + G_CALLBACK (xfce_tasklist_button_button_release_event), child); /* TODO item dnd */ @@ -3374,13 +3417,13 @@ xfce_tasklist_button_proxy_menu_item (XfceTasklistChild *child, static gboolean xfce_tasklist_button_activate (XfceTasklistChild *child, - guint32 timestamp) + guint32 timestamp) { - XfwWorkspace *workspace; - GdkScreen *screen; - GdkRectangle window_geom, workspace_geom; - gint screen_width, screen_height; - guint scale_factor; + XfwWorkspace *workspace; + GdkScreen *screen; + GdkRectangle window_geom, workspace_geom; + gint screen_width, screen_height; + guint scale_factor; panel_return_val_if_fail (XFCE_IS_TASKLIST (child->tasklist), FALSE); panel_return_val_if_fail (XFW_IS_WINDOW (child->window), FALSE); @@ -3400,8 +3443,7 @@ xfce_tasklist_button_activate (XfceTasklistChild *child, /* we only change worksapces/viewports for non-pinned windows * and if all workspaces/viewports are shown or if we have * all blinking enabled and the current button is blinking */ - if ((child->tasklist->all_workspaces - && !xfw_window_is_pinned (child->window)) + if ((child->tasklist->all_workspaces && !xfw_window_is_pinned (child->window)) || (child->tasklist->all_blinking && xfce_arrow_button_get_blinking (XFCE_ARROW_BUTTON (child->button)))) { @@ -3501,11 +3543,11 @@ xfce_tasklist_button_activate (XfceTasklistChild *child, static void -xfce_tasklist_button_drag_data_get (GtkWidget *button, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint timestamp, +xfce_tasklist_button_drag_data_get (GtkWidget *button, + GdkDragContext *context, + GtkSelectionData *selection_data, + guint info, + guint timestamp, XfceTasklistChild *child) { gulong xid; @@ -3515,14 +3557,14 @@ xfce_tasklist_button_drag_data_get (GtkWidget *button, xid = tasklist_window_get_xid (child->window); gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), - 8, (guchar *)&xid, sizeof (gulong)); + 8, (guchar *) &xid, sizeof (gulong)); } static void -xfce_tasklist_button_drag_begin (GtkWidget *button, - GdkDragContext *context, +xfce_tasklist_button_drag_begin (GtkWidget *button, + GdkDragContext *context, XfceTasklistChild *child) { GdkPixbuf *pixbuf; @@ -3530,7 +3572,7 @@ xfce_tasklist_button_drag_begin (GtkWidget *button, panel_return_if_fail (XFW_IS_WINDOW (child->window)); - if (! gtk_icon_size_lookup (GTK_ICON_SIZE_DND, &size, NULL)) + if (!gtk_icon_size_lookup (GTK_ICON_SIZE_DND, &size, NULL)) size = 32; scale_factor = gtk_widget_get_scale_factor (button); pixbuf = xfw_window_get_icon (child->window, size, scale_factor); @@ -3545,20 +3587,20 @@ xfce_tasklist_button_drag_begin (GtkWidget *button, static void -xfce_tasklist_button_drag_data_received (GtkWidget *button, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection_data, - guint info, - guint drag_time, +xfce_tasklist_button_drag_data_received (GtkWidget *button, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *selection_data, + guint info, + guint drag_time, XfceTasklistChild *child2) { - GList *li, *sibling; - gulong xid; + GList *li, *sibling; + gulong xid; XfceTasklistChild *child; - XfceTasklist *tasklist = XFCE_TASKLIST (child2->tasklist); - GtkAllocation allocation; + XfceTasklist *tasklist = XFCE_TASKLIST (child2->tasklist); + GtkAllocation allocation; panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -3599,11 +3641,11 @@ xfce_tasklist_button_drag_data_received (GtkWidget *button, static XfceTasklistChild * -xfce_tasklist_button_new (XfwWindow *window, +xfce_tasklist_button_new (XfwWindow *window, XfceTasklist *tasklist) { XfceTasklistChild *child; - static guint unique_id_counter = 0; + static guint unique_id_counter = 0; panel_return_val_if_fail (XFCE_IS_TASKLIST (tasklist), NULL); panel_return_val_if_fail (XFW_IS_WINDOW (window), NULL); @@ -3626,31 +3668,31 @@ xfce_tasklist_button_new (XfwWindow *window, source_targets, G_N_ELEMENTS (source_targets), GDK_ACTION_MOVE); g_signal_connect (G_OBJECT (child->button), "drag-data-get", - G_CALLBACK (xfce_tasklist_button_drag_data_get), child); + G_CALLBACK (xfce_tasklist_button_drag_data_get), child); g_signal_connect (G_OBJECT (child->button), "drag-begin", - G_CALLBACK (xfce_tasklist_button_drag_begin), child); + G_CALLBACK (xfce_tasklist_button_drag_begin), child); g_signal_connect (G_OBJECT (child->button), "drag-data-received", - G_CALLBACK (xfce_tasklist_button_drag_data_received), child); + G_CALLBACK (xfce_tasklist_button_drag_data_received), child); /* note that the same signals should be in the proxy menu item too */ g_signal_connect (G_OBJECT (child->button), "enter-notify-event", - G_CALLBACK (xfce_tasklist_button_enter_notify_event), child); + G_CALLBACK (xfce_tasklist_button_enter_notify_event), child); g_signal_connect (G_OBJECT (child->button), "button-press-event", - G_CALLBACK (xfce_tasklist_button_button_press_event), child); + G_CALLBACK (xfce_tasklist_button_button_press_event), child); g_signal_connect (G_OBJECT (child->button), "button-release-event", - G_CALLBACK (xfce_tasklist_button_button_release_event), child); + G_CALLBACK (xfce_tasklist_button_button_release_event), child); /* monitor window changes */ g_signal_connect (G_OBJECT (window), "icon-changed", - G_CALLBACK (xfce_tasklist_button_icon_changed), child); + G_CALLBACK (xfce_tasklist_button_icon_changed), child); g_signal_connect (G_OBJECT (window), "name-changed", - G_CALLBACK (xfce_tasklist_button_name_changed), child); + G_CALLBACK (xfce_tasklist_button_name_changed), child); g_signal_connect (G_OBJECT (window), "state-changed", - G_CALLBACK (xfce_tasklist_button_state_changed), child); + G_CALLBACK (xfce_tasklist_button_state_changed), child); g_signal_connect (G_OBJECT (window), "workspace-changed", - G_CALLBACK (xfce_tasklist_button_workspace_changed), child); + G_CALLBACK (xfce_tasklist_button_workspace_changed), child); g_signal_connect (G_OBJECT (window), "geometry-changed", - G_CALLBACK (xfce_tasklist_button_geometry_changed2), child); + G_CALLBACK (xfce_tasklist_button_geometry_changed2), child); /* poke functions */ xfce_tasklist_button_icon_changed (window, child); @@ -3672,7 +3714,7 @@ xfce_tasklist_button_new (XfwWindow *window, static void xfce_tasklist_group_button_menu_minimize_all (XfceTasklistChild *group_child) { - GSList *li; + GSList *li; XfceTasklistChild *child; panel_return_if_fail (group_child->type == CHILD_TYPE_GROUP); @@ -3695,7 +3737,7 @@ xfce_tasklist_group_button_menu_minimize_all (XfceTasklistChild *group_child) static void xfce_tasklist_group_button_menu_unminimize_all (XfceTasklistChild *group_child) { - GSList *li; + GSList *li; XfceTasklistChild *child; panel_return_if_fail (group_child->type == CHILD_TYPE_GROUP); @@ -3718,7 +3760,7 @@ xfce_tasklist_group_button_menu_unminimize_all (XfceTasklistChild *group_child) static void xfce_tasklist_group_button_menu_maximize_all (XfceTasklistChild *group_child) { - GSList *li; + GSList *li; XfceTasklistChild *child; panel_return_if_fail (group_child->type == CHILD_TYPE_GROUP); @@ -3741,7 +3783,7 @@ xfce_tasklist_group_button_menu_maximize_all (XfceTasklistChild *group_child) static void xfce_tasklist_group_button_menu_unmaximize_all (XfceTasklistChild *group_child) { - GSList *li; + GSList *li; XfceTasklistChild *child; panel_return_if_fail (group_child->type == CHILD_TYPE_GROUP); @@ -3764,7 +3806,7 @@ xfce_tasklist_group_button_menu_unmaximize_all (XfceTasklistChild *group_child) static void xfce_tasklist_group_button_menu_close_all (XfceTasklistChild *group_child) { - GSList *li; + GSList *li; XfceTasklistChild *child; panel_return_if_fail (XFW_IS_APPLICATION (group_child->app)); @@ -3784,9 +3826,9 @@ xfce_tasklist_group_button_menu_close_all (XfceTasklistChild *group_child) static void -xfce_tasklist_group_button_menu_close (GtkWidget *menuitem, +xfce_tasklist_group_button_menu_close (GtkWidget *menuitem, XfceTasklistChild *child, - guint32 time) + guint32 time) { GtkWidget *menu = gtk_widget_get_parent (menuitem); @@ -3802,13 +3844,13 @@ xfce_tasklist_group_button_menu_close (GtkWidget *menuitem, static GtkWidget * xfce_tasklist_group_button_menu (XfceTasklistChild *group_child, - gboolean action_menu_entries) + gboolean action_menu_entries) { - GSList *li; + GSList *li; XfceTasklistChild *child; - GtkWidget *mi; - GtkWidget *menu; - GtkWidget *image; + GtkWidget *mi; + GtkWidget *menu; + GtkWidget *image; panel_return_val_if_fail (XFCE_IS_TASKLIST (group_child->tasklist), NULL); panel_return_val_if_fail (XFW_IS_APPLICATION (group_child->app), NULL); @@ -3827,7 +3869,7 @@ xfce_tasklist_group_button_menu (XfceTasklistChild *group_child, if (action_menu_entries) gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), - xfw_window_action_menu_new (child->window)); + xfw_window_action_menu_new (child->window)); if (li->next == NULL) xfce_tasklist_button_add_launch_new_instance_item (child, menu, TRUE); @@ -3845,13 +3887,13 @@ xfce_tasklist_group_button_menu (XfceTasklistChild *group_child, panel_image_menu_item_set_image (mi, image); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); g_signal_connect_swapped (G_OBJECT (mi), "activate", - G_CALLBACK (xfce_tasklist_group_button_menu_minimize_all), group_child); + G_CALLBACK (xfce_tasklist_group_button_menu_minimize_all), group_child); gtk_widget_show_all (mi); - mi = gtk_menu_item_new_with_mnemonic (_("Un_minimize All")); + mi = gtk_menu_item_new_with_mnemonic (_("Un_minimize All")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); g_signal_connect_swapped (G_OBJECT (mi), "activate", - G_CALLBACK (xfce_tasklist_group_button_menu_unminimize_all), group_child); + G_CALLBACK (xfce_tasklist_group_button_menu_unminimize_all), group_child); gtk_widget_show (mi); image = gtk_image_new_from_icon_name ("window-maximize-symbolic", GTK_ICON_SIZE_MENU); @@ -3859,13 +3901,13 @@ xfce_tasklist_group_button_menu (XfceTasklistChild *group_child, panel_image_menu_item_set_image (mi, image); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); g_signal_connect_swapped (G_OBJECT (mi), "activate", - G_CALLBACK (xfce_tasklist_group_button_menu_maximize_all), group_child); + G_CALLBACK (xfce_tasklist_group_button_menu_maximize_all), group_child); gtk_widget_show_all (mi); - mi = gtk_menu_item_new_with_mnemonic (_("_Unmaximize All")); + mi = gtk_menu_item_new_with_mnemonic (_("_Unmaximize All")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); g_signal_connect_swapped (G_OBJECT (mi), "activate", - G_CALLBACK (xfce_tasklist_group_button_menu_unmaximize_all), group_child); + G_CALLBACK (xfce_tasklist_group_button_menu_unmaximize_all), group_child); gtk_widget_show (mi); mi = gtk_separator_menu_item_new (); @@ -3873,11 +3915,11 @@ xfce_tasklist_group_button_menu (XfceTasklistChild *group_child, gtk_widget_show (mi); image = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU); - mi = panel_image_menu_item_new_with_mnemonic(_("_Close All")); + mi = panel_image_menu_item_new_with_mnemonic (_("_Close All")); panel_image_menu_item_set_image (mi, image); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); g_signal_connect_swapped (G_OBJECT (mi), "activate", - G_CALLBACK (xfce_tasklist_group_button_menu_close_all), group_child); + G_CALLBACK (xfce_tasklist_group_button_menu_close_all), group_child); gtk_widget_show_all (mi); } @@ -3887,7 +3929,7 @@ xfce_tasklist_group_button_menu (XfceTasklistChild *group_child, static void -xfce_tasklist_group_button_menu_destroy (GtkWidget *menu, +xfce_tasklist_group_button_menu_destroy (GtkWidget *menu, XfceTasklistChild *group_child) { GSList *lp; @@ -3917,8 +3959,8 @@ xfce_tasklist_group_button_menu_destroy (GtkWidget *menu, static gboolean -xfce_tasklist_group_button_button_draw (GtkWidget *widget, - cairo_t *cr, +xfce_tasklist_group_button_button_draw (GtkWidget *widget, + cairo_t *cr, XfceTasklistChild *group_child) { if (group_child->n_windows > 1) @@ -4031,12 +4073,12 @@ xfce_tasklist_group_button_button_draw (GtkWidget *widget, static gboolean -xfce_tasklist_group_button_button_press_event (GtkWidget *button, - GdkEventButton *event, +xfce_tasklist_group_button_button_press_event (GtkWidget *button, + GdkEventButton *event, XfceTasklistChild *group_child) { XfcePanelPlugin *plugin; - GtkWidget *menu; + GtkWidget *menu; panel_return_val_if_fail (XFCE_IS_TASKLIST (group_child->tasklist), FALSE); panel_return_val_if_fail (group_child->type == CHILD_TYPE_GROUP, FALSE); @@ -4060,7 +4102,7 @@ xfce_tasklist_group_button_button_press_event (GtkWidget *button, { menu = xfce_tasklist_group_button_menu (group_child, event->button == 3); g_signal_connect (G_OBJECT (menu), "deactivate", - G_CALLBACK (xfce_tasklist_group_button_menu_destroy), group_child); + G_CALLBACK (xfce_tasklist_group_button_menu_destroy), group_child); gtk_menu_attach_to_widget (GTK_MENU (menu), button, NULL); xfce_panel_plugin_popup_menu (plugin, GTK_MENU (menu), button, (GdkEvent *) event); @@ -4075,8 +4117,8 @@ xfce_tasklist_group_button_button_press_event (GtkWidget *button, static gboolean -xfce_tasklist_group_button_button_release_event (GtkWidget *button, - GdkEventButton *event, +xfce_tasklist_group_button_button_release_event (GtkWidget *button, + GdkEventButton *event, XfceTasklistChild *group_child) { GtkAllocation allocation; @@ -4122,8 +4164,8 @@ xfce_tasklist_group_button_button_release_event (GtkWidget *button, static void -xfce_tasklist_group_button_button_size_allocate (GtkWidget *widget, - GtkAllocation *allocation, +xfce_tasklist_group_button_button_size_allocate (GtkWidget *widget, + GtkAllocation *allocation, XfceTasklistChild *child) { panel_return_if_fail (XFCE_IS_TASKLIST (child->tasklist)); @@ -4134,12 +4176,12 @@ xfce_tasklist_group_button_button_size_allocate (GtkWidget *widget, static void -xfce_tasklist_group_button_name_changed (XfwApplication *app, - GParamSpec *pspec, +xfce_tasklist_group_button_name_changed (XfwApplication *app, + GParamSpec *pspec, XfceTasklistChild *group_child) { - const gchar *name; - GSList *li; + const gchar *name; + GSList *li; XfceTasklistChild *child; panel_return_if_fail (app == NULL || group_child->app == app); @@ -4168,15 +4210,15 @@ xfce_tasklist_group_button_name_changed (XfwApplication *app, static void -xfce_tasklist_group_button_icon_changed (XfwApplication *app, +xfce_tasklist_group_button_icon_changed (XfwApplication *app, XfceTasklistChild *group_child) { - GtkStyleContext *context; - GdkPixbuf *pixbuf; - cairo_surface_t *surface; - GSList *li; - gboolean all_minimized_in_group = TRUE; - gint icon_size, scale_factor; + GtkStyleContext *context; + GdkPixbuf *pixbuf; + cairo_surface_t *surface; + GSList *li; + gboolean all_minimized_in_group = TRUE; + gint icon_size, scale_factor; panel_return_if_fail (XFCE_IS_TASKLIST (group_child->tasklist)); panel_return_if_fail (XFW_IS_APPLICATION (app)); @@ -4253,8 +4295,8 @@ xfce_tasklist_group_button_icon_changed (XfwApplication *app, static void xfce_tasklist_group_button_remove (XfceTasklistChild *group_child) { - GSList *li; - guint n; + GSList *li; + guint n; XfceTasklistChild *child; /* leave if hash table triggers this function where no group @@ -4269,7 +4311,7 @@ xfce_tasklist_group_button_remove (XfceTasklistChild *group_child) /* disconnect from all the group watch functions */ n = g_signal_handlers_disconnect_matched (G_OBJECT (group_child->app), - G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, group_child); + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, group_child); panel_return_if_fail (n == 2); /* disconnect from visible windows */ @@ -4278,10 +4320,10 @@ xfce_tasklist_group_button_remove (XfceTasklistChild *group_child) child = li->data; panel_return_if_fail (GTK_IS_BUTTON (child->button)); n = g_signal_handlers_disconnect_matched (G_OBJECT (child->button), - G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, group_child); + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, group_child); panel_return_if_fail (n == 2); n = g_signal_handlers_disconnect_matched (G_OBJECT (child->window), - G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, group_child); + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, group_child); panel_return_if_fail (n == 2); } @@ -4316,9 +4358,9 @@ xfce_tasklist_group_button_keep_dnd_position (XfceTasklistChild *group_child, static void xfce_tasklist_group_button_child_visible_changed (XfceTasklistChild *group_child) { - XfceTasklistChild *child; - GSList *li; - gint visible_counter = 0; + XfceTasklistChild *child; + GSList *li; + gint visible_counter = 0; XfceTasklistChildType type; panel_return_if_fail (group_child->type == CHILD_TYPE_GROUP); @@ -4342,7 +4384,7 @@ xfce_tasklist_group_button_child_visible_changed (XfceTasklistChild *group_child if (visible_counter > 1) { if (group_child->tasklist->sort_order == XFCE_TASKLIST_SORT_ORDER_DND - && ! gtk_widget_get_visible (group_child->button)) + && !gtk_widget_get_visible (group_child->button)) xfce_tasklist_group_button_keep_dnd_position (group_child, group_child->windows->data, group_child); @@ -4383,11 +4425,11 @@ xfce_tasklist_group_button_child_visible_changed (XfceTasklistChild *group_child static void xfce_tasklist_group_button_child_destroyed (XfceTasklistChild *group_child, - GtkWidget *child_button) + GtkWidget *child_button) { - GSList *li, *lnext; + GSList *li, *lnext; XfceTasklistChild *child; - guint n_children; + guint n_children; panel_return_if_fail (group_child->type == CHILD_TYPE_GROUP); panel_return_if_fail (GTK_IS_BUTTON (child_button)); @@ -4444,13 +4486,13 @@ xfce_tasklist_group_button_add_window (XfceTasklistChild *group_child, /* watch child visibility changes */ g_signal_connect_swapped (G_OBJECT (window_child->button), "notify::visible", - G_CALLBACK (xfce_tasklist_group_button_child_visible_changed), group_child); + G_CALLBACK (xfce_tasklist_group_button_child_visible_changed), group_child); g_signal_connect_swapped (G_OBJECT (window_child->button), "destroy", - G_CALLBACK (xfce_tasklist_group_button_child_destroyed), group_child); + G_CALLBACK (xfce_tasklist_group_button_child_destroyed), group_child); g_signal_connect_swapped (G_OBJECT (window_child->window), "name-changed", - G_CALLBACK (xfce_tasklist_group_button_sort), group_child); + G_CALLBACK (xfce_tasklist_group_button_sort), group_child); g_signal_connect_swapped (G_OBJECT (window_child->window), "workspace-changed", - G_CALLBACK (xfce_tasklist_group_button_sort), group_child); + G_CALLBACK (xfce_tasklist_group_button_sort), group_child); /* add to internal list */ group_child->windows = g_slist_insert_sorted_with_data (group_child->windows, window_child, @@ -4465,7 +4507,7 @@ xfce_tasklist_group_button_add_window (XfceTasklistChild *group_child, static XfceTasklistChild * xfce_tasklist_group_button_new (XfwApplication *app, - XfceTasklist *tasklist) + XfceTasklist *tasklist) { XfceTasklistChild *child; @@ -4478,20 +4520,20 @@ xfce_tasklist_group_button_new (XfwApplication *app, gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (child->button)), "group-button"); g_signal_connect_after (G_OBJECT (child->button), "draw", - G_CALLBACK (xfce_tasklist_group_button_button_draw), child); + G_CALLBACK (xfce_tasklist_group_button_button_draw), child); /* note that the same signals should be in the proxy menu item too */ g_signal_connect (G_OBJECT (child->button), "button-press-event", - G_CALLBACK (xfce_tasklist_group_button_button_press_event), child); + G_CALLBACK (xfce_tasklist_group_button_button_press_event), child); g_signal_connect (G_OBJECT (child->button), "button-release-event", - G_CALLBACK (xfce_tasklist_group_button_button_release_event), child); + G_CALLBACK (xfce_tasklist_group_button_button_release_event), child); g_signal_connect (G_OBJECT (child->button), "size-allocate", - G_CALLBACK (xfce_tasklist_group_button_button_size_allocate), child); + G_CALLBACK (xfce_tasklist_group_button_button_size_allocate), child); /* monitor app changes */ g_signal_connect (G_OBJECT (app), "icon-changed", - G_CALLBACK (xfce_tasklist_group_button_icon_changed), child); + G_CALLBACK (xfce_tasklist_group_button_icon_changed), child); g_signal_connect (G_OBJECT (app), "notify::name", - G_CALLBACK (xfce_tasklist_group_button_name_changed), child); + G_CALLBACK (xfce_tasklist_group_button_name_changed), child); /* poke functions */ xfce_tasklist_group_button_icon_changed (app, child); @@ -4512,7 +4554,7 @@ xfce_tasklist_group_button_new (XfwApplication *app, **/ static void xfce_tasklist_set_include_all_workspaces (XfceTasklist *tasklist, - gboolean all_workspaces) + gboolean all_workspaces) { panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -4537,7 +4579,7 @@ xfce_tasklist_set_include_all_workspaces (XfceTasklist *tasklist, static void xfce_tasklist_set_include_all_monitors (XfceTasklist *tasklist, - gboolean all_monitors) + gboolean all_monitors) { panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -4556,10 +4598,10 @@ xfce_tasklist_set_include_all_monitors (XfceTasklist *tasklist, static void -xfce_tasklist_set_button_relief (XfceTasklist *tasklist, - GtkReliefStyle button_relief) +xfce_tasklist_set_button_relief (XfceTasklist *tasklist, + GtkReliefStyle button_relief) { - GList *li; + GList *li; XfceTasklistChild *child; panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -4586,9 +4628,9 @@ xfce_tasklist_set_button_relief (XfceTasklist *tasklist, static void xfce_tasklist_set_show_labels (XfceTasklist *tasklist, - gboolean show_labels) + gboolean show_labels) { - GList *li; + GList *li; XfceTasklistChild *child; panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -4637,7 +4679,7 @@ xfce_tasklist_set_show_labels (XfceTasklist *tasklist, static void xfce_tasklist_set_show_only_minimized (XfceTasklist *tasklist, - gboolean only_minimized) + gboolean only_minimized) { panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -4657,7 +4699,7 @@ xfce_tasklist_set_show_only_minimized (XfceTasklist *tasklist, static void xfce_tasklist_set_show_wireframes (XfceTasklist *tasklist, - gboolean show_wireframes) + gboolean show_wireframes) { panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -4673,9 +4715,9 @@ xfce_tasklist_set_show_wireframes (XfceTasklist *tasklist, static void xfce_tasklist_set_label_decorations (XfceTasklist *tasklist, - gboolean label_decorations) + gboolean label_decorations) { - GList *li; + GList *li; XfceTasklistChild *child; panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -4696,7 +4738,7 @@ xfce_tasklist_set_label_decorations (XfceTasklist *tasklist, static void xfce_tasklist_set_grouping (XfceTasklist *tasklist, - gboolean grouping) + gboolean grouping) { panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -4718,8 +4760,8 @@ xfce_tasklist_set_grouping (XfceTasklist *tasklist, static void xfce_tasklist_update_orientation (XfceTasklist *tasklist) { - gboolean horizontal; - GList *li; + gboolean horizontal; + GList *li; XfceTasklistChild *child; horizontal = !xfce_tasklist_vertical (tasklist); @@ -4731,7 +4773,7 @@ xfce_tasklist_update_orientation (XfceTasklist *tasklist) /* update task box */ gtk_orientable_set_orientation (GTK_ORIENTABLE (child->box), - horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); + horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); /* update the label */ if (horizontal) @@ -4757,7 +4799,7 @@ xfce_tasklist_update_orientation (XfceTasklist *tasklist) void xfce_tasklist_set_nrows (XfceTasklist *tasklist, - gint nrows) + gint nrows) { panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); panel_return_if_fail (nrows >= 1); @@ -4772,8 +4814,8 @@ xfce_tasklist_set_nrows (XfceTasklist *tasklist, void -xfce_tasklist_set_mode (XfceTasklist *tasklist, - XfcePanelPluginMode mode) +xfce_tasklist_set_mode (XfceTasklist *tasklist, + XfcePanelPluginMode mode) { panel_return_if_fail (XFCE_IS_TASKLIST (tasklist)); @@ -4788,7 +4830,7 @@ xfce_tasklist_set_mode (XfceTasklist *tasklist, void xfce_tasklist_set_size (XfceTasklist *tasklist, - gint size) + gint size) { GList *li; @@ -4817,7 +4859,8 @@ xfce_tasklist_update_monitor_geometry (XfceTasklist *tasklist) { if (tasklist->update_monitor_geometry_id == 0) { - tasklist->update_monitor_geometry_id = gdk_threads_add_idle_full (G_PRIORITY_LOW, xfce_tasklist_update_monitor_geometry_idle, - tasklist, xfce_tasklist_update_monitor_geometry_idle_destroy); + tasklist->update_monitor_geometry_id + = gdk_threads_add_idle_full (G_PRIORITY_LOW, xfce_tasklist_update_monitor_geometry_idle, + tasklist, xfce_tasklist_update_monitor_geometry_idle_destroy); } } diff --git a/plugins/tasklist/tasklist-widget.h b/plugins/tasklist/tasklist-widget.h index 7e90b77d9..0ed4f44db 100644 --- a/plugins/tasklist/tasklist-widget.h +++ b/plugins/tasklist/tasklist-widget.h @@ -28,16 +28,20 @@ G_BEGIN_DECLS #define XFCE_TYPE_TASKLIST (xfce_tasklist_get_type ()) G_DECLARE_FINAL_TYPE (XfceTasklist, xfce_tasklist, XFCE, TASKLIST, GtkContainer) -void xfce_tasklist_set_mode (XfceTasklist *tasklist, - XfcePanelPluginMode mode); +void +xfce_tasklist_set_mode (XfceTasklist *tasklist, + XfcePanelPluginMode mode); -void xfce_tasklist_set_size (XfceTasklist *tasklist, - gint size); +void +xfce_tasklist_set_size (XfceTasklist *tasklist, + gint size); -void xfce_tasklist_set_nrows (XfceTasklist *tasklist, - gint nrows); +void +xfce_tasklist_set_nrows (XfceTasklist *tasklist, + gint nrows); -void xfce_tasklist_update_monitor_geometry (XfceTasklist *tasklist); +void +xfce_tasklist_update_monitor_geometry (XfceTasklist *tasklist); G_END_DECLS diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c index 9d264f558..21b6a709f 100644 --- a/plugins/tasklist/tasklist.c +++ b/plugins/tasklist/tasklist.c @@ -39,25 +39,32 @@ struct _TasklistPlugin XfcePanelPlugin __parent__; /* the tasklist widget */ - GtkWidget *tasklist; - GtkWidget *handle; + GtkWidget *tasklist; + GtkWidget *handle; }; -static void tasklist_plugin_construct (XfcePanelPlugin *panel_plugin); -static void tasklist_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode); -static gboolean tasklist_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); -static void tasklist_plugin_nrows_changed (XfcePanelPlugin *panel_plugin, - guint nrows); -static void tasklist_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, - XfceScreenPosition position); -static void tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); -static gboolean tasklist_plugin_handle_draw (GtkWidget *widget, - cairo_t *cr, - TasklistPlugin *plugin); +static void +tasklist_plugin_construct (XfcePanelPlugin *panel_plugin); +static void +tasklist_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode); +static gboolean +tasklist_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); +static void +tasklist_plugin_nrows_changed (XfcePanelPlugin *panel_plugin, + guint nrows); +static void +tasklist_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, + XfceScreenPosition position); +static void +tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); +static gboolean +tasklist_plugin_handle_draw (GtkWidget *widget, + cairo_t *cr, + TasklistPlugin *plugin); @@ -98,7 +105,7 @@ tasklist_plugin_init (TasklistPlugin *plugin) plugin->handle = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (box), plugin->handle, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (plugin->handle), "draw", - G_CALLBACK (tasklist_plugin_handle_draw), plugin); + G_CALLBACK (tasklist_plugin_handle_draw), plugin); gtk_widget_set_size_request (plugin->handle, 8, 8); gtk_widget_show (plugin->handle); @@ -115,9 +122,8 @@ tasklist_plugin_init (TasklistPlugin *plugin) static void tasklist_plugin_construct (XfcePanelPlugin *panel_plugin) { - TasklistPlugin *plugin = TASKLIST_PLUGIN (panel_plugin); - const PanelProperty properties[] = - { + TasklistPlugin *plugin = TASKLIST_PLUGIN (panel_plugin); + const PanelProperty properties[] = { { "show-labels", G_TYPE_BOOLEAN }, { "grouping", G_TYPE_BOOLEAN }, { "include-all-workspaces", G_TYPE_BOOLEAN }, @@ -152,8 +158,8 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin) static void -tasklist_plugin_mode_changed (XfcePanelPlugin *panel_plugin, - XfcePanelPluginMode mode) +tasklist_plugin_mode_changed (XfcePanelPlugin *panel_plugin, + XfcePanelPluginMode mode) { TasklistPlugin *plugin = TASKLIST_PLUGIN (panel_plugin); @@ -165,7 +171,7 @@ tasklist_plugin_mode_changed (XfcePanelPlugin *panel_plugin, static gboolean tasklist_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { TasklistPlugin *plugin = TASKLIST_PLUGIN (panel_plugin); @@ -179,7 +185,7 @@ tasklist_plugin_size_changed (XfcePanelPlugin *panel_plugin, static void tasklist_plugin_nrows_changed (XfcePanelPlugin *panel_plugin, - guint nrows) + guint nrows) { TasklistPlugin *plugin = TASKLIST_PLUGIN (panel_plugin); @@ -190,8 +196,8 @@ tasklist_plugin_nrows_changed (XfcePanelPlugin *panel_plugin, static void -tasklist_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, - XfceScreenPosition position) +tasklist_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, + XfceScreenPosition position) { TasklistPlugin *plugin = TASKLIST_PLUGIN (panel_plugin); @@ -206,9 +212,9 @@ static void tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) { TasklistPlugin *plugin = TASKLIST_PLUGIN (panel_plugin); - GtkBuilder *builder; - GObject *dialog; - GObject *object; + GtkBuilder *builder; + GObject *dialog; + GObject *object; /* setup the dialog */ builder = panel_utils_builder_new (panel_plugin, tasklist_dialog_ui, @@ -222,17 +228,17 @@ tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) g_object_bind_property (G_OBJECT (plugin->tasklist), (name), \ G_OBJECT (object), (property), \ G_BINDING_BIDIRECTIONAL \ - | G_BINDING_SYNC_CREATE); + | G_BINDING_SYNC_CREATE); #define TASKLIST_DIALOG_BIND_INV(name, property) \ object = gtk_builder_get_object (builder, (name)); \ panel_return_if_fail (G_IS_OBJECT (object)); \ g_object_bind_property (G_OBJECT (plugin->tasklist), \ - name, G_OBJECT (object), \ + name, G_OBJECT (object), \ property, \ G_BINDING_BIDIRECTIONAL \ - | G_BINDING_SYNC_CREATE \ - | G_BINDING_INVERT_BOOLEAN); + | G_BINDING_SYNC_CREATE \ + | G_BINDING_INVERT_BOOLEAN); TASKLIST_DIALOG_BIND ("show-labels", "active") TASKLIST_DIALOG_BIND ("grouping", "active") @@ -261,15 +267,15 @@ tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) static gboolean -tasklist_plugin_handle_draw (GtkWidget *widget, - cairo_t *cr, +tasklist_plugin_handle_draw (GtkWidget *widget, + cairo_t *cr, TasklistPlugin *plugin) { - GtkAllocation allocation; - GtkStyleContext *ctx; - gdouble x, y; - guint i; - GdkRGBA fg_rgba; + GtkAllocation allocation; + GtkStyleContext *ctx; + gdouble x, y; + guint i; + GdkRGBA fg_rgba; panel_return_val_if_fail (TASKLIST_IS_PLUGIN (plugin), FALSE); panel_return_val_if_fail (plugin->handle == widget, FALSE); @@ -292,8 +298,7 @@ tasklist_plugin_handle_draw (GtkWidget *widget, /* draw the handle */ for (i = 0; i < 3; i++) { - if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == - GTK_ORIENTATION_HORIZONTAL) + if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) == GTK_ORIENTATION_HORIZONTAL) { cairo_move_to (cr, x, y + (i * HANDLE_SIZE) - (HANDLE_SIZE / 2)); cairo_line_to (cr, x + HANDLE_SIZE, y + (i * HANDLE_SIZE) - (HANDLE_SIZE / 2)); diff --git a/plugins/tasklist/tasklist.h b/plugins/tasklist/tasklist.h index 297b918f6..c510d59cd 100644 --- a/plugins/tasklist/tasklist.h +++ b/plugins/tasklist/tasklist.h @@ -26,7 +26,8 @@ G_BEGIN_DECLS #define TASKLIST_TYPE_PLUGIN (tasklist_plugin_get_type ()) G_DECLARE_FINAL_TYPE (TasklistPlugin, tasklist_plugin, TASKLIST, PLUGIN, XfcePanelPlugin) -void tasklist_plugin_register_type (XfcePanelTypeModule *type_module); +void +tasklist_plugin_register_type (XfcePanelTypeModule *type_module); G_END_DECLS diff --git a/plugins/windowmenu/windowmenu.c b/plugins/windowmenu/windowmenu.c index 20d3ffbf0..d89e04be3 100644 --- a/plugins/windowmenu/windowmenu.c +++ b/plugins/windowmenu/windowmenu.c @@ -34,40 +34,40 @@ #include <libxfce4windowing/libxfce4windowing.h> #include <libxfce4windowingui/libxfce4windowingui.h> -#define MIN_MINIMIZED_ICON_LUCENCY (0) -#define MAX_MINIMIZED_ICON_LUCENCY (100) +#define MIN_MINIMIZED_ICON_LUCENCY (0) +#define MAX_MINIMIZED_ICON_LUCENCY (100) #define DEFAULT_MINIMIZED_ICON_LUCENCY (50) -#define MIN_MAX_WIDTH_CHARS (-1) -#define MAX_MAX_WIDTH_CHARS (G_MAXINT) -#define DEFAULT_MAX_WIDTH_CHARS (24) -#define DEFAULT_ELLIPSIZE_MODE (PANGO_ELLIPSIZE_MIDDLE) +#define MIN_MAX_WIDTH_CHARS (-1) +#define MAX_MAX_WIDTH_CHARS (G_MAXINT) +#define DEFAULT_MAX_WIDTH_CHARS (24) +#define DEFAULT_ELLIPSIZE_MODE (PANGO_ELLIPSIZE_MIDDLE) struct _WindowMenuPlugin { XfcePanelPlugin __parent__; /* the screen we're showing */ - XfwScreen *screen; - XfwWorkspaceGroup *workspace_group; + XfwScreen *screen; + XfwWorkspaceGroup *workspace_group; /* panel widgets */ - GtkWidget *button; - GtkWidget *icon; + GtkWidget *button; + GtkWidget *icon; /* settings */ - guint button_style : 1; - guint workspace_actions : 1; - guint workspace_names : 1; - guint urgentcy_notification : 1; - guint all_workspaces : 1; + guint button_style : 1; + guint workspace_actions : 1; + guint workspace_names : 1; + guint urgentcy_notification : 1; + guint all_workspaces : 1; /* urgent window counter */ - gint urgent_windows; + gint urgent_windows; /* gtk style properties */ - gint minimized_icon_lucency; - PangoEllipsizeMode ellipsize_mode; - gint max_width_chars; + gint minimized_icon_lucency; + PangoEllipsizeMode ellipsize_mode; + gint max_width_chars; }; enum @@ -88,45 +88,62 @@ enum -static void window_menu_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void window_menu_plugin_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void window_menu_plugin_style_updated (GtkWidget *widget); -static void window_menu_plugin_screen_changed (GtkWidget *widget, - GdkScreen *previous_screen); -static void window_menu_plugin_construct (XfcePanelPlugin *panel_plugin); -static void window_menu_plugin_free_data (XfcePanelPlugin *panel_plugin); -static void window_menu_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, - XfceScreenPosition screen_position); -static gboolean window_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size); -static void window_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); -static gboolean window_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, - const gchar *name, - const GValue *value); -static void window_menu_plugin_active_window_changed (XfwScreen *screen, - XfwWindow *previous_window, - WindowMenuPlugin *plugin); -static void window_menu_plugin_window_state_changed (XfwWindow *window, - XfwWindowState changed_mask, - XfwWindowState new_state, - WindowMenuPlugin *plugin); -static void window_menu_plugin_window_opened (XfwScreen *screen, - XfwWindow *window, - WindowMenuPlugin *plugin); -static void window_menu_plugin_window_closed (XfwScreen *screen, - XfwWindow *window, - WindowMenuPlugin *plugin); -static void window_menu_plugin_windows_disconnect (WindowMenuPlugin *plugin); -static void window_menu_plugin_windows_connect (WindowMenuPlugin *plugin, - gboolean traverse_windows); -static void window_menu_plugin_menu (GtkWidget *button, - WindowMenuPlugin *plugin); +static void +window_menu_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void +window_menu_plugin_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void +window_menu_plugin_style_updated (GtkWidget *widget); +static void +window_menu_plugin_screen_changed (GtkWidget *widget, + GdkScreen *previous_screen); +static void +window_menu_plugin_construct (XfcePanelPlugin *panel_plugin); +static void +window_menu_plugin_free_data (XfcePanelPlugin *panel_plugin); +static void +window_menu_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, + XfceScreenPosition screen_position); +static gboolean +window_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, + gint size); +static void +window_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); +static gboolean +window_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, + const gchar *name, + const GValue *value); +static void +window_menu_plugin_active_window_changed (XfwScreen *screen, + XfwWindow *previous_window, + WindowMenuPlugin *plugin); +static void +window_menu_plugin_window_state_changed (XfwWindow *window, + XfwWindowState changed_mask, + XfwWindowState new_state, + WindowMenuPlugin *plugin); +static void +window_menu_plugin_window_opened (XfwScreen *screen, + XfwWindow *window, + WindowMenuPlugin *plugin); +static void +window_menu_plugin_window_closed (XfwScreen *screen, + XfwWindow *window, + WindowMenuPlugin *plugin); +static void +window_menu_plugin_windows_disconnect (WindowMenuPlugin *plugin); +static void +window_menu_plugin_windows_connect (WindowMenuPlugin *plugin, + gboolean traverse_windows); +static void +window_menu_plugin_menu (GtkWidget *button, + WindowMenuPlugin *plugin); @@ -143,8 +160,8 @@ static void window_menu_plugin_class_init (WindowMenuPluginClass *klass) { XfcePanelPluginClass *plugin_class; - GObjectClass *gobject_class; - GtkWidgetClass *gtkwidget_class; + GObjectClass *gobject_class; + GtkWidgetClass *gtkwidget_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->get_property = window_menu_plugin_get_property; @@ -247,7 +264,7 @@ window_menu_plugin_init (WindowMenuPlugin *plugin) gtk_button_set_relief (GTK_BUTTON (plugin->button), GTK_RELIEF_NONE); gtk_widget_set_name (plugin->button, "windowmenu-button"); g_signal_connect (G_OBJECT (plugin->button), "toggled", - G_CALLBACK (window_menu_plugin_menu), plugin); + G_CALLBACK (window_menu_plugin_menu), plugin); plugin->icon = gtk_image_new_from_icon_name ("user-desktop", GTK_ICON_SIZE_BUTTON); gtk_container_add (GTK_CONTAINER (plugin->button), plugin->icon); @@ -257,9 +274,9 @@ window_menu_plugin_init (WindowMenuPlugin *plugin) static void -window_menu_plugin_get_property (GObject *object, - guint prop_id, - GValue *value, +window_menu_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { WindowMenuPlugin *plugin = WINDOW_MENU_PLUGIN (object); @@ -295,15 +312,15 @@ window_menu_plugin_get_property (GObject *object, static void -window_menu_plugin_set_property (GObject *object, - guint prop_id, +window_menu_plugin_set_property (GObject *object, + guint prop_id, const GValue *value, - GParamSpec *pspec) + GParamSpec *pspec) { WindowMenuPlugin *plugin = WINDOW_MENU_PLUGIN (object); - XfcePanelPlugin *panel_plugin = XFCE_PANEL_PLUGIN (object); - guint button_style; - gboolean urgentcy_notification; + XfcePanelPlugin *panel_plugin = XFCE_PANEL_PLUGIN (object); + guint button_style; + gboolean urgentcy_notification; panel_return_if_fail (WINDOW_MENU_IS_PLUGIN (plugin)); @@ -323,10 +340,9 @@ window_menu_plugin_set_property (GObject *object, /* update the plugin */ xfce_panel_plugin_set_small (panel_plugin, plugin->button_style == BUTTON_STYLE_ICON); - window_menu_plugin_size_changed (panel_plugin, - xfce_panel_plugin_get_size (panel_plugin)); - window_menu_plugin_screen_position_changed (panel_plugin, - xfce_panel_plugin_get_screen_position (panel_plugin)); + window_menu_plugin_size_changed (panel_plugin, xfce_panel_plugin_get_size (panel_plugin)); + window_menu_plugin_screen_position_changed ( + panel_plugin, xfce_panel_plugin_get_screen_position (panel_plugin)); if (plugin->screen != NULL) window_menu_plugin_active_window_changed (plugin->screen, NULL, plugin); } @@ -417,7 +433,7 @@ window_menu_plugin_screen_changed (GtkWidget *widget, /* disconnect from the previous screen */ g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->screen), - window_menu_plugin_active_window_changed, plugin); + window_menu_plugin_active_window_changed, plugin); g_object_unref (plugin->screen); } @@ -428,7 +444,7 @@ window_menu_plugin_screen_changed (GtkWidget *widget, /* connect signal to monitor this screen */ g_signal_connect (G_OBJECT (plugin->screen), "active-window-changed", - G_CALLBACK (window_menu_plugin_active_window_changed), plugin); + G_CALLBACK (window_menu_plugin_active_window_changed), plugin); if (plugin->urgentcy_notification) window_menu_plugin_windows_connect (plugin, TRUE); @@ -439,9 +455,8 @@ window_menu_plugin_screen_changed (GtkWidget *widget, static void window_menu_plugin_construct (XfcePanelPlugin *panel_plugin) { - WindowMenuPlugin *plugin = WINDOW_MENU_PLUGIN (panel_plugin); - const PanelProperty properties[] = - { + WindowMenuPlugin *plugin = WINDOW_MENU_PLUGIN (panel_plugin); + const PanelProperty properties[] = { { "style", G_TYPE_UINT }, { "workspace-actions", G_TYPE_BOOLEAN }, { "workspace-names", G_TYPE_BOOLEAN }, @@ -461,7 +476,7 @@ window_menu_plugin_construct (XfcePanelPlugin *panel_plugin) /* monitor screen changes */ g_signal_connect (G_OBJECT (plugin), "screen-changed", - G_CALLBACK (window_menu_plugin_screen_changed), NULL); + G_CALLBACK (window_menu_plugin_screen_changed), NULL); /* initialize the screen */ window_menu_plugin_screen_changed (GTK_WIDGET (plugin), NULL); @@ -478,7 +493,7 @@ window_menu_plugin_free_data (XfcePanelPlugin *panel_plugin) /* disconnect screen changed signal */ g_signal_handlers_disconnect_by_func (G_OBJECT (plugin), - window_menu_plugin_screen_changed, NULL); + window_menu_plugin_screen_changed, NULL); /* disconnect from the screen */ if (G_LIKELY (plugin->screen != NULL)) @@ -488,7 +503,7 @@ window_menu_plugin_free_data (XfcePanelPlugin *panel_plugin) /* disconnect from the screen */ g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->screen), - window_menu_plugin_active_window_changed, plugin); + window_menu_plugin_active_window_changed, plugin); g_clear_object (&plugin->screen); } @@ -497,11 +512,11 @@ window_menu_plugin_free_data (XfcePanelPlugin *panel_plugin) static void -window_menu_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, - XfceScreenPosition screen_position) +window_menu_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, + XfceScreenPosition screen_position) { WindowMenuPlugin *plugin = WINDOW_MENU_PLUGIN (panel_plugin); - GtkArrowType arrow_type = GTK_ARROW_NONE; + GtkArrowType arrow_type = GTK_ARROW_NONE; /* set the arrow direction if the arrow is visible */ if (plugin->button_style == BUTTON_STYLE_ARROW) @@ -515,10 +530,10 @@ window_menu_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin, static gboolean window_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, - gint size) + gint size) { WindowMenuPlugin *plugin = WINDOW_MENU_PLUGIN (panel_plugin); - gint button_size; + gint button_size; if (plugin->button_style == BUTTON_STYLE_ICON) { @@ -529,8 +544,7 @@ window_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin, else { /* set the size of the arrow button */ - if (xfce_panel_plugin_get_orientation (panel_plugin) == - GTK_ORIENTATION_HORIZONTAL) + if (xfce_panel_plugin_get_orientation (panel_plugin) == GTK_ORIENTATION_HORIZONTAL) { gtk_widget_get_preferred_width (plugin->button, NULL, &button_size); gtk_widget_set_size_request (GTK_WIDGET (plugin), button_size, -1); @@ -554,12 +568,12 @@ static void window_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) { WindowMenuPlugin *plugin = WINDOW_MENU_PLUGIN (panel_plugin); - GtkBuilder *builder; - GObject *dialog, *object; - guint i; - const gchar *names[] = { "workspace-actions", "workspace-names", - "urgentcy-notification", "all-workspaces", - "style" }; + GtkBuilder *builder; + GObject *dialog, *object; + guint i; + const gchar *names[] = { "workspace-actions", "workspace-names", + "urgentcy-notification", "all-workspaces", + "style" }; /* setup the dialog */ builder = panel_utils_builder_new (panel_plugin, windowmenu_dialog_ui, @@ -584,8 +598,8 @@ window_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) static gboolean window_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, - const gchar *name, - const GValue *value) + const gchar *name, + const GValue *value) { WindowMenuPlugin *plugin = WINDOW_MENU_PLUGIN (panel_plugin); GtkWidget *invisible; @@ -594,7 +608,7 @@ window_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, /* try next plugin or indicate that it failed */ if (strcmp (name, "popup") != 0 - || ! gtk_widget_get_visible (GTK_WIDGET (panel_plugin))) + || !gtk_widget_get_visible (GTK_WIDGET (panel_plugin))) return FALSE; invisible = gtk_invisible_new (); @@ -602,7 +616,7 @@ window_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, /* a menu is already shown, don't popup another one */ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button)) - || ! panel_utils_device_grab (invisible)) + || !panel_utils_device_grab (invisible)) { gtk_widget_destroy (invisible); return TRUE; @@ -636,15 +650,15 @@ window_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin, static void window_menu_plugin_set_icon (WindowMenuPlugin *plugin, - XfwWindow *window) + XfwWindow *window) { GdkPixbuf *pixbuf; - gint icon_size, scale_factor; + gint icon_size, scale_factor; panel_return_if_fail (WINDOW_MENU_IS_PLUGIN (plugin)); panel_return_if_fail (XFW_IS_WINDOW (window)); - if (! xfw_window_is_active (window)) + if (!xfw_window_is_active (window)) return; gtk_widget_set_tooltip_text (plugin->icon, xfw_window_get_name (window)); @@ -669,14 +683,14 @@ window_menu_plugin_set_icon (WindowMenuPlugin *plugin, static void -window_menu_plugin_active_window_changed (XfwScreen *screen, - XfwWindow *previous_window, +window_menu_plugin_active_window_changed (XfwScreen *screen, + XfwWindow *previous_window, WindowMenuPlugin *plugin) { - XfwWindow *window; - gint icon_size; - GtkWidget *icon = GTK_WIDGET (plugin->icon); - XfwWindowType type; + XfwWindow *window; + gint icon_size; + GtkWidget *icon = GTK_WIDGET (plugin->icon); + XfwWindowType type; panel_return_if_fail (WINDOW_MENU_IS_PLUGIN (plugin)); panel_return_if_fail (GTK_IMAGE (icon)); @@ -698,7 +712,7 @@ window_menu_plugin_active_window_changed (XfwScreen *screen, } else { - show_desktop_icon: +show_desktop_icon: /* desktop is shown right now */ icon_size = xfce_panel_plugin_get_icon_size (XFCE_PANEL_PLUGIN (plugin)); @@ -712,9 +726,9 @@ window_menu_plugin_active_window_changed (XfwScreen *screen, static void -window_menu_plugin_window_state_changed (XfwWindow *window, - XfwWindowState changed_mask, - XfwWindowState new_state, +window_menu_plugin_window_state_changed (XfwWindow *window, + XfwWindowState changed_mask, + XfwWindowState new_state, WindowMenuPlugin *plugin) { panel_return_if_fail (WINDOW_MENU_IS_PLUGIN (plugin)); @@ -741,8 +755,8 @@ window_menu_plugin_window_state_changed (XfwWindow *window, static void -window_menu_plugin_window_opened (XfwScreen *screen, - XfwWindow *window, +window_menu_plugin_window_opened (XfwScreen *screen, + XfwWindow *window, WindowMenuPlugin *plugin) { panel_return_if_fail (WINDOW_MENU_IS_PLUGIN (plugin)); @@ -753,9 +767,9 @@ window_menu_plugin_window_opened (XfwScreen *screen, /* monitor some window properties */ g_signal_connect (G_OBJECT (window), "state-changed", - G_CALLBACK (window_menu_plugin_window_state_changed), plugin); + G_CALLBACK (window_menu_plugin_window_state_changed), plugin); g_signal_connect_swapped (G_OBJECT (window), "icon-changed", - G_CALLBACK (window_menu_plugin_set_icon), plugin); + G_CALLBACK (window_menu_plugin_set_icon), plugin); /* check if the window needs attention */ if (xfw_window_is_urgent (window)) @@ -766,8 +780,8 @@ window_menu_plugin_window_opened (XfwScreen *screen, static void -window_menu_plugin_window_closed (XfwScreen *screen, - XfwWindow *window, +window_menu_plugin_window_closed (XfwScreen *screen, + XfwWindow *window, WindowMenuPlugin *plugin) { panel_return_if_fail (WINDOW_MENU_IS_PLUGIN (plugin)); @@ -793,20 +807,16 @@ window_menu_plugin_windows_disconnect (WindowMenuPlugin *plugin) panel_return_if_fail (XFW_IS_SCREEN (plugin->screen)); /* disconnect screen signals */ - g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->screen), - window_menu_plugin_window_closed, plugin); - g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->screen), - window_menu_plugin_window_opened, plugin); + g_signal_handlers_disconnect_by_func (plugin->screen, window_menu_plugin_window_closed, plugin); + g_signal_handlers_disconnect_by_func (plugin->screen, window_menu_plugin_window_opened, plugin); /* disconnect from all window signals */ windows = xfw_screen_get_windows (plugin->screen); for (li = windows; li != NULL; li = li->next) { panel_return_if_fail (XFW_IS_WINDOW (li->data)); - g_signal_handlers_disconnect_by_func (G_OBJECT (li->data), - window_menu_plugin_window_state_changed, plugin); - g_signal_handlers_disconnect_by_func (G_OBJECT (li->data), - window_menu_plugin_set_icon, plugin); + g_signal_handlers_disconnect_by_func (li->data, window_menu_plugin_window_state_changed, plugin); + g_signal_handlers_disconnect_by_func (li->data, window_menu_plugin_set_icon, plugin); } /* stop blinking */ @@ -818,7 +828,7 @@ window_menu_plugin_windows_disconnect (WindowMenuPlugin *plugin) static void window_menu_plugin_windows_connect (WindowMenuPlugin *plugin, - gboolean traverse_windows) + gboolean traverse_windows) { GList *windows, *li; @@ -827,9 +837,9 @@ window_menu_plugin_windows_connect (WindowMenuPlugin *plugin, panel_return_if_fail (plugin->urgentcy_notification); g_signal_connect (G_OBJECT (plugin->screen), "window-opened", - G_CALLBACK (window_menu_plugin_window_opened), plugin); + G_CALLBACK (window_menu_plugin_window_opened), plugin); g_signal_connect (G_OBJECT (plugin->screen), "window-closed", - G_CALLBACK (window_menu_plugin_window_closed), plugin); + G_CALLBACK (window_menu_plugin_window_closed), plugin); if (!traverse_windows) return; @@ -848,7 +858,7 @@ window_menu_plugin_windows_connect (WindowMenuPlugin *plugin, static void -window_menu_plugin_workspace_add (GtkWidget *mi, +window_menu_plugin_workspace_add (GtkWidget *mi, WindowMenuPlugin *plugin) { panel_return_if_fail (WINDOW_MENU_IS_PLUGIN (plugin)); @@ -861,7 +871,7 @@ window_menu_plugin_workspace_add (GtkWidget *mi, static void -window_menu_plugin_workspace_remove (GtkWidget *mi, +window_menu_plugin_workspace_remove (GtkWidget *mi, WindowMenuPlugin *plugin) { XfwWorkspace *workspace; @@ -893,9 +903,9 @@ window_menu_plugin_menu_workspace_item_new (XfwWorkspace *workspace, gboolean bold) { const gchar *name; - gchar *label_text = NULL; - gchar *utf8 = NULL, *name_num = NULL; - GtkWidget *mi, *label; + gchar *label_text = NULL; + gchar *utf8 = NULL, *name_num = NULL; + GtkWidget *mi, *label; panel_return_val_if_fail (XFW_IS_WORKSPACE (workspace), NULL); panel_return_val_if_fail (WINDOW_MENU_IS_PLUGIN (plugin), NULL); @@ -907,12 +917,11 @@ window_menu_plugin_menu_workspace_item_new (XfwWorkspace *workspace, name = utf8 = g_locale_to_utf8 (name, -1, NULL, NULL, NULL); if (xfce_str_is_empty (name)) - name = name_num = g_strdup_printf (_("Workspace %d"), - xfw_workspace_get_number (workspace) + 1); + name = name_num = g_strdup_printf (_("Workspace %d"), xfw_workspace_get_number (workspace) + 1); mi = gtk_menu_item_new_with_label (name); g_signal_connect (G_OBJECT (mi), "activate", - G_CALLBACK (window_menu_plugin_menu_workspace_item_active), workspace); + G_CALLBACK (window_menu_plugin_menu_workspace_item_active), workspace); /* make the label pretty on long workspace names */ label = gtk_bin_get_child (GTK_BIN (mi)); @@ -927,10 +936,10 @@ window_menu_plugin_menu_workspace_item_new (XfwWorkspace *workspace, else label_text = g_strdup_printf ("<i>%s</i>", name); if (label_text) - { - gtk_label_set_markup (GTK_LABEL (label), label_text); - g_free (label_text); - } + { + gtk_label_set_markup (GTK_LABEL (label), label_text); + g_free (label_text); + } g_free (utf8); g_free (name_num); @@ -941,7 +950,7 @@ window_menu_plugin_menu_workspace_item_new (XfwWorkspace *workspace, static void -window_menu_plugin_menu_actions_deactivate (GtkWidget *action_menu, +window_menu_plugin_menu_actions_deactivate (GtkWidget *action_menu, GtkMenuShell *menu) { panel_return_if_fail (GTK_IS_MENU_SHELL (menu)); @@ -956,8 +965,8 @@ window_menu_plugin_menu_actions_deactivate (GtkWidget *action_menu, static gboolean -window_menu_plugin_menu_window_item_activate (GtkWidget *mi, - GdkEventButton *event, +window_menu_plugin_menu_window_item_activate (GtkWidget *mi, + GdkEventButton *event, WindowMenuPlugin *plugin) { XfwWindow *window; @@ -990,8 +999,8 @@ window_menu_plugin_menu_window_item_activate (GtkWidget *mi, /* popup the window action menu */ menu = xfw_window_action_menu_new (window); g_signal_connect (G_OBJECT (menu), "deactivate", - G_CALLBACK (window_menu_plugin_menu_actions_deactivate), - gtk_widget_get_parent (mi)); + G_CALLBACK (window_menu_plugin_menu_actions_deactivate), + gtk_widget_get_parent (mi)); xfce_panel_plugin_popup_menu (XFCE_PANEL_PLUGIN (plugin), GTK_MENU (menu), NULL, (GdkEvent *) event); @@ -1004,19 +1013,19 @@ window_menu_plugin_menu_window_item_activate (GtkWidget *mi, static GtkWidget * -window_menu_plugin_menu_window_item_new (XfwWindow *window, - WindowMenuPlugin *plugin, +window_menu_plugin_menu_window_item_new (XfwWindow *window, + WindowMenuPlugin *plugin, PangoFontDescription *italic, PangoFontDescription *bold, - gint size) + gint size) { const gchar *name, *tooltip; - gchar *label_text = NULL; - gchar *utf8 = NULL; - gchar *decorated = NULL; - GtkWidget *mi, *label, *image; - GdkPixbuf *pixbuf, *lucent = NULL, *scaled = NULL; - gint scale_factor; + gchar *label_text = NULL; + gchar *utf8 = NULL; + gchar *decorated = NULL; + GtkWidget *mi, *label, *image; + GdkPixbuf *pixbuf, *lucent = NULL, *scaled = NULL; + gint scale_factor; panel_return_val_if_fail (XFW_IS_WINDOW (window), NULL); @@ -1042,7 +1051,7 @@ window_menu_plugin_menu_window_item_new (XfwWindow *window, gtk_widget_set_tooltip_text (mi, tooltip); g_object_set_qdata (G_OBJECT (mi), window_quark, window); g_signal_connect (G_OBJECT (mi), "button-release-event", - G_CALLBACK (window_menu_plugin_menu_window_item_activate), plugin); + G_CALLBACK (window_menu_plugin_menu_window_item_activate), plugin); /* make the label pretty on long window names */ @@ -1113,7 +1122,7 @@ window_menu_plugin_menu_window_item_new (XfwWindow *window, static void -window_menu_plugin_menu_deactivate (GtkWidget *menu, +window_menu_plugin_menu_deactivate (GtkWidget *menu, WindowMenuPlugin *plugin) { panel_return_if_fail (plugin->button == NULL || GTK_IS_TOGGLE_BUTTON (plugin->button)); @@ -1129,14 +1138,14 @@ window_menu_plugin_menu_deactivate (GtkWidget *menu, static gboolean -window_menu_plugin_menu_key_press_event (GtkWidget *menu, - GdkEventKey *event, +window_menu_plugin_menu_key_press_event (GtkWidget *menu, + GdkEventKey *event, WindowMenuPlugin *plugin) { - GtkWidget *mi = NULL; - GdkEventButton fake_event = { 0 }; - guint modifiers; - XfwWindow *window; + GtkWidget *mi = NULL; + GdkEventButton fake_event = { 0 }; + guint modifiers; + XfwWindow *window; panel_return_val_if_fail (GTK_IS_MENU (menu), FALSE); @@ -1199,19 +1208,19 @@ window_menu_plugin_menu_key_press_event (GtkWidget *menu, static GtkWidget * window_menu_plugin_menu_new (WindowMenuPlugin *plugin) { - GtkWidget *menu, *mi = NULL, *image; - GList *workspaces, *lp, fake; - GList *windows, *li; - XfwWorkspace *workspace = NULL; - XfwWorkspace *active_workspace, *window_workspace; - XfwWindow *window; + GtkWidget *menu, *mi = NULL, *image; + GList *workspaces, *lp, fake; + GList *windows, *li; + XfwWorkspace *workspace = NULL; + XfwWorkspace *active_workspace, *window_workspace; + XfwWindow *window; PangoFontDescription *italic, *bold; - gint urgent_windows = 0; - gboolean is_empty = TRUE; - guint n_workspaces = 0; - const gchar *name = NULL; - gchar *utf8 = NULL, *label; - gint size; + gint urgent_windows = 0; + gboolean is_empty = TRUE; + guint n_workspaces = 0; + const gchar *name = NULL; + gchar *utf8 = NULL, *label; + gint size; panel_return_val_if_fail (WINDOW_MENU_IS_PLUGIN (plugin), NULL); panel_return_val_if_fail (XFW_IS_SCREEN (plugin->screen), NULL); @@ -1224,7 +1233,7 @@ window_menu_plugin_menu_new (WindowMenuPlugin *plugin) menu = gtk_menu_new (); g_signal_connect (G_OBJECT (menu), "key-press-event", - G_CALLBACK (window_menu_plugin_menu_key_press_event), plugin); + G_CALLBACK (window_menu_plugin_menu_key_press_event), plugin); /* get all the windows and the active workspace */ windows = xfw_screen_get_windows_stacked (plugin->screen); @@ -1251,7 +1260,7 @@ window_menu_plugin_menu_new (WindowMenuPlugin *plugin) { /* create the workspace menu item */ mi = window_menu_plugin_menu_workspace_item_new (workspace, plugin, - workspace == active_workspace); + workspace == active_workspace); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); gtk_widget_show (mi); @@ -1368,7 +1377,7 @@ window_menu_plugin_menu_new (WindowMenuPlugin *plugin) gcapabilities = xfw_workspace_group_get_capabilities (plugin->workspace_group); gtk_widget_set_sensitive (mi, gcapabilities & XFW_WORKSPACE_GROUP_CAPABILITIES_CREATE_WORKSPACE); g_signal_connect (G_OBJECT (mi), "activate", - G_CALLBACK (window_menu_plugin_workspace_add), plugin); + G_CALLBACK (window_menu_plugin_workspace_add), plugin); gtk_widget_show (mi); image = gtk_image_new_from_icon_name ("list-add", GTK_ICON_SIZE_MENU); @@ -1394,7 +1403,7 @@ window_menu_plugin_menu_new (WindowMenuPlugin *plugin) wcapabilities = xfw_workspace_get_capabilities (g_list_last (workspaces)->data); gtk_widget_set_sensitive (mi, n_workspaces > 1 && wcapabilities & XFW_WORKSPACE_CAPABILITIES_REMOVE); g_signal_connect (G_OBJECT (mi), "activate", - G_CALLBACK (window_menu_plugin_workspace_remove), plugin); + G_CALLBACK (window_menu_plugin_workspace_remove), plugin); gtk_widget_show (mi); g_free (label); @@ -1414,11 +1423,11 @@ window_menu_plugin_menu_new (WindowMenuPlugin *plugin) static void -window_menu_plugin_menu (GtkWidget *button, +window_menu_plugin_menu (GtkWidget *button, WindowMenuPlugin *plugin) { GtkWidget *menu; - GdkEvent *event = NULL; + GdkEvent *event = NULL; panel_return_if_fail (WINDOW_MENU_IS_PLUGIN (plugin)); panel_return_if_fail (button == NULL || plugin->button == button); @@ -1441,7 +1450,7 @@ window_menu_plugin_menu (GtkWidget *button, /* popup the menu */ menu = window_menu_plugin_menu_new (plugin); g_signal_connect (G_OBJECT (menu), "deactivate", - G_CALLBACK (window_menu_plugin_menu_deactivate), plugin); + G_CALLBACK (window_menu_plugin_menu_deactivate), plugin); /* do not block panel autohide if popup-command at pointer */ if (button == NULL) diff --git a/plugins/windowmenu/windowmenu.h b/plugins/windowmenu/windowmenu.h index 061f22c0e..3844fdbc6 100644 --- a/plugins/windowmenu/windowmenu.h +++ b/plugins/windowmenu/windowmenu.h @@ -26,7 +26,8 @@ G_BEGIN_DECLS #define WINDOW_MENU_TYPE_PLUGIN (window_menu_plugin_get_type ()) G_DECLARE_FINAL_TYPE (WindowMenuPlugin, window_menu_plugin, WINDOW_MENU, PLUGIN, XfcePanelPlugin) -void window_menu_plugin_register_type (XfcePanelTypeModule *type_module); +void +window_menu_plugin_register_type (XfcePanelTypeModule *type_module); G_END_DECLS diff --git a/wrapper/main.c b/wrapper/main.c index 12282ebd8..0c63b9124 100644 --- a/wrapper/main.c +++ b/wrapper/main.c @@ -47,15 +47,15 @@ wrapper_gproxy_name_owner_changed (GDBusProxy *proxy, GParamSpec *pspec, gpointer data) { - gchar *name_owner; + gchar *name_owner; - name_owner = g_dbus_proxy_get_name_owner (proxy); + name_owner = g_dbus_proxy_get_name_owner (proxy); - /* we lost communication with the panel, silently close the wrapper */ - if (name_owner == NULL) - gtk_main_quit (); + /* we lost communication with the panel, silently close the wrapper */ + if (name_owner == NULL) + gtk_main_quit (); - g_free (name_owner); + g_free (name_owner); } @@ -67,11 +67,11 @@ wrapper_gproxy_set (GDBusProxy *proxy, GVariant *parameters, XfcePanelPluginProvider *provider) { - GtkWidget *plug; - GVariantIter iter; - GVariant *variant; + GtkWidget *plug; + GVariantIter iter; + GVariant *variant; XfcePanelPluginProviderPropType type; - GdkRectangle geom; + GdkRectangle geom; panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider)); panel_return_if_fail (g_variant_is_of_type (parameters, G_VARIANT_TYPE_TUPLE)); @@ -192,26 +192,25 @@ wrapper_gproxy_remote_event (GDBusProxy *proxy, GVariant *parameters, XfcePanelPluginProvider *provider) { - WrapperPlug *plug; - GVariant *variant; - guint handle; - const gchar *name; - gboolean result; - GValue real_value = { 0 }; + WrapperPlug *plug; + GVariant *variant; + guint handle; + const gchar *name; + gboolean result; + GValue real_value = { 0 }; panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider)); - if (G_LIKELY (g_variant_is_of_type (parameters, G_VARIANT_TYPE("(svu)")))) + if (G_LIKELY (g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(svu)")))) { g_variant_get (parameters, "(&svu)", &name, &variant, &handle); - if ( g_variant_is_of_type (variant, G_VARIANT_TYPE_BYTE) && - g_variant_get_byte (variant) == '\0') + if (g_variant_is_of_type (variant, G_VARIANT_TYPE_BYTE) && g_variant_get_byte (variant) == '\0') { result = xfce_panel_plugin_provider_remote_event (provider, name, NULL, NULL); } else { - g_dbus_gvariant_to_gvalue(variant, &real_value); + g_dbus_gvariant_to_gvalue (variant, &real_value); result = xfce_panel_plugin_provider_remote_event (provider, name, &real_value, NULL); g_value_unset (&real_value); } @@ -224,35 +223,35 @@ wrapper_gproxy_remote_event (GDBusProxy *proxy, else { g_warning ("property changed handler expects (svu) type, but %s received", - g_variant_get_type_string(parameters)); + g_variant_get_type_string (parameters)); } - } gint -main (gint argc, gchar **argv) +main (gint argc, + gchar **argv) { #if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_NAME) - gchar process_name[16]; + gchar process_name[16]; #endif - GModule *library = NULL; - XfcePanelPluginPreInit preinit_func; - GDBusConnection *dbus_gconnection; - GDBusProxy *dbus_gproxy = NULL; - WrapperModule *module = NULL; - GtkWidget *plug; - GtkWidget *provider = NULL; - gchar *path; - GError *error = NULL; - const gchar *filename; - gint unique_id; - Window socket_id; - const gchar *name; - const gchar *display_name; - const gchar *comment; - gchar **arguments; + GModule *library = NULL; + XfcePanelPluginPreInit preinit_func; + GDBusConnection *dbus_gconnection; + GDBusProxy *dbus_gproxy = NULL; + WrapperModule *module = NULL; + GtkWidget *plug; + GtkWidget *provider = NULL; + gchar *path; + GError *error = NULL; + const gchar *filename; + gint unique_id; + Window socket_id; + const gchar *name; + const gchar *display_name; + const gchar *comment; + gchar **arguments; /* set translation domain */ xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8"); @@ -293,7 +292,7 @@ main (gint argc, gchar **argv) /* check for a plugin preinit function */ if (g_module_symbol (library, "xfce_panel_module_preinit", (gpointer) &preinit_func) && preinit_func != NULL - && ! (*preinit_func) (argc, argv)) + && !(*preinit_func) (argc, argv)) { retval = PLUGIN_EXIT_PREINIT_FAILED; goto leave; @@ -321,7 +320,7 @@ main (gint argc, gchar **argv) /* quit when the proxy is destroyed (panel segfault for example) */ g_signal_connect (G_OBJECT (dbus_gproxy), "notify::g-name-owner", - G_CALLBACK (wrapper_gproxy_name_owner_changed), NULL); + G_CALLBACK (wrapper_gproxy_name_owner_changed), NULL); /* create the type module */ module = wrapper_module_new (library); @@ -349,7 +348,7 @@ main (gint argc, gchar **argv) /* monitor provider signals */ g_signal_connect_swapped (G_OBJECT (provider), "provider-signal", - G_CALLBACK (wrapper_plug_proxy_provider_signal), plug); + G_CALLBACK (wrapper_plug_proxy_provider_signal), plug); /* connect to service signals */ g_signal_connect_object (dbus_gproxy, "g-signal::Set", diff --git a/wrapper/wrapper-module.c b/wrapper/wrapper-module.c index fa524c37c..714e7d22b 100644 --- a/wrapper/wrapper-module.c +++ b/wrapper/wrapper-module.c @@ -26,10 +26,12 @@ -static void wrapper_module_dispose (GObject *object); -static gboolean wrapper_module_load (GTypeModule *type_module); -static void wrapper_module_unload (GTypeModule *type_module); - +static void +wrapper_module_dispose (GObject *object); +static gboolean +wrapper_module_load (GTypeModule *type_module); +static void +wrapper_module_unload (GTypeModule *type_module); @@ -118,17 +120,17 @@ wrapper_module_new (GModule *library) GtkWidget * -wrapper_module_new_provider (WrapperModule *module, - GdkScreen *screen, - const gchar *name, - gint unique_id, - const gchar *display_name, - const gchar *comment, - gchar **arguments) +wrapper_module_new_provider (WrapperModule *module, + GdkScreen *screen, + const gchar *name, + gint unique_id, + const gchar *display_name, + const gchar *comment, + gchar **arguments) { - GtkWidget *plugin = NULL; - PluginConstructFunc construct_func; - PluginInitFunc init_func; + GtkWidget *plugin = NULL; + PluginConstructFunc construct_func; + PluginInitFunc init_func; panel_return_val_if_fail (WRAPPER_IS_MODULE (module), NULL); panel_return_val_if_fail (module->library != NULL, NULL); @@ -136,8 +138,8 @@ wrapper_module_new_provider (WrapperModule *module, g_type_module_use (G_TYPE_MODULE (module)); /* try to link the contruct or init function */ - if (g_module_symbol (module->library, "xfce_panel_module_init", - (gpointer) &init_func) && init_func != NULL) + if (g_module_symbol (module->library, "xfce_panel_module_init", (gpointer) &init_func) + && init_func != NULL) { /* initialize the plugin */ module->plugin_type = (init_func) (G_TYPE_MODULE (module), NULL); @@ -150,8 +152,8 @@ wrapper_module_new_provider (WrapperModule *module, "comment", comment, "arguments", arguments, NULL); } - else if (g_module_symbol (module->library, "xfce_panel_module_construct", - (gpointer) &construct_func) && construct_func != NULL) + else if (g_module_symbol (module->library, "xfce_panel_module_construct", (gpointer) &construct_func) + && construct_func != NULL) { /* create a new panel plugin */ plugin = (*construct_func) (name, unique_id, diff --git a/wrapper/wrapper-module.h b/wrapper/wrapper-module.h index 06cf7d23b..57ef5429e 100644 --- a/wrapper/wrapper-module.h +++ b/wrapper/wrapper-module.h @@ -28,15 +28,17 @@ G_BEGIN_DECLS #define WRAPPER_TYPE_MODULE (wrapper_module_get_type ()) G_DECLARE_FINAL_TYPE (WrapperModule, wrapper_module, WRAPPER, MODULE, GTypeModule) -WrapperModule *wrapper_module_new (GModule *library) G_GNUC_MALLOC; - -GtkWidget *wrapper_module_new_provider (WrapperModule *module, - GdkScreen *screen, - const gchar *name, - gint unique_id, - const gchar *display_name, - const gchar *comment, - gchar **arguments) G_GNUC_MALLOC; +WrapperModule * +wrapper_module_new (GModule *library) G_GNUC_MALLOC; + +GtkWidget * +wrapper_module_new_provider (WrapperModule *module, + GdkScreen *screen, + const gchar *name, + gint unique_id, + const gchar *display_name, + const gchar *comment, + gchar **arguments) G_GNUC_MALLOC; G_END_DECLS diff --git a/wrapper/wrapper-plug-wayland.c b/wrapper/wrapper-plug-wayland.c index 1d1301522..5b9fdf6b4 100644 --- a/wrapper/wrapper-plug-wayland.c +++ b/wrapper/wrapper-plug-wayland.c @@ -33,29 +33,41 @@ -static void wrapper_plug_wayland_iface_init (WrapperPlugInterface *iface); -static void wrapper_plug_wayland_finalize (GObject *object); -static gboolean wrapper_plug_wayland_enter_notify_event (GtkWidget *widget, - GdkEventCrossing *event); -static gboolean wrapper_plug_wayland_leave_notify_event (GtkWidget *widget, - GdkEventCrossing *event); -static gboolean wrapper_plug_wayland_motion_notify_event (GtkWidget *widget, - GdkEventMotion *event); -static void wrapper_plug_wayland_realize (GtkWidget *widget); -static void wrapper_plug_wayland_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static void wrapper_plug_wayland_child_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static void wrapper_plug_wayland_proxy_provider_signal (WrapperPlug *plug, - XfcePanelPluginProviderSignal provider_signal, - XfcePanelPluginProvider *provider); -static void wrapper_plug_wayland_proxy_remote_event_result (WrapperPlug *plug, - guint handle, - gboolean result); -static void wrapper_plug_wayland_set_monitor (WrapperPlug *plug, - gint monitor); -static void wrapper_plug_wayland_set_geometry (WrapperPlug *plug, - const GdkRectangle *geometry); +static void +wrapper_plug_wayland_iface_init (WrapperPlugInterface *iface); +static void +wrapper_plug_wayland_finalize (GObject *object); +static gboolean +wrapper_plug_wayland_enter_notify_event (GtkWidget *widget, + GdkEventCrossing *event); +static gboolean +wrapper_plug_wayland_leave_notify_event (GtkWidget *widget, + GdkEventCrossing *event); +static gboolean +wrapper_plug_wayland_motion_notify_event (GtkWidget *widget, + GdkEventMotion *event); +static void +wrapper_plug_wayland_realize (GtkWidget *widget); +static void +wrapper_plug_wayland_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static void +wrapper_plug_wayland_child_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static void +wrapper_plug_wayland_proxy_provider_signal (WrapperPlug *plug, + XfcePanelPluginProviderSignal provider_signal, + XfcePanelPluginProvider *provider); +static void +wrapper_plug_wayland_proxy_remote_event_result (WrapperPlug *plug, + guint handle, + gboolean result); +static void +wrapper_plug_wayland_set_monitor (WrapperPlug *plug, + gint monitor); +static void +wrapper_plug_wayland_set_geometry (WrapperPlug *plug, + const GdkRectangle *geometry); @@ -113,7 +125,7 @@ wrapper_plug_wayland_window_state_changed (XfwWindow *window, panel_return_if_fail (XFW_IS_WINDOW (window)); panel_return_if_fail (WRAPPER_IS_PLUG_WAYLAND (plug)); - if (! (changed_mask & XFW_WINDOW_STATE_FULLSCREEN)) + if (!(changed_mask & XFW_WINDOW_STATE_FULLSCREEN)) return; if (xfw_window_is_fullscreen (window)) @@ -388,8 +400,9 @@ wrapper_plug_wayland_handle_pointer_is_outside (WrapperExternalExported *skeleto { /* see panel_window_pointer_is_outside() about the reliability of this check on Wayland */ window = gdk_device_get_window_at_position (device, NULL, NULL); - plug->pointer_is_outside = window == NULL || gdk_window_get_effective_toplevel (window) - != gtk_widget_get_window (GTK_WIDGET (plug)); + plug->pointer_is_outside = window == NULL + || gdk_window_get_effective_toplevel (window) + != gtk_widget_get_window (GTK_WIDGET (plug)); } wrapper_external_exported_complete_pointer_is_outside (skeleton, invocation, plug->pointer_is_outside); @@ -480,7 +493,7 @@ wrapper_plug_wayland_new (gint unique_id, g_task_set_task_data (task, name, NULL); g_task_run_in_thread_sync (task, wrapper_plug_wayland_own_name); g_object_unref (task); - if (! g_object_get_data (G_OBJECT (connection), "name-acquired")) + if (!g_object_get_data (G_OBJECT (connection), "name-acquired")) { g_set_error (error, 0, 0, "Failed to acquire name %s on D-Bus", name); g_free (name); diff --git a/wrapper/wrapper-plug-wayland.h b/wrapper/wrapper-plug-wayland.h index 7e660a0c9..e31965fd7 100644 --- a/wrapper/wrapper-plug-wayland.h +++ b/wrapper/wrapper-plug-wayland.h @@ -26,9 +26,10 @@ G_BEGIN_DECLS #define WRAPPER_TYPE_PLUG_WAYLAND (wrapper_plug_wayland_get_type ()) G_DECLARE_FINAL_TYPE (WrapperPlugWayland, wrapper_plug_wayland, WRAPPER, PLUG_WAYLAND, GtkWindow) -GtkWidget *wrapper_plug_wayland_new (gint unique_id, - GDBusProxy *proxy, - GError **error); +GtkWidget * +wrapper_plug_wayland_new (gint unique_id, + GDBusProxy *proxy, + GError **error); G_END_DECLS diff --git a/wrapper/wrapper-plug-x11.c b/wrapper/wrapper-plug-x11.c index fc16c87a2..f3e1db12e 100644 --- a/wrapper/wrapper-plug-x11.c +++ b/wrapper/wrapper-plug-x11.c @@ -27,22 +27,30 @@ -static void wrapper_plug_x11_finalize (GObject *object); -static void wrapper_plug_x11_iface_init (WrapperPlugInterface *iface); -static void wrapper_plug_x11_child_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static void wrapper_plug_x11_proxy_provider_signal (WrapperPlug *plug, - XfcePanelPluginProviderSignal provider_signal, - XfcePanelPluginProvider *provider); -static void wrapper_plug_x11_proxy_remote_event_result (WrapperPlug *plug, - guint handle, - gboolean result); -static void wrapper_plug_x11_set_background_color (WrapperPlug *plug, - const gchar *color); -static void wrapper_plug_x11_set_background_image (WrapperPlug *plug, - const gchar *image); -static void wrapper_plug_x11_set_geometry (WrapperPlug *plug, - const GdkRectangle *geometry); +static void +wrapper_plug_x11_finalize (GObject *object); +static void +wrapper_plug_x11_iface_init (WrapperPlugInterface *iface); +static void +wrapper_plug_x11_child_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); +static void +wrapper_plug_x11_proxy_provider_signal (WrapperPlug *plug, + XfcePanelPluginProviderSignal provider_signal, + XfcePanelPluginProvider *provider); +static void +wrapper_plug_x11_proxy_remote_event_result (WrapperPlug *plug, + guint handle, + gboolean result); +static void +wrapper_plug_x11_set_background_color (WrapperPlug *plug, + const gchar *color); +static void +wrapper_plug_x11_set_background_image (WrapperPlug *plug, + const gchar *image); +static void +wrapper_plug_x11_set_geometry (WrapperPlug *plug, + const GdkRectangle *geometry); diff --git a/wrapper/wrapper-plug-x11.h b/wrapper/wrapper-plug-x11.h index 44a98d257..fac4b98fa 100644 --- a/wrapper/wrapper-plug-x11.h +++ b/wrapper/wrapper-plug-x11.h @@ -26,8 +26,9 @@ G_BEGIN_DECLS #define WRAPPER_TYPE_PLUG_X11 (wrapper_plug_x11_get_type ()) G_DECLARE_FINAL_TYPE (WrapperPlugX11, wrapper_plug_x11, WRAPPER, PLUG_X11, GtkPlug) -GtkWidget *wrapper_plug_x11_new (Window socket_id, - GDBusProxy *proxy); +GtkWidget * +wrapper_plug_x11_new (Window socket_id, + GDBusProxy *proxy); G_END_DECLS diff --git a/wrapper/wrapper-plug.h b/wrapper/wrapper-plug.h index 42d44ce06..de4451f14 100644 --- a/wrapper/wrapper-plug.h +++ b/wrapper/wrapper-plug.h @@ -30,60 +30,69 @@ G_DECLARE_INTERFACE (WrapperPlug, wrapper_plug, WRAPPER, PLUG, GtkWindow) struct _WrapperPlugInterface { - GTypeInterface g_iface; - - void (*proxy_provider_signal) (WrapperPlug *plug, - XfcePanelPluginProviderSignal provider_signal, - XfcePanelPluginProvider *provider); - void (*proxy_remote_event_result) (WrapperPlug *plug, - guint handle, - gboolean result); - - /* X11 only */ - void (*set_background_color) (WrapperPlug *plug, - const gchar *color); - void (*set_background_image) (WrapperPlug *plug, - const gchar *image); - - /* Wayland only */ - void (*set_monitor) (WrapperPlug *plug, - gint monitor); - void (*set_geometry) (WrapperPlug *plug, - const GdkRectangle *geometry); + GTypeInterface g_iface; + + void (*proxy_provider_signal) (WrapperPlug *plug, + XfcePanelPluginProviderSignal provider_signal, + XfcePanelPluginProvider *provider); + void (*proxy_remote_event_result) (WrapperPlug *plug, + guint handle, + gboolean result); + + /* X11 only */ + void (*set_background_color) (WrapperPlug *plug, + const gchar *color); + void (*set_background_image) (WrapperPlug *plug, + const gchar *image); + + /* Wayland only */ + void (*set_monitor) (WrapperPlug *plug, + gint monitor); + void (*set_geometry) (WrapperPlug *plug, + const GdkRectangle *geometry); }; -GtkWidget *wrapper_plug_new (gulong socket_id, - gint unique_id, - GDBusProxy *proxy, - GError **error); - -void wrapper_plug_proxy_provider_signal (WrapperPlug *plug, - XfcePanelPluginProviderSignal provider_signal, - XfcePanelPluginProvider *provider); - -void wrapper_plug_proxy_remote_event_result (WrapperPlug *plug, - guint handle, - gboolean result); - -void wrapper_plug_set_background_color (WrapperPlug *plug, - const gchar *color); - -void wrapper_plug_set_background_image (WrapperPlug *plug, - const gchar *image); - -void wrapper_plug_set_monitor (WrapperPlug *plug, - gint monitor); - -void wrapper_plug_set_geometry (WrapperPlug *plug, - const GdkRectangle *geometry); - -void wrapper_plug_proxy_method_call_sync (GDBusProxy *proxy, - const gchar *method, - GVariant *variant); - -void wrapper_plug_proxy_method_call (GDBusProxy *proxy, - const gchar *method, - GVariant *variant); +GtkWidget * +wrapper_plug_new (gulong socket_id, + gint unique_id, + GDBusProxy *proxy, + GError **error); + +void +wrapper_plug_proxy_provider_signal (WrapperPlug *plug, + XfcePanelPluginProviderSignal provider_signal, + XfcePanelPluginProvider *provider); + +void +wrapper_plug_proxy_remote_event_result (WrapperPlug *plug, + guint handle, + gboolean result); + +void +wrapper_plug_set_background_color (WrapperPlug *plug, + const gchar *color); + +void +wrapper_plug_set_background_image (WrapperPlug *plug, + const gchar *image); + +void +wrapper_plug_set_monitor (WrapperPlug *plug, + gint monitor); + +void +wrapper_plug_set_geometry (WrapperPlug *plug, + const GdkRectangle *geometry); + +void +wrapper_plug_proxy_method_call_sync (GDBusProxy *proxy, + const gchar *method, + GVariant *variant); + +void +wrapper_plug_proxy_method_call (GDBusProxy *proxy, + const gchar *method, + GVariant *variant); G_END_DECLS -- GitLab