Browse Source

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.
tags/xfce4-panel-4.10.0
Nick Schermer 10 years ago
parent
commit
96baf38570
17 changed files with 512 additions and 149 deletions
  1. +1
    -1
      configure.ac.in
  2. +17
    -1
      libxfce4panel/libxfce4panel-enums.h
  3. +4
    -1
      libxfce4panel/libxfce4panel.symbols
  4. +6
    -2
      libxfce4panel/xfce-panel-macros-46.h
  5. +14
    -3
      libxfce4panel/xfce-panel-plugin-provider.c
  6. +11
    -5
      libxfce4panel/xfce-panel-plugin-provider.h
  7. +175
    -15
      libxfce4panel/xfce-panel-plugin.c
  8. +10
    -2
      libxfce4panel/xfce-panel-plugin.h
  9. +22
    -1
      migrate/migrate-config.c
  10. +10
    -7
      panel/panel-application.c
  11. +46
    -29
      panel/panel-itembar.c
  12. +2
    -1
      panel/panel-plugin-external-46.c
  13. +30
    -7
      panel/panel-plugin-external.c
  14. +2
    -1
      panel/panel-preferences-dialog.c
  15. +53
    -14
      panel/panel-preferences-dialog.glade
  16. +103
    -57
      panel/panel-window.c
  17. +6
    -2
      wrapper/main.c

+ 1
- 1
configure.ac.in View File

@@ -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])


+ 17
- 1
libxfce4panel/libxfce4panel-enums.h View File

@@ -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


+ 4
- 1
libxfce4panel/libxfce4panel.symbols View File

@@ -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


+ 6
- 2
libxfce4panel/xfce-panel-macros-46.h View File

@@ -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_SCREEN_POSITION: \


+ 14
- 3
libxfce4panel/xfce-panel-plugin-provider.c View File

@@ -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);
}




+ 11
- 5
libxfce4panel/xfce-panel-plugin-provider.h View File

@@ -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);
@@ -99,9 +101,10 @@ XfcePanelPluginProviderSignal;
typedef enum /*< skip >*/
{
PROVIDER_PROP_TYPE_SET_SIZE, /* gint */
PROVIDER_PROP_TYPE_SET_ORIENTATION, /* GtkOrientation (as gint) */
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 */
@@ -154,8 +157,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_screen_position (XfcePanelPluginProvider *provider,
XfceScreenPosition screen_position);


+ 175
- 15
libxfce4panel/xfce-panel-plugin.c View File

@@ -90,8 +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_screen_position (XfcePanelPluginProvider *provider,
XfceScreenPosition screen_position);
static void xfce_panel_plugin_save (XfcePanelPluginProvider *provider);
@@ -126,6 +128,8 @@ enum
PROP_SIZE,
PROP_SCREEN_POSITION,
PROP_EXPAND,
PROP_MODE,
PROP_NROWS,
PROP_SHRINK
};

@@ -140,6 +144,8 @@ enum
SAVE,
SIZE_CHANGED,
SCREEN_POSITION_CHANGED,
MODE_CHANGED,
NROWS_CHANGED,
LAST_SIGNAL
};

@@ -166,7 +172,8 @@ struct _XfcePanelPluginPrivate
gint size;
guint expand : 1;
guint shrink : 1;
GtkOrientation orientation;
guint nrows;
XfcePanelPluginMode mode;
XfceScreenPosition screen_position;
guint locked : 1;
GSList *menu_items;
@@ -297,6 +304,44 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
g_cclosure_marshal_VOID__ENUM,
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.
@@ -583,6 +628,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");
}
@@ -603,7 +681,7 @@ xfce_panel_plugin_init (XfcePanelPlugin *plugin)
plugin->priv->size = 0;
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;
@@ -611,6 +689,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 */
@@ -631,7 +710,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_screen_position = xfce_panel_plugin_set_screen_position;
iface->save = xfce_panel_plugin_save;
iface->get_show_configure = xfce_panel_plugin_get_show_configure;
@@ -694,7 +774,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:
@@ -1260,22 +1340,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->orientation != orientation))
if (G_LIKELY (plugin->priv->mode != mode))
{
plugin->priv->orientation = orientation;
old_orientation = xfce_panel_plugin_get_orientation (plugin);

plugin->priv->mode = mode;

g_signal_emit (G_OBJECT (plugin),
plugin_signals[ORIENTATION_CHANGED], 0, orientation);
plugin_signals[MODE_CHANGED], 0, mode);

g_object_notify (G_OBJECT (plugin), "orientation");
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->nrows != nrows))
{
plugin->priv->nrows = nrows;

g_signal_emit (G_OBJECT (plugin),
plugin_signals[NROWS_CHANGED], 0, nrows);

g_object_notify (G_OBJECT (plugin), "nrows");
}
}

@@ -1742,7 +1858,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.
@@ -1753,9 +1869,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;
}




+ 10
- 2
libxfce4panel/xfce-panel-plugin.h View File

@@ -127,11 +127,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);
};


@@ -180,6 +184,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,


+ 22
- 1
migrate/migrate-config.c View File

@@ -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;
}

+ 10
- 7
panel/panel-application.c View File

@@ -284,8 +284,9 @@ 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 },
{ "size", G_TYPE_UINT },
{ "nrows", G_TYPE_UINT },
{ "length", G_TYPE_UINT },
{ "length-adjust", G_TYPE_BOOLEAN },
{ "enter-opacity", G_TYPE_UINT },
@@ -1414,10 +1415,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);
@@ -1448,8 +1451,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");
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);



+ 46
- 29
panel/panel-itembar.c View File

@@ -28,6 +28,8 @@

#include <panel/panel-itembar.h>

#define HORIZONTAL(itembar) ((itembar)->mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL)



typedef struct _PanelItembarChild PanelItembarChild;
@@ -85,12 +87,13 @@ struct _PanelItembar
GSList *children;

/* some properties we clone from the panel window */
guint horizontal : 1;
guint size;
XfcePanelPluginMode mode;
guint size;
guint nrows;

/* dnd support */
gint highlight_index;
gint highlight_x, highlight_y;
gint highlight_index;
gint highlight_x, highlight_y;
};

struct _PanelItembarChild
@@ -104,8 +107,9 @@ struct _PanelItembarChild
enum
{
PROP_0,
PROP_HORIZONTAL,
PROP_SIZE
PROP_MODE,
PROP_SIZE,
PROP_NROWS
};

enum
@@ -166,17 +170,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, 48,
16, 128, 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));

gtk_container_class_install_child_property (gtkcontainer_class,
@@ -207,8 +219,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->highlight_index = -1;

GTK_WIDGET_SET_FLAGS (GTK_WIDGET (itembar), GTK_NO_WINDOW);
@@ -228,14 +241,18 @@ 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:
itembar->size = g_value_get_uint (value);
break;

case PROP_NROWS:
itembar->nrows = g_value_get_uint (value);
break;

default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -284,7 +301,7 @@ panel_itembar_size_request (GtkWidget *widget,
gint row_length = 0;

/* intialize the requisition, we always set the panel height */
if (itembar->horizontal)
if (HORIZONTAL (itembar))
{
requisition->height = itembar->size;
requisition->width = 0;
@@ -309,7 +326,7 @@ panel_itembar_size_request (GtkWidget *widget,

if (G_LIKELY (!child->wrap))
{
if (itembar->horizontal)
if (HORIZONTAL (itembar))
row_length += child_requisition.width;
else
row_length += child_requisition.height;
@@ -317,7 +334,7 @@ panel_itembar_size_request (GtkWidget *widget,
else
{
/* add to size for new wrap element */
if (itembar->horizontal)
if (HORIZONTAL (itembar))
{
requisition->height += itembar->size;
requisition->width = MAX (requisition->width, row_length);
@@ -340,7 +357,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);
@@ -376,7 +393,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;
@@ -403,7 +420,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 (G_UNLIKELY (child->expand))
{
@@ -426,7 +443,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;
else
x += row * itembar->size;
@@ -458,7 +475,7 @@ panel_itembar_size_allocate (GtkWidget *widget,
itembar->highlight_y = y;
expand_length_avail -= itembar->size;

if (itembar->horizontal)
if (HORIZONTAL (itembar))
x += itembar->size;
else
y += itembar->size;
@@ -480,7 +497,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;
@@ -503,7 +520,7 @@ panel_itembar_size_allocate (GtkWidget *widget,
break;
}

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))
{
@@ -535,7 +552,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;
@@ -888,14 +905,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 + (alloc->width / 2))
&& y >= alloc->y


+ 2
- 1
panel/panel-plugin-external-46.c View File

@@ -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:
event.data.s[1] = g_value_get_int (&property->value);
break;


+ 30
- 7
panel/panel-plugin-external.c View File

@@ -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_save (XfcePanelPluginProvider *provider);
@@ -220,7 +222,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_screen_position = panel_plugin_external_set_screen_position;
iface->save = panel_plugin_external_save;
iface->get_show_configure = panel_plugin_external_get_show_configure;
@@ -898,8 +901,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, };

@@ -907,10 +910,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);
}


+ 2
- 1
panel/panel-preferences-dialog.c View File

@@ -409,12 +409,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, "length", "value");
panel_preferences_dialog_bindings_add (dialog, "length-adjust", "active");
panel_preferences_dialog_bindings_add (dialog, "background-alpha", "value");


+ 53
- 14
panel/panel-preferences-dialog.glade View File

@@ -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>
@@ -62,6 +65,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>
@@ -207,10 +217,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>
@@ -218,9 +227,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>
@@ -364,7 +373,7 @@
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="border_width">6</property>
<property name="n_rows">3</property>
<property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -372,7 +381,7 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Size (pixels):</property>
<property name="label" translatable="yes">Row _Size (pixels):</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">size-scale</property>
</object>
@@ -388,6 +397,20 @@
<property name="use_underline">True</property>
<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>
@@ -406,8 +429,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>
@@ -424,6 +447,22 @@
<property name="right_attach">2</property>
</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>
@@ -436,8 +475,8 @@
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
</object>


+ 103
- 57
panel/panel-window.c View File

@@ -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)



@@ -131,10 +132,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_screen_position (GtkWidget *widget,
gpointer user_data);

@@ -142,8 +145,9 @@ static void panel_window_plugin_set_screen_position (GtkWidget *w
enum
{
PROP_0,
PROP_HORIZONTAL,
PROP_MODE,
PROP_SIZE,
PROP_NROWS,
PROP_LENGTH,
PROP_LENGTH_ADJUST,
PROP_POSITION_LOCKED,
@@ -156,8 +160,9 @@ enum

enum _PluginProp
{
PLUGIN_PROP_ORIENTATION,
PLUGIN_PROP_MODE,
PLUGIN_PROP_SCREEN_POSITION,
PLUGIN_PROP_NROWS,
PLUGIN_PROP_SIZE
};

@@ -256,7 +261,8 @@ struct _PanelWindow
guint size;
gdouble length;
guint length_adjust : 1;
guint horizontal : 1;
XfcePanelPluginMode mode;
guint nrows;
SnapPosition snap_position;
guint span_monitors : 1;
gchar *output_name;
@@ -335,10 +341,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_SIZE,
@@ -346,10 +353,16 @@ panel_window_class_init (PanelWindowClass *klass)
16, 128, 48,
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,
@@ -435,8 +448,9 @@ panel_window_init (PanelWindow *window)
window->screen = NULL;
window->struts_edge = STRUTS_EDGE_NONE;
window->struts_disabled = FALSE;
window->horizontal = TRUE;
window->size = 30;
window->mode = XFCE_PANEL_PLUGIN_MODE_HORIZONTAL;
window->size = 48;
window->nrows = 1;
window->length = 0.10;
window->length_adjust = TRUE;
window->snap_position = SNAP_POSITION_NONE;
@@ -481,14 +495,18 @@ 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_SIZE:
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;
@@ -539,26 +557,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;

@@ -574,6 +593,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)
@@ -709,7 +740,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;
@@ -1102,7 +1133,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;
@@ -1123,7 +1154,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;
@@ -1185,7 +1216,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;
@@ -1244,7 +1275,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;
@@ -1438,31 +1469,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;
@@ -1644,7 +1675,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);
@@ -2356,18 +2387,21 @@ 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_NROWS:
func = panel_window_plugin_set_nrows;
break;

case PLUGIN_PROP_SIZE:
func = panel_window_plugin_set_size;
break;
break;

default:
panel_assert_not_reached ();
@@ -2385,15 +2419,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);
}


@@ -2411,6 +2444,19 @@ panel_window_plugin_set_size (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)
@@ -2424,51 +2470,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;

@@ -2541,7 +2587,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);
}


+ 6
- 2
wrapper/main.c View File

@@ -89,14 +89,18 @@ 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_SCREEN_POSITION:
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;


Loading…
Cancel
Save