[Xfce4-commits] <xfce4-panel:andrzejr/deskbar-github> Add deskbar mode and nrows property to plugins.
Andrzej
noreply at xfce.org
Mon Dec 12 11:40:51 CET 2011
Updating branch refs/heads/andrzejr/deskbar-github
to b62a8f92dba4f9636ce9f87208c754bead6fc913 (commit)
from 8be7247f461778711e906bb5e35ce4cda0128d7d (commit)
commit b62a8f92dba4f9636ce9f87208c754bead6fc913
Author: Nick Schermer <nick at xfce.org>
Date: Sat Dec 10 15:24:33 2011 +0100
Add deskbar mode and nrows property to plugins.
Instead of the horizontal property, there is now a mode property
with 3 values. The orientation communication has been completely
removed, only the properties exist.
Properly migrate the orientation property.
Plugins and the panel should not act any different with this commit.
configure.ac.in | 2 +-
libxfce4panel/libxfce4panel-enums.h | 18 +++-
libxfce4panel/libxfce4panel.symbols | 5 +-
libxfce4panel/xfce-panel-macros-46.h | 8 +-
libxfce4panel/xfce-panel-plugin-provider.c | 17 ++-
libxfce4panel/xfce-panel-plugin-provider.h | 18 ++-
libxfce4panel/xfce-panel-plugin.c | 191 +++++++++++++++++++++++++---
libxfce4panel/xfce-panel-plugin.h | 12 ++-
migrate/migrate-config.c | 23 +++-
panel/panel-application.c | 18 ++--
panel/panel-itembar.c | 81 ++++++------
panel/panel-plugin-external-46.c | 3 +-
panel/panel-plugin-external.c | 37 ++++-
panel/panel-preferences-dialog.c | 4 +-
panel/panel-preferences-dialog.glade | 61 +++++++--
panel/panel-window.c | 165 ++++++++++++++----------
wrapper/main.c | 8 +-
17 files changed, 494 insertions(+), 177 deletions(-)
diff --git a/configure.ac.in b/configure.ac.in
index 8aa7e8c..9a10bcf 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -10,7 +10,7 @@ dnl *** Version information ***
dnl ***************************
m4_define([libxfce4panel_verinfo], [3:0:0]) dnl current:revision:age
m4_define([libxfce4panel_version_api], [1.0])
-m4_define([xfce4_panel_config_version], [1])
+m4_define([xfce4_panel_config_version], [2])
m4_define([xfce4_panel_version_major], [4])
m4_define([xfce4_panel_version_minor], [9])
m4_define([xfce4_panel_version_micro], [0])
diff --git a/libxfce4panel/libxfce4panel-enums.h b/libxfce4panel/libxfce4panel-enums.h
index 236d02b..f420878 100644
--- a/libxfce4panel/libxfce4panel-enums.h
+++ b/libxfce4panel/libxfce4panel-enums.h
@@ -37,7 +37,23 @@ G_BEGIN_DECLS
* Currently only contains the definition of #XfceScreenPosition.
**/
-
+/**
+ * XfcePanelPluginMode
+ * @XFCE_PANEL_PLUGIN_MODE_HORIZONTAL : Horizontal panel and plugins
+ * @XFCE_PANEL_PLUGIN_MODE_VERTICAL : Vertical rotated panel and plugins
+ * @XFCE_PANEL_PLUGIN_MODE_DESKBAR : Vertical panel with horizontal plugins
+ *
+ * Orientation of the plugin in the panel.
+ *
+ * Since: 4.10
+ **/
+typedef enum /*<enum,prefix=XFCE_PANEL_PLUGIN_MODE >*/
+{
+ XFCE_PANEL_PLUGIN_MODE_HORIZONTAL,
+ XFCE_PANEL_PLUGIN_MODE_VERTICAL,
+ XFCE_PANEL_PLUGIN_MODE_DESKBAR
+}
+XfcePanelPluginMode;
/**
* XfceScreenPosition
diff --git a/libxfce4panel/libxfce4panel.symbols b/libxfce4panel/libxfce4panel.symbols
index 494572c..3730482 100644
--- a/libxfce4panel/libxfce4panel.symbols
+++ b/libxfce4panel/libxfce4panel.symbols
@@ -112,6 +112,8 @@ xfce_panel_plugin_get_shrink G_GNUC_PURE
xfce_panel_plugin_set_shrink
xfce_panel_plugin_get_locked
xfce_panel_plugin_get_orientation G_GNUC_PURE
+xfce_panel_plugin_get_mode G_GNUC_PURE
+xfce_panel_plugin_get_nrows G_GNUC_PURE
xfce_panel_plugin_get_screen_position G_GNUC_PURE
xfce_panel_plugin_take_window
xfce_panel_plugin_add_action_widget
@@ -140,7 +142,8 @@ xfce_panel_plugin_provider_get_type G_GNUC_CONST
xfce_panel_plugin_provider_get_name
xfce_panel_plugin_provider_get_unique_id
xfce_panel_plugin_provider_set_size
-xfce_panel_plugin_provider_set_orientation
+xfce_panel_plugin_provider_set_mode
+xfce_panel_plugin_provider_set_nrows
xfce_panel_plugin_provider_set_screen_position
xfce_panel_plugin_provider_save
xfce_panel_plugin_provider_emit_signal
diff --git a/libxfce4panel/xfce-panel-macros-46.h b/libxfce4panel/xfce-panel-macros-46.h
index 92bf918..7d631e5 100644
--- a/libxfce4panel/xfce-panel-macros-46.h
+++ b/libxfce4panel/xfce-panel-macros-46.h
@@ -320,8 +320,12 @@ G_BEGIN_DECLS
xfce_panel_plugin_provider_set_locked (provider, !!value); \
break; \
\
- case PROVIDER_PROP_TYPE_SET_ORIENTATION: \
- xfce_panel_plugin_provider_set_orientation (provider, value); \
+ case PROVIDER_PROP_TYPE_SET_MODE: \
+ xfce_panel_plugin_provider_set_mode (provider, value); \
+ break; \
+ \
+ case PROVIDER_PROP_TYPE_SET_NROWS: \
+ xfce_panel_plugin_provider_set_nrows (provider, value); \
break; \
\
case PROVIDER_PROP_TYPE_SET_NROWS: \
diff --git a/libxfce4panel/xfce-panel-plugin-provider.c b/libxfce4panel/xfce-panel-plugin-provider.c
index 124d40e..b29c0bf 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.c
+++ b/libxfce4panel/xfce-panel-plugin-provider.c
@@ -115,12 +115,23 @@ xfce_panel_plugin_provider_set_size (XfcePanelPluginProvider *provider,
void
-xfce_panel_plugin_provider_set_orientation (XfcePanelPluginProvider *provider,
- GtkOrientation orientation)
+xfce_panel_plugin_provider_set_mode (XfcePanelPluginProvider *provider,
+ XfcePanelPluginMode mode)
{
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
- (*XFCE_PANEL_PLUGIN_PROVIDER_GET_INTERFACE (provider)->set_orientation) (provider, orientation);
+ (*XFCE_PANEL_PLUGIN_PROVIDER_GET_INTERFACE (provider)->set_mode) (provider, mode);
+}
+
+
+
+void
+xfce_panel_plugin_provider_set_nrows (XfcePanelPluginProvider *provider,
+ guint rows)
+{
+ panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
+
+ (*XFCE_PANEL_PLUGIN_PROVIDER_GET_INTERFACE (provider)->set_nrows) (provider, rows);
}
diff --git a/libxfce4panel/xfce-panel-plugin-provider.h b/libxfce4panel/xfce-panel-plugin-provider.h
index cec8ba2..3587201 100644
--- a/libxfce4panel/xfce-panel-plugin-provider.h
+++ b/libxfce4panel/xfce-panel-plugin-provider.h
@@ -52,8 +52,10 @@ struct _XfcePanelPluginProviderInterface
gint (*get_unique_id) (XfcePanelPluginProvider *provider);
void (*set_size) (XfcePanelPluginProvider *provider,
gint size);
- void (*set_orientation) (XfcePanelPluginProvider *provider,
- GtkOrientation orientation);
+ 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);
@@ -105,11 +107,10 @@ XfcePanelPluginProviderSignal;
typedef enum /*< skip >*/
{
PROVIDER_PROP_TYPE_SET_SIZE, /* gint */
- PROVIDER_PROP_TYPE_SET_ORIENTATION, /* GtkOrientation (as gint) */
- PROVIDER_PROP_TYPE_SET_NROWS, /* guint */
- PROVIDER_PROP_TYPE_SET_DESKBAR_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_SET_BACKGROUND_COLOR, /* string, wrapper only */
@@ -162,8 +163,11 @@ gint xfce_panel_plugin_provider_get_unique_id (XfcePanelP
void xfce_panel_plugin_provider_set_size (XfcePanelPluginProvider *provider,
gint size);
-void xfce_panel_plugin_provider_set_orientation (XfcePanelPluginProvider *provider,
- GtkOrientation orientation);
+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 nrows);
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 97c5a01..55a5ecb 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -90,12 +90,10 @@ static void xfce_panel_plugin_unregister_menu (GtkMenu
XfcePanelPlugin *plugin);
static void xfce_panel_plugin_set_size (XfcePanelPluginProvider *provider,
gint size);
-static void xfce_panel_plugin_set_orientation (XfcePanelPluginProvider *provider,
- GtkOrientation orientation);
+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_deskbar_mode (XfcePanelPluginProvider *provider,
- gboolean deskbar_mode);
static void xfce_panel_plugin_set_screen_position (XfcePanelPluginProvider *provider,
XfceScreenPosition screen_position);
static void xfce_panel_plugin_save (XfcePanelPluginProvider *provider);
@@ -133,6 +131,8 @@ enum
PROP_SMALL,
PROP_SCREEN_POSITION,
PROP_EXPAND,
+ PROP_MODE,
+ PROP_NROWS,
PROP_SHRINK
};
@@ -149,6 +149,8 @@ enum
SAVE,
SIZE_CHANGED,
SCREEN_POSITION_CHANGED,
+ MODE_CHANGED,
+ NROWS_CHANGED,
LAST_SIGNAL
};
@@ -175,10 +177,8 @@ struct _XfcePanelPluginPrivate
gint size;
guint expand : 1;
guint shrink : 1;
- GtkOrientation orientation;
guint nrows;
- gboolean deskbar_mode : 1;
- gboolean small : 1;
+ XfcePanelPluginMode mode;
XfceScreenPosition screen_position;
guint locked : 1;
GSList *menu_items;
@@ -310,6 +310,44 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
G_TYPE_NONE, 1, GTK_TYPE_ORIENTATION);
/**
+ * XfcePanelPlugin::mode-changed
+ * @plugin : an #XfcePanelPlugin.
+ * @mode : new #XfcePanelPluginMode of the panel.
+ *
+ * This signal is emmitted whenever the mode of the panel
+ * the @plugin is on changes.
+ *
+ * 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);
+
+ /**
+ * XfcePanelPlugin::nrows-changed
+ * @plugin : an #XfcePanelPlugin.
+ * @rows : new number of rows of the panel
+ *
+ * This signal is emmitted whenever the nrows of the panel
+ * the @plugin is on changes.
+ *
+ * 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);
+
+ /**
* XfcePanelPlugin::remote-event
* @plugin : an #XfcePanelPlugin.
* @name : name of the signal.
@@ -684,6 +722,39 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS));
+ /**
+ * XfcePanelPlugin:mode:
+ *
+ * Display mode of the plugin.
+ *
+ * Since: 4.10
+ **/
+ g_object_class_install_property (gobject_class,
+ 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:
+ *
+ * Number of rows the plugin is embedded on.
+ *
+ * Since: 4.10
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_NROWS,
+ g_param_spec_uint ("nrows",
+ "Nrows",
+ "Number of rows of the panel",
+ 1, 6, 1,
+ G_PARAM_READABLE
+ | G_PARAM_STATIC_STRINGS));
+
item_properties = g_quark_from_static_string ("item-properties");
item_about = g_quark_from_static_string ("item-about");
}
@@ -707,7 +778,7 @@ xfce_panel_plugin_init (XfcePanelPlugin *plugin)
plugin->priv->small = FALSE;
plugin->priv->expand = FALSE;
plugin->priv->shrink = FALSE;
- plugin->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
+ plugin->priv->mode = XFCE_PANEL_PLUGIN_MODE_HORIZONTAL;
plugin->priv->screen_position = XFCE_SCREEN_POSITION_NONE;
plugin->priv->menu = NULL;
plugin->priv->menu_blocked = 0;
@@ -715,6 +786,7 @@ xfce_panel_plugin_init (XfcePanelPlugin *plugin)
plugin->priv->flags = 0;
plugin->priv->locked = TRUE;
plugin->priv->menu_items = NULL;
+ plugin->priv->nrows = 1;
/* bind the text domain of the panel so our strings
* are properly translated in the old 4.6 panel plugins */
@@ -735,9 +807,8 @@ xfce_panel_plugin_provider_init (XfcePanelPluginProviderInterface *iface)
iface->get_name = (ProviderToPluginChar) xfce_panel_plugin_get_name;
iface->get_unique_id = (ProviderToPluginInt) xfce_panel_plugin_get_unique_id;
iface->set_size = xfce_panel_plugin_set_size;
- iface->set_orientation = xfce_panel_plugin_set_orientation;
+ iface->set_mode = xfce_panel_plugin_set_mode;
iface->set_nrows = xfce_panel_plugin_set_nrows;
- iface->set_deskbar_mode = xfce_panel_plugin_set_deskbar_mode;
iface->set_screen_position = xfce_panel_plugin_set_screen_position;
iface->save = xfce_panel_plugin_save;
iface->get_show_configure = xfce_panel_plugin_get_show_configure;
@@ -800,7 +871,7 @@ xfce_panel_plugin_get_property (GObject *object,
break;
case PROP_ORIENTATION:
- g_value_set_enum (value, private->orientation);
+ g_value_set_enum (value, xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (object)));
break;
case PROP_SIZE:
@@ -1383,22 +1454,58 @@ xfce_panel_plugin_set_size (XfcePanelPluginProvider *provider,
static void
-xfce_panel_plugin_set_orientation (XfcePanelPluginProvider *provider,
- GtkOrientation orientation)
+xfce_panel_plugin_set_mode (XfcePanelPluginProvider *provider,
+ XfcePanelPluginMode mode)
+{
+ XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (provider);
+ GtkOrientation old_orientation;
+ GtkOrientation new_orientation;
+
+ panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (provider));
+
+ /* check if update is required */
+ if (G_LIKELY (plugin->priv->mode != mode))
+ {
+ old_orientation = xfce_panel_plugin_get_orientation (plugin);
+
+ plugin->priv->mode = mode;
+
+ g_signal_emit (G_OBJECT (plugin),
+ plugin_signals[MODE_CHANGED], 0, mode);
+
+ g_object_notify (G_OBJECT (plugin), "mode");
+
+ /* emit old orientation property for compatibility */
+ new_orientation = xfce_panel_plugin_get_orientation (plugin);
+ if (old_orientation != new_orientation)
+ {
+ g_signal_emit (G_OBJECT (plugin),
+ plugin_signals[ORIENTATION_CHANGED], 0, new_orientation);
+
+ g_object_notify (G_OBJECT (plugin), "orientation");
+ }
+ }
+}
+
+
+
+static void
+xfce_panel_plugin_set_nrows (XfcePanelPluginProvider *provider,
+ guint nrows)
{
XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (provider);
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (provider));
/* check if update is required */
- if (G_LIKELY (plugin->priv->orientation != orientation))
+ if (G_LIKELY (plugin->priv->nrows != nrows))
{
- plugin->priv->orientation = orientation;
+ plugin->priv->nrows = nrows;
g_signal_emit (G_OBJECT (plugin),
- plugin_signals[ORIENTATION_CHANGED], 0, orientation);
+ plugin_signals[NROWS_CHANGED], 0, nrows);
- g_object_notify (G_OBJECT (plugin), "orientation");
+ g_object_notify (G_OBJECT (plugin), "nrows");
}
}
@@ -1988,7 +2095,7 @@ xfce_panel_plugin_set_shrink (XfcePanelPlugin *plugin,
/**
- * xfce_panel_plugin_get_orientation:
+ * xfce_panel_plugin_get_mode:
* @plugin : an #XfcePanelPlugin.
*
* The orientation of the panel in which the plugin is embedded.
@@ -1999,9 +2106,53 @@ GtkOrientation
xfce_panel_plugin_get_orientation (XfcePanelPlugin *plugin)
{
g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), GTK_ORIENTATION_HORIZONTAL);
- g_return_val_if_fail (XFCE_PANEL_PLUGIN_CONSTRUCTED (plugin), GTK_ORIENTATION_HORIZONTAL);
- return plugin->priv->orientation;
+ if (plugin->priv->mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL)
+ return GTK_ORIENTATION_HORIZONTAL;
+ else
+ return GTK_ORIENTATION_VERTICAL;
+}
+
+
+
+/**
+ * xfce_panel_plugin_get_orientation:
+ * @plugin : an #XfcePanelPlugin.
+ *
+ * The mode of the panel in which the plugin is embedded.
+ *
+ * Returns: the current #XfcePanelPluginMode of the panel.
+ *
+ * Since: 4.10
+ **/
+XfcePanelPluginMode
+xfce_panel_plugin_get_mode (XfcePanelPlugin *plugin)
+{
+ g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), XFCE_PANEL_PLUGIN_MODE_HORIZONTAL);
+ g_return_val_if_fail (XFCE_PANEL_PLUGIN_CONSTRUCTED (plugin), XFCE_PANEL_PLUGIN_MODE_HORIZONTAL);
+
+ return plugin->priv->mode;
+}
+
+
+
+/**
+ * xfce_panel_plugin_get_nrows:
+ * @plugin : an #XfcePanelPlugin.
+ *
+ * The number of rows of the panel in which the plugin is embedded.
+ *
+ * Returns: the current number of rows of the panel.
+ *
+ * Since: 4.10
+ **/
+guint
+xfce_panel_plugin_get_nrows (XfcePanelPlugin *plugin)
+{
+ g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), 1);
+ g_return_val_if_fail (XFCE_PANEL_PLUGIN_CONSTRUCTED (plugin), 1);
+
+ return plugin->priv->nrows;
}
diff --git a/libxfce4panel/xfce-panel-plugin.h b/libxfce4panel/xfce-panel-plugin.h
index d598041..84b11be 100644
--- a/libxfce4panel/xfce-panel-plugin.h
+++ b/libxfce4panel/xfce-panel-plugin.h
@@ -133,11 +133,15 @@ struct _XfcePanelPluginClass
const gchar *name,
const GValue *value);
+ /* new in 4.10 */
+ void (*mode_changed) (XfcePanelPlugin *plugin,
+ XfcePanelPluginMode mode);
+ void (*nrows_changed) (XfcePanelPlugin *plugin,
+ guint rows);
+
/*< private >*/
void (*reserved1) (void);
void (*reserved2) (void);
- void (*reserved3) (void);
- void (*reserved4) (void);
};
@@ -195,6 +199,10 @@ void xfce_panel_plugin_set_shrink (XfcePanelPlugin *
GtkOrientation xfce_panel_plugin_get_orientation (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;
+
XfceScreenPosition xfce_panel_plugin_get_screen_position (XfcePanelPlugin *plugin) G_GNUC_PURE;
void xfce_panel_plugin_take_window (XfcePanelPlugin *plugin,
diff --git a/migrate/migrate-config.c b/migrate/migrate-config.c
index 2bce672..367e7e4 100644
--- a/migrate/migrate-config.c
+++ b/migrate/migrate-config.c
@@ -117,7 +117,6 @@ migrate_config_action_48 (gpointer key,
gint first_action;
gint second_action;
-
/* skip non root plugin properties */
if (!G_VALUE_HOLDS_STRING (gvalue)
|| migrate_config_strchr_count (prop, G_DIR_SEPARATOR) != 2
@@ -167,6 +166,9 @@ migrate_config (XfconfChannel *channel,
GError **error)
{
GHashTable *plugins;
+ guint n, n_panels;
+ gchar buf[50];
+ gboolean horizontal;
plugins = xfconf_channel_get_properties (channel, "/plugins");
@@ -180,5 +182,24 @@ migrate_config (XfconfChannel *channel,
g_hash_table_foreach (plugins, migrate_config_action_48, channel);
}
+ /* migrate horizontal to mode property */
+ if (configver < 2)
+ {
+ n_panels = xfconf_channel_get_uint (channel, "/panels", 0);
+ for (n = 0; n < n_panels; n++)
+ {
+ /* read and remove old property */
+ g_snprintf (buf, sizeof (buf), "/panels/panel-%u/horizontal", n);
+ horizontal = xfconf_channel_get_bool (channel, buf, TRUE);
+ xfconf_channel_reset_property (channel, buf, FALSE);
+
+ /* set new mode */
+ g_snprintf (buf, sizeof (buf), "/panels/panel-%u/mode", n);
+ xfconf_channel_set_uint (channel, buf, horizontal ? 0 : 1);
+ }
+ }
+
+ g_hash_table_destroy (plugins);
+
return TRUE;
}
diff --git a/panel/panel-application.c b/panel/panel-application.c
index 211f98a..f1aeee3 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -284,7 +284,7 @@ panel_application_xfconf_window_bindings (PanelApplication *application,
{ "position-locked", G_TYPE_BOOLEAN },
{ "autohide", G_TYPE_BOOLEAN },
{ "span-monitors", G_TYPE_BOOLEAN },
- { "horizontal", G_TYPE_BOOLEAN },
+ { "mode", G_TYPE_UINT },
{ "icon-size", G_TYPE_UINT },
{ "nrows", G_TYPE_UINT },
{ "length", G_TYPE_UINT },
@@ -1426,10 +1426,12 @@ panel_application_new_window (PanelApplication *application,
GdkScreen *screen,
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" };
+ guint i;
panel_return_val_if_fail (PANEL_IS_APPLICATION (application), NULL);
panel_return_val_if_fail (screen == NULL || GDK_IS_SCREEN (screen), NULL);
@@ -1460,10 +1462,8 @@ panel_application_new_window (PanelApplication *application,
/* add the itembar */
itembar = panel_itembar_new ();
- exo_binding_new (G_OBJECT (window), "horizontal", G_OBJECT (itembar), "horizontal");
- exo_binding_new (G_OBJECT (window), "size", G_OBJECT (itembar), "size");
- exo_binding_new (G_OBJECT (window), "nrows", G_OBJECT (itembar), "nrows");
- exo_binding_new (G_OBJECT (window), "deskbar-mode", G_OBJECT (itembar), "deskbar-mode");
+ for (i = 0; i < G_N_ELEMENTS (props); i++)
+ exo_binding_new (G_OBJECT (window), props[i], G_OBJECT (itembar), props[i]);
gtk_container_add (GTK_CONTAINER (window), itembar);
gtk_widget_show (itembar);
diff --git a/panel/panel-itembar.c b/panel/panel-itembar.c
index 2ed0f8a..ed50c75 100644
--- a/panel/panel-itembar.c
+++ b/panel/panel-itembar.c
@@ -28,6 +28,8 @@
#include <panel/panel-itembar.h>
+#define HORIZONTAL(itembar) ((itembar)->mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL)
+
typedef struct _PanelItembarChild PanelItembarChild;
@@ -85,17 +87,16 @@ struct _PanelItembar
GSList *children;
/* some properties we clone from the panel window */
- guint horizontal : 1;
- guint size;
- guint nrows;
- guint deskbar_mode : 1;
+ XfcePanelPluginMode mode;
+ guint size;
+ guint nrows;
/* dnd support */
- gint highlight_index;
- gint highlight_x, highlight_y;
- gboolean highlight_small;
+ gint highlight_index;
+ gint highlight_x, highlight_y;
+ gboolean highlight_small;
- gint spacing; /* spacing between (not small) plugins to fit dnd marks */
+ gint spacing; /* spacing between (not small) plugins to fit dnd marks */
};
struct _PanelItembarChild
@@ -110,10 +111,9 @@ struct _PanelItembarChild
enum
{
PROP_0,
- PROP_HORIZONTAL,
- PROP_NROWS,
- PROP_DESKBAR_MODE,
- PROP_SIZE
+ PROP_MODE,
+ PROP_SIZE,
+ PROP_NROWS
};
enum
@@ -175,17 +175,25 @@ panel_itembar_class_init (PanelItembarClass *klass)
G_TYPE_NONE, 0);
g_object_class_install_property (gobject_class,
- PROP_HORIZONTAL,
- g_param_spec_boolean ("horizontal",
- NULL, NULL,
- TRUE,
- EXO_PARAM_WRITABLE));
+ PROP_MODE,
+ g_param_spec_enum ("mode",
+ NULL, NULL,
+ XFCE_TYPE_PANEL_PLUGIN_MODE,
+ XFCE_PANEL_PLUGIN_MODE_HORIZONTAL,
+ EXO_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_SIZE,
g_param_spec_uint ("size",
NULL, NULL,
- 16, 128*8, 48,
+ 16, 128*8, 30,
+ EXO_PARAM_WRITABLE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_NROWS,
+ g_param_spec_uint ("nrows",
+ NULL, NULL,
+ 1, 6, 1,
EXO_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
@@ -237,10 +245,9 @@ static void
panel_itembar_init (PanelItembar *itembar)
{
itembar->children = NULL;
- itembar->horizontal = TRUE;
+ itembar->mode = XFCE_PANEL_PLUGIN_MODE_HORIZONTAL;
itembar->size = 30;
itembar->nrows = 1;
- itembar->deskbar_mode = FALSE;
itembar->highlight_index = -1;
itembar->spacing = 2;
@@ -261,8 +268,8 @@ panel_itembar_set_property (GObject *object,
switch (prop_id)
{
- case PROP_HORIZONTAL:
- itembar->horizontal = g_value_get_boolean (value);
+ case PROP_MODE:
+ itembar->mode = g_value_get_enum (value);
break;
case PROP_SIZE:
@@ -273,10 +280,6 @@ panel_itembar_set_property (GObject *object,
itembar->nrows = g_value_get_uint (value);
break;
- case PROP_DESKBAR_MODE:
- itembar->deskbar_mode = g_value_get_boolean (value);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -360,7 +363,7 @@ panel_itembar_size_request (GtkWidget *widget,
gint column_row = 0;
/* intialize the requisition, we always set the panel height */
- if (itembar->horizontal)
+ if (HORIZONTAL (itembar))
{
requisition->height = itembar->size;
requisition->width = 0;
@@ -403,7 +406,7 @@ panel_itembar_size_request (GtkWidget *widget,
else if (G_LIKELY (!child->wrap))
{
column_row = 0;
- if (itembar->horizontal)
+ if (HORIZONTAL (itembar))
row_length += child_requisition.width;
else
row_length += child_requisition.height;
@@ -413,7 +416,7 @@ panel_itembar_size_request (GtkWidget *widget,
{
column_row = 0;
/* add to size for new wrap element */
- if (itembar->horizontal)
+ if (HORIZONTAL (itembar))
{
requisition->height += itembar->size;
requisition->width = MAX (requisition->width, row_length);
@@ -436,7 +439,7 @@ panel_itembar_size_request (GtkWidget *widget,
}
/* also take the last row_length into account */
- if (itembar->horizontal)
+ if (HORIZONTAL (itembar))
requisition->width = MAX (requisition->width, row_length);
else
requisition->height = MAX (requisition->height, row_length);
@@ -473,7 +476,7 @@ panel_itembar_size_allocate (GtkWidget *widget,
border_width = GTK_CONTAINER (widget)->border_width;
- if (itembar->horizontal)
+ if (HORIZONTAL (itembar))
widget_length = allocation->width - 2 * border_width;
else
widget_length = allocation->height - 2 * border_width;
@@ -501,7 +504,7 @@ panel_itembar_size_allocate (GtkWidget *widget,
break;
gtk_widget_get_child_requisition (child->widget, &child_req);
- length = itembar->horizontal ? child_req.width : child_req.height;
+ length = HORIZONTAL (itembar) ? child_req.width : child_req.height;
if (child->small)
{
@@ -545,7 +548,7 @@ panel_itembar_size_allocate (GtkWidget *widget,
/* set start coordinates for the items in the row*/
x = allocation->x + border_width;
y = allocation->y + border_width;
- if (itembar->horizontal)
+ if (HORIZONTAL (itembar))
{
y += row * itembar->size;
start = y;
@@ -624,7 +627,7 @@ panel_itembar_size_allocate (GtkWidget *widget,
* wrapping plugin to improve accessibility */
if (expand_length_avail > 0)
{
- if (itembar->horizontal)
+ if (HORIZONTAL (itembar))
{
child_alloc.height = itembar->size;
child_alloc.width = expand_length_avail;
@@ -653,7 +656,7 @@ panel_itembar_size_allocate (GtkWidget *widget,
/* if (child->small) */
/* child_length = itembar->size / itembar->nrows; */
/* else */
- child_length = itembar->horizontal ? child_req.width : child_req.height;
+ child_length = HORIZONTAL (itembar) ? child_req.width : child_req.height;
if (G_UNLIKELY (!expand_children_fit && child->expand))
{
@@ -685,7 +688,7 @@ panel_itembar_size_allocate (GtkWidget *widget,
if (child_length < 1)
child_length = 1;
- if (itembar->horizontal)
+ if (HORIZONTAL (itembar))
{
child_alloc.height = itembar->size;
child_alloc.width = child_length;
@@ -1100,14 +1103,14 @@ panel_itembar_get_drop_index (PanelItembar *itembar,
row += itembar->size;
/* always make sure the item is on the row */
- if ((itembar->horizontal && y < row)
- || (!itembar->horizontal && x < row))
+ if ((HORIZONTAL (itembar) && y < row)
+ || (!HORIZONTAL (itembar) && x < row))
break;
}
alloc = &child->widget->allocation;
- if (itembar->horizontal)
+ if (HORIZONTAL (itembar))
{
if (x < alloc->x) break;
if (child->small)
diff --git a/panel/panel-plugin-external-46.c b/panel/panel-plugin-external-46.c
index d0bf65c..14d4c23 100644
--- a/panel/panel-plugin-external-46.c
+++ b/panel/panel-plugin-external-46.c
@@ -243,7 +243,8 @@ panel_plugin_external_46_set_properties (PanelPluginExternal *external,
switch (property->type)
{
case PROVIDER_PROP_TYPE_SET_SIZE:
- case PROVIDER_PROP_TYPE_SET_ORIENTATION:
+ case PROVIDER_PROP_TYPE_SET_MODE:
+ case PROVIDER_PROP_TYPE_SET_NROWS:
case PROVIDER_PROP_TYPE_SET_SCREEN_POSITION:
case PROVIDER_PROP_TYPE_SET_NROWS:
event.data.s[1] = g_value_get_int (&property->value);
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index 1c09d12..4414fff 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -84,8 +84,10 @@ static const gchar *panel_plugin_external_get_name (XfcePanelPlug
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_orientation (XfcePanelPluginProvider *provider,
- GtkOrientation orientation);
+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_set_nrows (XfcePanelPluginProvider *provider,
@@ -224,9 +226,8 @@ panel_plugin_external_provider_init (XfcePanelPluginProviderInterface *iface)
iface->get_name = panel_plugin_external_get_name;
iface->get_unique_id = panel_plugin_external_get_unique_id;
iface->set_size = panel_plugin_external_set_size;
- iface->set_orientation = panel_plugin_external_set_orientation;
+ iface->set_mode = panel_plugin_external_set_mode;
iface->set_nrows = panel_plugin_external_set_nrows;
- iface->set_deskbar_mode = panel_plugin_external_set_deskbar_mode;
iface->set_screen_position = panel_plugin_external_set_screen_position;
iface->save = panel_plugin_external_save;
iface->get_show_configure = panel_plugin_external_get_show_configure;
@@ -904,8 +905,8 @@ panel_plugin_external_set_size (XfcePanelPluginProvider *provider,
static void
-panel_plugin_external_set_orientation (XfcePanelPluginProvider *provider,
- GtkOrientation orientation)
+panel_plugin_external_set_mode (XfcePanelPluginProvider *provider,
+ XfcePanelPluginMode mode)
{
GValue value = { 0, };
@@ -913,10 +914,30 @@ panel_plugin_external_set_orientation (XfcePanelPluginProvider *provider,
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
g_value_init (&value, G_TYPE_INT);
- g_value_set_int (&value, orientation);
+ g_value_set_int (&value, mode);
panel_plugin_external_queue_add (PANEL_PLUGIN_EXTERNAL (provider),
- PROVIDER_PROP_TYPE_SET_ORIENTATION, &value);
+ PROVIDER_PROP_TYPE_SET_MODE, &value);
+
+ g_value_unset (&value);
+}
+
+
+
+static void
+panel_plugin_external_set_nrows (XfcePanelPluginProvider *provider,
+ guint rows)
+{
+ GValue value = { 0, };
+
+ panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (provider));
+ panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
+
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, rows);
+
+ panel_plugin_external_queue_add (PANEL_PLUGIN_EXTERNAL (provider),
+ PROVIDER_PROP_TYPE_SET_NROWS, &value);
g_value_unset (&value);
}
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index c429a8c..2ff331b 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -408,11 +408,13 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
return;
/* hook up the bindings */
- panel_preferences_dialog_bindings_add (dialog, "horizontal", "active");
+ panel_preferences_dialog_bindings_add (dialog, "mode", "active");
panel_preferences_dialog_bindings_add (dialog, "span-monitors", "active");
panel_preferences_dialog_bindings_add (dialog, "position-locked", "active");
panel_preferences_dialog_bindings_add (dialog, "autohide", "active");
panel_preferences_dialog_bindings_add (dialog, "disable-struts", "active");
+ /* panel_preferences_dialog_bindings_add (dialog, "size", "value"); */
+ panel_preferences_dialog_bindings_add (dialog, "nrows", "value");
panel_preferences_dialog_bindings_add (dialog, "icon-size", "value");
panel_preferences_dialog_bindings_add (dialog, "length", "value");
panel_preferences_dialog_bindings_add (dialog, "length-adjust", "active");
diff --git a/panel/panel-preferences-dialog.glade b/panel/panel-preferences-dialog.glade
index 222cd54..4717e3c 100644
--- a/panel/panel-preferences-dialog.glade
+++ b/panel/panel-preferences-dialog.glade
@@ -1,19 +1,22 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.14"/>
+ <requires lib="gtk+" version="2.20"/>
<!-- interface-requires libxfce4ui 0.0 -->
<!-- interface-naming-policy project-wide -->
- <object class="GtkListStore" id="orientation-store">
+ <object class="GtkListStore" id="mode-store">
<columns>
<!-- column-name title -->
<column type="gchararray"/>
</columns>
<data>
<row>
+ <col id="0" translatable="yes">Horizontal</col>
+ </row>
+ <row>
<col id="0" translatable="yes">Vertical</col>
</row>
<row>
- <col id="0" translatable="yes">Horizontal</col>
+ <col id="0" translatable="yes">Deskbar</col>
</row>
</data>
</object>
@@ -69,6 +72,13 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkAdjustment" id="nrows">
+ <property name="value">1</property>
+ <property name="lower">1</property>
+ <property name="upper">6</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkAdjustment" id="background-alpha">
<property name="value">100</property>
<property name="upper">100</property>
@@ -214,10 +224,9 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Orientation:</property>
+ <property name="label" translatable="yes">M_ode:</property>
<property name="use_underline">True</property>
- <property name="wrap_mode">word-char</property>
- <property name="mnemonic_widget">horizontal</property>
+ <property name="mnemonic_widget">mode</property>
</object>
<packing>
<property name="expand">False</property>
@@ -225,9 +234,9 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="horizontal">
+ <object class="GtkComboBox" id="mode">
<property name="visible">True</property>
- <property name="model">orientation-store</property>
+ <property name="model">mode-store</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
@@ -393,7 +402,7 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Icon _Size (pixels):</property>
+ <property name="label" translatable="yes">_Size (pixels):</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">icon-size-scale</property>
</object>
@@ -410,6 +419,20 @@
<property name="mnemonic_widget">length-scale</property>
</object>
<packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Num_ber of rows:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">nrows-scale</property>
+ </object>
+ <packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
@@ -441,8 +464,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
<child>
@@ -476,6 +499,22 @@
</packing>
</child>
<child>
+ <object class="GtkHScale" id="nrows-scale">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="update_policy">discontinuous</property>
+ <property name="adjustment">nrows</property>
+ <property name="digits">0</property>
+ <property name="value_pos">right</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkCheckButton" id="length-adjust">
<property name="label" translatable="yes">A_utomatically increase the length</property>
<property name="visible">True</property>
diff --git a/panel/panel-window.c b/panel/panel-window.c
index 62d554e..992dcac 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -61,6 +61,7 @@
#define HANDLE_SIZE (HANDLE_DOTS * (HANDLE_PIXELS + \
HANDLE_PIXEL_SPACE) - HANDLE_PIXEL_SPACE)
#define HANDLE_SIZE_TOTAL (2 * HANDLE_SPACING + HANDLE_SIZE)
+#define HORIZONTAL(window) ((window)->mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL)
@@ -132,14 +133,12 @@ static void panel_window_menu_popup (PanelWindow *w
guint32 event_time);
static void panel_window_plugins_update (PanelWindow *window,
PluginProp prop);
-static void panel_window_plugin_set_orientation (GtkWidget *widget,
+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_nrows (GtkWidget *widget,
gpointer user_data);
-static void panel_window_plugin_set_deskbar_mode (GtkWidget *widget,
- gpointer user_data);
static void panel_window_plugin_set_screen_position (GtkWidget *widget,
gpointer user_data);
@@ -147,9 +146,10 @@ static void panel_window_plugin_set_screen_position (GtkWidget *w
enum
{
PROP_0,
- PROP_HORIZONTAL,
+ PROP_MODE,
PROP_ICON_SIZE,
PROP_SIZE,
+ PROP_NROWS,
PROP_LENGTH,
PROP_LENGTH_ADJUST,
PROP_POSITION_LOCKED,
@@ -164,10 +164,9 @@ enum
enum _PluginProp
{
- PLUGIN_PROP_ORIENTATION,
+ PLUGIN_PROP_MODE,
PLUGIN_PROP_SCREEN_POSITION,
PLUGIN_PROP_NROWS,
- PLUGIN_PROP_DESKBAR_MODE,
PLUGIN_PROP_SIZE
};
@@ -267,9 +266,8 @@ struct _PanelWindow
guint size;
gdouble length;
guint length_adjust : 1;
+ XfcePanelPluginMode mode;
guint nrows;
- guint horizontal : 1;
- guint deskbar_mode : 1;
SnapPosition snap_position;
guint span_monitors : 1;
gchar *output_name;
@@ -353,10 +351,11 @@ panel_window_class_init (PanelWindowClass *klass)
gtkwidget_class->realize = panel_window_realize;
g_object_class_install_property (gobject_class,
- PROP_HORIZONTAL,
- g_param_spec_boolean ("horizontal", NULL, NULL,
- TRUE,
- EXO_PARAM_READWRITE));
+ PROP_MODE,
+ g_param_spec_enum ("mode", NULL, NULL,
+ XFCE_TYPE_PANEL_PLUGIN_MODE,
+ XFCE_PANEL_PLUGIN_MODE_HORIZONTAL,
+ EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_ICON_SIZE,
@@ -371,9 +370,15 @@ panel_window_class_init (PanelWindowClass *klass)
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
+ PROP_NROWS,
+ g_param_spec_uint ("nrows", NULL, NULL,
+ 1, 6, 1,
+ EXO_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class,
PROP_LENGTH,
g_param_spec_uint ("length", NULL, NULL,
- 1, 100, 25,
+ 1, 100, 10,
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
@@ -537,10 +542,10 @@ panel_window_init (PanelWindow *window)
window->screen = NULL;
window->struts_edge = STRUTS_EDGE_NONE;
window->struts_disabled = FALSE;
- window->horizontal = TRUE;
+ window->mode = XFCE_PANEL_PLUGIN_MODE_HORIZONTAL;
+ window->icon_size = 48;
window->nrows = 1;
- window->icon_size = 30;
- window->size = 30;
+ window->size = 48;
window->length = 0.10;
window->length_adjust = TRUE;
window->deskbar_mode = FALSE;
@@ -596,8 +601,8 @@ panel_window_get_property (GObject *object,
switch (prop_id)
{
- case PROP_HORIZONTAL:
- g_value_set_boolean (value, window->horizontal);
+ case PROP_MODE:
+ g_value_set_enum (value, window->mode);
break;
case PROP_ICON_SIZE:
@@ -608,6 +613,10 @@ panel_window_get_property (GObject *object,
g_value_set_uint (value, window->size);
break;
+ case PROP_NROWS:
+ g_value_set_uint (value, window->nrows);
+ break;
+
case PROP_LENGTH:
g_value_set_uint (value, rint (window->length * 100.00));
break;
@@ -666,26 +675,27 @@ panel_window_set_property (GObject *object,
const GValue *value,
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;
+ 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)
{
- case PROP_HORIZONTAL:
- val_bool = g_value_get_boolean (value);
- if (window->horizontal != val_bool)
+ case PROP_MODE:
+ val_mode = g_value_get_enum (value);
+ if (window->mode != val_mode)
{
- window->horizontal = !!val_bool;
+ window->mode = val_mode;
panel_window_screen_layout_changed (window->screen, window);
}
/* send the new orientation and screen position to the panel plugins */
- panel_window_plugins_update (window, PLUGIN_PROP_ORIENTATION);
+ panel_window_plugins_update (window, PLUGIN_PROP_MODE);
panel_window_plugins_update (window, PLUGIN_PROP_SCREEN_POSITION);
break;
@@ -710,6 +720,18 @@ panel_window_set_property (GObject *object,
panel_window_plugins_update (window, PLUGIN_PROP_SIZE);
break;
+ case PROP_NROWS:
+ val_uint = g_value_get_uint (value);
+ if (window->nrows != val_uint)
+ {
+ window->nrows = val_uint;
+ gtk_widget_queue_resize (GTK_WIDGET (window));
+ }
+
+ /* send the new size to the panel plugins */
+ panel_window_plugins_update (window, PLUGIN_PROP_NROWS);
+ break;
+
case PROP_LENGTH:
val_double = g_value_get_uint (value) / 100.00;
if (window->length != val_double)
@@ -885,7 +907,7 @@ panel_window_expose_event (GtkWidget *widget,
if (window->position_locked || !GTK_WIDGET_DRAWABLE (widget))
goto end;
- if (window->horizontal)
+ if (HORIZONTAL (window))
{
handle_h = window->alloc.height / 2;
handle_w = HANDLE_SIZE;
@@ -1278,7 +1300,7 @@ panel_window_size_request (GtkWidget *widget,
/* handle size */
if (!window->position_locked)
{
- if (window->horizontal)
+ if (HORIZONTAL (window))
extra_width += 2 * HANDLE_SIZE_TOTAL;
else
extra_height += 2 * HANDLE_SIZE_TOTAL;
@@ -1299,7 +1321,7 @@ panel_window_size_request (GtkWidget *widget,
requisition->width = child_requisition.width + extra_width;
/* respect the length and monitor/screen size */
- if (window->horizontal)
+ if (HORIZONTAL (window))
{
if (!window->length_adjust)
requisition->width = extra_width;
@@ -1361,7 +1383,7 @@ panel_window_size_allocate (GtkWidget *widget,
/* corner or floating panel */
default:
- if (window->horizontal)
+ if (HORIZONTAL (window))
w = alloc->width;
else
h = alloc->height;
@@ -1420,7 +1442,7 @@ panel_window_size_allocate (GtkWidget *widget,
/* keep space for the panel handles if not locked */
if (!window->position_locked)
{
- if (window->horizontal)
+ if (HORIZONTAL (window))
{
child_alloc.width -= 2 * HANDLE_SIZE_TOTAL;
child_alloc.x += HANDLE_SIZE_TOTAL;
@@ -1614,31 +1636,31 @@ panel_window_screen_struts_edge (PanelWindow *window)
case SNAP_POSITION_E:
case SNAP_POSITION_EC:
- return window->horizontal ? STRUTS_EDGE_NONE : STRUTS_EDGE_RIGHT;
+ return HORIZONTAL (window) ? STRUTS_EDGE_NONE : STRUTS_EDGE_RIGHT;
case SNAP_POSITION_NE:
- return window->horizontal ? STRUTS_EDGE_TOP : STRUTS_EDGE_RIGHT;
+ return HORIZONTAL (window) ? STRUTS_EDGE_TOP : STRUTS_EDGE_RIGHT;
case SNAP_POSITION_SE:
- return window->horizontal ? STRUTS_EDGE_BOTTOM : STRUTS_EDGE_RIGHT;
+ return HORIZONTAL (window) ? STRUTS_EDGE_BOTTOM : STRUTS_EDGE_RIGHT;
case SNAP_POSITION_W:
case SNAP_POSITION_WC:
- return window->horizontal ? STRUTS_EDGE_NONE : STRUTS_EDGE_LEFT;
+ return HORIZONTAL (window) ? STRUTS_EDGE_NONE : STRUTS_EDGE_LEFT;
case SNAP_POSITION_NW:
- return window->horizontal ? STRUTS_EDGE_TOP : STRUTS_EDGE_LEFT;
+ return HORIZONTAL (window) ? STRUTS_EDGE_TOP : STRUTS_EDGE_LEFT;
case SNAP_POSITION_SW:
- return window->horizontal ? STRUTS_EDGE_BOTTOM : STRUTS_EDGE_LEFT;
+ return HORIZONTAL (window) ? STRUTS_EDGE_BOTTOM : STRUTS_EDGE_LEFT;
case SNAP_POSITION_NC:
case SNAP_POSITION_N:
- return window->horizontal ? STRUTS_EDGE_TOP : STRUTS_EDGE_NONE;
+ return HORIZONTAL (window) ? STRUTS_EDGE_TOP : STRUTS_EDGE_NONE;
case SNAP_POSITION_SC:
case SNAP_POSITION_S:
- return window->horizontal ? STRUTS_EDGE_BOTTOM : STRUTS_EDGE_NONE;
+ return HORIZONTAL (window) ? STRUTS_EDGE_BOTTOM : STRUTS_EDGE_NONE;
}
return STRUTS_EDGE_NONE;
@@ -1820,7 +1842,7 @@ panel_window_screen_update_borders (PanelWindow *window)
/* don't show the side borders if the length is 100% */
if (window->length == 1.00)
{
- if (window->horizontal)
+ if (HORIZONTAL (window))
PANEL_UNSET_FLAG (borders, PANEL_BORDER_LEFT | PANEL_BORDER_RIGHT);
else
PANEL_UNSET_FLAG (borders, PANEL_BORDER_TOP | PANEL_BORDER_BOTTOM);
@@ -2532,25 +2554,20 @@ panel_window_plugins_update (PanelWindow *window,
switch (prop)
{
- case PLUGIN_PROP_ORIENTATION:
- func = panel_window_plugin_set_orientation;
+ case PLUGIN_PROP_MODE:
+ func = panel_window_plugin_set_mode;
break;
case PLUGIN_PROP_SCREEN_POSITION:
func = panel_window_plugin_set_screen_position;
break;
- case PLUGIN_PROP_SIZE:
- func = panel_window_plugin_set_size;
- break;
-
case PLUGIN_PROP_NROWS:
func = panel_window_plugin_set_nrows;
break;
- case PLUGIN_PROP_DESKBAR_MODE:
- func = panel_window_plugin_set_deskbar_mode;
- break;
+ case PLUGIN_PROP_SIZE:
+ func = panel_window_plugin_set_size;
break;
default:
@@ -2569,15 +2586,14 @@ panel_window_plugins_update (PanelWindow *window,
static void
-panel_window_plugin_set_orientation (GtkWidget *widget,
- gpointer user_data)
+panel_window_plugin_set_mode (GtkWidget *widget,
+ gpointer user_data)
{
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget));
panel_return_if_fail (PANEL_IS_WINDOW (user_data));
- xfce_panel_plugin_provider_set_orientation (XFCE_PANEL_PLUGIN_PROVIDER (widget),
- PANEL_WINDOW (user_data)->horizontal ? GTK_ORIENTATION_HORIZONTAL:
- GTK_ORIENTATION_VERTICAL);
+ xfce_panel_plugin_provider_set_mode (XFCE_PANEL_PLUGIN_PROVIDER (widget),
+ PANEL_WINDOW (user_data)->mode);
}
@@ -2618,6 +2634,19 @@ panel_window_plugin_set_nrows (GtkWidget *widget,
static void
+panel_window_plugin_set_nrows (GtkWidget *widget,
+ gpointer user_data)
+{
+ panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget));
+ panel_return_if_fail (PANEL_IS_WINDOW (user_data));
+
+ xfce_panel_plugin_provider_set_nrows (XFCE_PANEL_PLUGIN_PROVIDER (widget),
+ PANEL_WINDOW (user_data)->nrows);
+}
+
+
+
+static void
panel_window_plugin_set_screen_position (GtkWidget *widget,
gpointer user_data)
{
@@ -2630,51 +2659,51 @@ panel_window_plugin_set_screen_position (GtkWidget *widget,
switch (window->snap_position)
{
case SNAP_POSITION_NONE:
- position = window->horizontal ? XFCE_SCREEN_POSITION_FLOATING_H :
+ position = HORIZONTAL (window) ? XFCE_SCREEN_POSITION_FLOATING_H :
XFCE_SCREEN_POSITION_FLOATING_V;
break;
case SNAP_POSITION_NW:
- position = window->horizontal ? XFCE_SCREEN_POSITION_NW_H :
+ position = HORIZONTAL (window) ? XFCE_SCREEN_POSITION_NW_H :
XFCE_SCREEN_POSITION_NW_V;
break;
case SNAP_POSITION_NE:
- position = window->horizontal ? XFCE_SCREEN_POSITION_NE_H :
+ position = HORIZONTAL (window) ? XFCE_SCREEN_POSITION_NE_H :
XFCE_SCREEN_POSITION_NE_V;
break;
case SNAP_POSITION_SW:
- position = window->horizontal ? XFCE_SCREEN_POSITION_SW_H :
+ position = HORIZONTAL (window) ? XFCE_SCREEN_POSITION_SW_H :
XFCE_SCREEN_POSITION_SW_V;
break;
case SNAP_POSITION_SE:
- position = window->horizontal ? XFCE_SCREEN_POSITION_SE_H :
+ position = HORIZONTAL (window) ? XFCE_SCREEN_POSITION_SE_H :
XFCE_SCREEN_POSITION_SE_V;
break;
case SNAP_POSITION_W:
case SNAP_POSITION_WC:
- position = window->horizontal ? XFCE_SCREEN_POSITION_FLOATING_H :
+ position = HORIZONTAL (window) ? XFCE_SCREEN_POSITION_FLOATING_H :
XFCE_SCREEN_POSITION_W;
break;
case SNAP_POSITION_E:
case SNAP_POSITION_EC:
- position = window->horizontal ? XFCE_SCREEN_POSITION_FLOATING_H :
+ position = HORIZONTAL (window) ? XFCE_SCREEN_POSITION_FLOATING_H :
XFCE_SCREEN_POSITION_E;
break;
case SNAP_POSITION_S:
case SNAP_POSITION_SC:
- position = window->horizontal ? XFCE_SCREEN_POSITION_S :
+ position = HORIZONTAL (window) ? XFCE_SCREEN_POSITION_S :
XFCE_SCREEN_POSITION_FLOATING_V;
break;
case SNAP_POSITION_N:
case SNAP_POSITION_NC:
- position = window->horizontal ? XFCE_SCREEN_POSITION_N :
+ position = HORIZONTAL (window) ? XFCE_SCREEN_POSITION_N :
XFCE_SCREEN_POSITION_FLOATING_V;
break;
@@ -2747,7 +2776,7 @@ panel_window_set_povider_info (PanelWindow *window,
}
}
- panel_window_plugin_set_orientation (provider, window);
+ panel_window_plugin_set_mode (provider, window);
panel_window_plugin_set_screen_position (provider, window);
panel_window_plugin_set_size (provider, window);
panel_window_plugin_set_nrows (provider, window);
diff --git a/wrapper/main.c b/wrapper/main.c
index d03d769..b473fdb 100644
--- a/wrapper/main.c
+++ b/wrapper/main.c
@@ -89,8 +89,8 @@ wrapper_gproxy_set (DBusGProxy *dbus_gproxy,
xfce_panel_plugin_provider_set_size (provider, g_value_get_int (value));
break;
- case PROVIDER_PROP_TYPE_SET_ORIENTATION:
- xfce_panel_plugin_provider_set_orientation (provider, g_value_get_int (value));
+ case PROVIDER_PROP_TYPE_SET_MODE:
+ xfce_panel_plugin_provider_set_mode (provider, g_value_get_int (value));
break;
case PROVIDER_PROP_TYPE_SET_NROWS:
@@ -105,6 +105,10 @@ wrapper_gproxy_set (DBusGProxy *dbus_gproxy,
xfce_panel_plugin_provider_set_screen_position (provider, g_value_get_int (value));
break;
+ case PROVIDER_PROP_TYPE_SET_NROWS:
+ xfce_panel_plugin_provider_set_nrows (provider, g_value_get_int (value));
+ break;
+
case PROVIDER_PROP_TYPE_SET_LOCKED:
xfce_panel_plugin_provider_set_locked (provider, g_value_get_boolean (value));
break;
More information about the Xfce4-commits
mailing list