summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/default.layout6
-rw-r--r--data/fedora.layout8
-rw-r--r--data/linuxmint.layout4
-rw-r--r--data/mageia.layout6
-rw-r--r--data/opensuse.layout8
-rw-r--r--data/org.mate.panel.object.gschema.xml.in9
-rw-r--r--data/ubuntu.layout16
-rw-r--r--mate-panel/applet.c93
-rw-r--r--mate-panel/applet.h14
-rw-r--r--mate-panel/drawer.c4
-rw-r--r--mate-panel/launcher.c3
-rw-r--r--mate-panel/panel-action-button.c2
-rw-r--r--mate-panel/panel-applet-frame.c2
-rw-r--r--mate-panel/panel-enums-gsettings.h6
-rw-r--r--mate-panel/panel-layout.c1
-rw-r--r--mate-panel/panel-menu-bar.c2
-rw-r--r--mate-panel/panel-menu-button.c2
-rw-r--r--mate-panel/panel-profile.c75
-rw-r--r--mate-panel/panel-profile.h30
-rw-r--r--mate-panel/panel-schemas.h1
-rw-r--r--mate-panel/panel-separator.c2
-rw-r--r--mate-panel/panel-toplevel.c28
-rw-r--r--mate-panel/panel-widget.c339
-rw-r--r--mate-panel/panel-widget.h6
-rw-r--r--mate-panel/panel.c12
-rw-r--r--mate-panel/panel.h2
26 files changed, 222 insertions, 459 deletions
diff --git a/data/default.layout b/data/default.layout
index c7aef160..77923b42 100644
--- a/data/default.layout
+++ b/data/default.layout
@@ -19,7 +19,7 @@ object-type=applet
applet-iid=NotificationAreaAppletFactory::NotificationArea
toplevel-id=top
position=10
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object clock]
@@ -27,7 +27,7 @@ object-type=applet
applet-iid=ClockAppletFactory::ClockApplet
toplevel-id=top
position=0
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object show-desktop]
@@ -49,5 +49,5 @@ object-type=applet
applet-iid=WnckletFactory::WorkspaceSwitcherApplet
toplevel-id=bottom
position=0
-relative-to-edge=end
+panel-right-stick=true
locked=true
diff --git a/data/fedora.layout b/data/fedora.layout
index c368c81b..ed55eca0 100644
--- a/data/fedora.layout
+++ b/data/fedora.layout
@@ -40,7 +40,7 @@ object-type=applet
applet-iid=GvcAppletFactory::GvcApplet
toplevel-id=top
position=20
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object notification-area]
@@ -48,7 +48,7 @@ object-type=applet
applet-iid=NotificationAreaAppletFactory::NotificationArea
toplevel-id=top
position=10
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object clock]
@@ -56,7 +56,7 @@ object-type=applet
applet-iid=ClockAppletFactory::ClockApplet
toplevel-id=top
position=0
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object show-desktop]
@@ -78,5 +78,5 @@ object-type=applet
applet-iid=WnckletFactory::WorkspaceSwitcherApplet
toplevel-id=bottom
position=0
-relative-to-edge=end
+panel-right-stick=true
locked=true
diff --git a/data/linuxmint.layout b/data/linuxmint.layout
index 57ed5823..43d1b908 100644
--- a/data/linuxmint.layout
+++ b/data/linuxmint.layout
@@ -29,7 +29,7 @@ object-type=applet
applet-iid=NotificationAreaAppletFactory::NotificationArea
toplevel-id=bottom
position=10
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object clock]
@@ -37,5 +37,5 @@ object-type=applet
applet-iid=ClockAppletFactory::ClockApplet
toplevel-id=bottom
position=0
-relative-to-edge=end
+panel-right-stick=true
locked=true
diff --git a/data/mageia.layout b/data/mageia.layout
index d0118a87..504a3377 100644
--- a/data/mageia.layout
+++ b/data/mageia.layout
@@ -40,7 +40,7 @@ object-type=applet
applet-iid=NotificationAreaAppletFactory::NotificationArea
toplevel-id=top
position=10
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object clock]
@@ -48,7 +48,7 @@ object-type=applet
applet-iid=ClockAppletFactory::ClockApplet
toplevel-id=top
position=0
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object show-desktop]
@@ -70,6 +70,6 @@ object-type=applet
applet-iid=WnckletFactory::WorkspaceSwitcherApplet
toplevel-id=bottom
position=0
-relative-to-edge=end
+panel-right-stick=true
locked=true
diff --git a/data/opensuse.layout b/data/opensuse.layout
index 8dd8a3d7..d0f96927 100644
--- a/data/opensuse.layout
+++ b/data/opensuse.layout
@@ -29,7 +29,7 @@ object-type=applet
applet-iid=NotificationAreaAppletFactory::NotificationArea
toplevel-id=bottom
position=30
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object workspace-switcher]
@@ -37,7 +37,7 @@ object-type=applet
applet-iid=WnckletFactory::WorkspaceSwitcherApplet
toplevel-id=bottom
position=20
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object clock]
@@ -45,7 +45,7 @@ object-type=applet
applet-iid=ClockAppletFactory::ClockApplet
toplevel-id=bottom
position=10
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object show-desktop]
@@ -53,5 +53,5 @@ object-type=applet
applet-iid=WnckletFactory::ShowDesktopApplet
toplevel-id=bottom
position=0
-relative-to-edge=end
+panel-right-stick=true
locked=true
diff --git a/data/org.mate.panel.object.gschema.xml.in b/data/org.mate.panel.object.gschema.xml.in
index 441215ad..73656bc5 100644
--- a/data/org.mate.panel.object.gschema.xml.in
+++ b/data/org.mate.panel.object.gschema.xml.in
@@ -17,13 +17,8 @@
</key>
<key name="panel-right-stick" type="b">
<default>false</default>
- <summary>Interpret position relative to bottom/right edge (DEPRECATED)</summary>
- <description>If true, the position of the object is interpreted relative to the right (or bottom if vertical) edge of the panel. This key is provided only for backward compatibility with old panel layouts; please set the "relative-to-edge" property instead.</description>
- </key>
- <key name="relative-to-edge" enum="org.mate.panel.PanelObjectEdgeRelativity">
- <default>'start'</default>
- <summary>Whether to interpret the value of the "position" key relative to the start, center or end of the panel</summary>
- <description>The position of the object is interpreted relative to one edge of the panel. The value of this key determines whether the object is positioned relative to the start (left/top edge), center, or end (right/bottom edge) of the panel. Valid values for this key are 'start', 'center', and 'end'.</description>
+ <summary>Interpret position relative to bottom/right edge</summary>
+ <description>If true, the position of the object is interpreted relative to the right (or bottom if vertical) edge of the panel.</description>
</key>
<key name="locked" type="b">
<default>false</default>
diff --git a/data/ubuntu.layout b/data/ubuntu.layout
index 99317ae4..bab5164f 100644
--- a/data/ubuntu.layout
+++ b/data/ubuntu.layout
@@ -26,23 +26,23 @@ menu-path=applications:/
object-type=applet
applet-iid=NotificationAreaAppletFactory::NotificationArea
toplevel-id=top
-position=20
-relative-to-edge=end
+position=30
+panel-right-stick=true
locked=true
[Object clock]
object-type=applet
applet-iid=ClockAppletFactory::ClockApplet
toplevel-id=top
-position=10
-relative-to-edge=end
+position=20
+panel-right-stick=true
locked=true
[Object shutdown]
action-type=shutdown
object-type=action
-position=0
-relative-to-edge=end
+position=10
+panel-right-stick=true
toplevel-id=top
locked=true
@@ -65,7 +65,7 @@ object-type=applet
applet-iid=WnckletFactory::WorkspaceSwitcherApplet
toplevel-id=bottom
position=10
-relative-to-edge=end
+panel-right-stick=true
locked=true
[Object trashapplet]
@@ -74,4 +74,4 @@ position=0
toplevel-id=bottom
applet-iid=TrashAppletFactory::TrashApplet
object-type=applet
-relative-to-edge=end
+panel-right-stick=true
diff --git a/mate-panel/applet.c b/mate-panel/applet.c
index 4da1a297..c41f9d85 100644
--- a/mate-panel/applet.c
+++ b/mate-panel/applet.c
@@ -764,12 +764,12 @@ mate_panel_applet_destroy (GtkWidget *widget,
}
typedef struct {
- char *id;
- PanelObjectType type;
- char *toplevel_id;
- int position;
- PanelObjectEdgeRelativity edge_relativity;
- guint locked : 1;
+ char *id;
+ PanelObjectType type;
+ char *toplevel_id;
+ int position;
+ guint right_stick : 1;
+ guint locked : 1;
} MatePanelAppletToLoad;
/* Each time those lists get both empty,
@@ -892,14 +892,9 @@ mate_panel_applet_load_idle_handler (gpointer dummy)
panel_widget = panel_toplevel_get_panel_widget (toplevel);
- if (applet->edge_relativity == PANEL_EDGE_CENTER ||
- applet->edge_relativity == PANEL_EDGE_END) {
- if (!panel_widget->packed) {
- if (applet->edge_relativity == PANEL_EDGE_CENTER)
- applet->position = panel_widget->size/2 + applet->position;
- else if (applet->edge_relativity == PANEL_EDGE_END)
- applet->position = panel_widget->size - applet->position;
- }
+ if (applet->right_stick) {
+ if (!panel_widget->packed)
+ applet->position = panel_widget->size - applet->position;
else
applet->position = -1;
}
@@ -974,12 +969,12 @@ mate_panel_applet_load_idle_handler (gpointer dummy)
}
void
-mate_panel_applet_queue_applet_to_load (const char *id,
- PanelObjectType type,
- const char *toplevel_id,
- int position,
- PanelObjectEdgeRelativity edge_relativity,
- gboolean locked)
+mate_panel_applet_queue_applet_to_load (const char *id,
+ PanelObjectType type,
+ const char *toplevel_id,
+ int position,
+ gboolean right_stick,
+ gboolean locked)
{
MatePanelAppletToLoad *applet;
@@ -990,12 +985,12 @@ mate_panel_applet_queue_applet_to_load (const char *id,
applet = g_new0 (MatePanelAppletToLoad, 1);
- applet->id = g_strdup (id);
- applet->type = type;
- applet->toplevel_id = g_strdup (toplevel_id);
- applet->position = position;
- applet->edge_relativity = edge_relativity;
- applet->locked = locked != FALSE;
+ applet->id = g_strdup (id);
+ applet->type = type;
+ applet->toplevel_id = g_strdup (toplevel_id);
+ applet->position = position;
+ applet->right_stick = right_stick != FALSE;
+ applet->locked = locked != FALSE;
mate_panel_applets_to_load = g_slist_prepend (mate_panel_applets_to_load, applet);
}
@@ -1008,8 +1003,8 @@ mate_panel_applet_compare (const MatePanelAppletToLoad *a,
if ((c = strcmp (a->toplevel_id, b->toplevel_id)))
return c;
- else if (a->edge_relativity != b->edge_relativity)
- return a->edge_relativity - b->edge_relativity;
+ else if (a->right_stick != b->right_stick)
+ return b->right_stick ? -1 : 1;
else
return a->position - b->position;
}
@@ -1090,12 +1085,12 @@ mate_panel_applet_save_position (AppletInfo *applet_info,
const char *id,
gboolean immediate)
{
- PanelWidget *panel_widget;
- const char *toplevel_id;
- char *old_toplevel_id;
- PanelObjectEdgeRelativity edge_relativity;
- gboolean locked;
- int position;
+ PanelWidget *panel_widget;
+ const char *toplevel_id;
+ char *old_toplevel_id;
+ gboolean right_stick;
+ gboolean locked;
+ int position;
g_return_if_fail (applet_info != NULL);
@@ -1127,7 +1122,7 @@ mate_panel_applet_save_position (AppletInfo *applet_info,
g_free (old_toplevel_id);
/* Note: changing some properties of the panel that may not be locked down
- (e.g. background) can change the state of the "relative-to-edge" and
+ (e.g. background) can change the state of the "panel_right_stick" and
"position" properties of an applet that may in fact be locked down.
So check if these are writable before attempting to write them */
@@ -1138,32 +1133,18 @@ mate_panel_applet_save_position (AppletInfo *applet_info,
if (locked) {
/* Until position calculations are refactored to fix the issue of the panel applets
getting reordered on resolution changes...
- .. don't save position/relative-to-edge on locked applets */
+ .. don't save position/right-stick on locked applets */
return;
}
- edge_relativity = panel_determine_applet_edge_relativity (applet_info->widget);
- if (g_settings_is_writable (applet_info->settings, PANEL_OBJECT_RELATIVE_TO_EDGE_KEY) &&
- g_settings_get_enum (applet_info->settings, PANEL_OBJECT_RELATIVE_TO_EDGE_KEY) != edge_relativity)
- g_settings_set_enum (applet_info->settings, PANEL_OBJECT_RELATIVE_TO_EDGE_KEY, edge_relativity);
-
- /*
- * If the deprecated `panel-right-stick` setting is set, unset it.
- * See the `panel_profile_load_object ()` function in the file
- * `panel-profile.c` for a lengthy comment detailing why this is
- * done.
- */
+ right_stick = panel_is_applet_right_stick (applet_info->widget) ? 1 : 0;
if (g_settings_is_writable (applet_info->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY) &&
- g_settings_get_boolean (applet_info->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY))
- g_settings_set_boolean (applet_info->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY, FALSE);
+ (g_settings_get_boolean (applet_info->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY) ? 1 : 0) != right_stick)
+ g_settings_set_boolean (applet_info->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY, right_stick);
position = mate_panel_applet_get_position (applet_info);
- if (!panel_widget->packed) {
- if (edge_relativity == PANEL_EDGE_CENTER)
- position -= panel_widget->size/2;
- else if (edge_relativity == PANEL_EDGE_END)
- position = panel_widget->size - position;
- }
+ if (right_stick && !panel_widget->packed)
+ position = panel_widget->size - position;
if (g_settings_is_writable (applet_info->settings, PANEL_OBJECT_POSITION_KEY) &&
g_settings_get_int (applet_info->settings, PANEL_OBJECT_POSITION_KEY) != position)
@@ -1380,7 +1361,7 @@ mate_panel_applet_can_freely_move (AppletInfo *applet)
if (!g_settings_is_writable (applet->settings, PANEL_OBJECT_TOPLEVEL_ID_KEY))
return FALSE;
- if (!g_settings_is_writable (applet->settings, PANEL_OBJECT_RELATIVE_TO_EDGE_KEY))
+ if (!g_settings_is_writable (applet->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY))
return FALSE;
return TRUE;
diff --git a/mate-panel/applet.h b/mate-panel/applet.h
index f394a4e9..b7b3603b 100644
--- a/mate-panel/applet.h
+++ b/mate-panel/applet.h
@@ -67,12 +67,12 @@ GSList *mate_panel_applet_list_applets (void);
void mate_panel_applet_clean (AppletInfo *info);
-void mate_panel_applet_queue_applet_to_load (const char *id,
- PanelObjectType type,
- const char *toplevel_id,
- int position,
- PanelObjectEdgeRelativity edge_relativity,
- gboolean locked);
+void mate_panel_applet_queue_applet_to_load (const char *id,
+ PanelObjectType type,
+ const char *toplevel_id,
+ int position,
+ gboolean right_stick,
+ gboolean locked);
void mate_panel_applet_load_queued_applets (gboolean initial_load);
gboolean mate_panel_applet_on_load_queue (const char *id);
@@ -94,7 +94,7 @@ void mate_panel_applet_save_position (AppletInfo *applet_info,
int mate_panel_applet_get_position (AppletInfo *applet);
/* True if all the keys relevant to moving are writable
- (position, toplevel-id, relative-to-edge) */
+ (position, toplevel_id, panel_right_stick) */
gboolean mate_panel_applet_can_freely_move (AppletInfo *applet);
/* True if the locked flag is writable */
diff --git a/mate-panel/drawer.c b/mate-panel/drawer.c
index 09634664..03d6bd5f 100644
--- a/mate-panel/drawer.c
+++ b/mate-panel/drawer.c
@@ -622,7 +622,7 @@ panel_drawer_create (PanelToplevel *toplevel,
{
char *id;
- id = panel_profile_prepare_object (PANEL_OBJECT_DRAWER, toplevel, position);
+ id = panel_profile_prepare_object (PANEL_OBJECT_DRAWER, toplevel, position, FALSE);
panel_drawer_prepare (id, custom_icon, use_custom_icon, tooltip, NULL);
@@ -641,7 +641,7 @@ panel_drawer_create_with_id (const char *toplevel_id,
char *id;
char *attached_toplevel_id = NULL;
- id = panel_profile_prepare_object_with_id (PANEL_OBJECT_DRAWER, toplevel_id, position);
+ id = panel_profile_prepare_object_with_id (PANEL_OBJECT_DRAWER, toplevel_id, position, FALSE);
panel_drawer_prepare (id, custom_icon, use_custom_icon, tooltip, &attached_toplevel_id);
diff --git a/mate-panel/launcher.c b/mate-panel/launcher.c
index 352968d2..0385ccea 100644
--- a/mate-panel/launcher.c
+++ b/mate-panel/launcher.c
@@ -1093,7 +1093,8 @@ panel_launcher_create_with_id (const char *toplevel_id,
id = panel_profile_prepare_object_with_id (PANEL_OBJECT_LAUNCHER,
toplevel_id,
- position);
+ position,
+ FALSE);
path = g_strdup_printf ("%s%s/", PANEL_OBJECT_PATH, id);
settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
diff --git a/mate-panel/panel-action-button.c b/mate-panel/panel-action-button.c
index d56280a4..6fad288f 100644
--- a/mate-panel/panel-action-button.c
+++ b/mate-panel/panel-action-button.c
@@ -940,7 +940,7 @@ panel_action_button_create (PanelToplevel *toplevel,
char *id;
char *path;
- id = panel_profile_prepare_object (PANEL_OBJECT_ACTION, toplevel, position);
+ id = panel_profile_prepare_object (PANEL_OBJECT_ACTION, toplevel, position, FALSE);
path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
diff --git a/mate-panel/panel-applet-frame.c b/mate-panel/panel-applet-frame.c
index 2d98e5ed..2b0e4b7f 100644
--- a/mate-panel/panel-applet-frame.c
+++ b/mate-panel/panel-applet-frame.c
@@ -1070,7 +1070,7 @@ mate_panel_applet_frame_create (PanelToplevel *toplevel,
g_return_if_fail (iid != NULL);
- id = panel_profile_prepare_object (PANEL_OBJECT_APPLET, toplevel, position);
+ id = panel_profile_prepare_object (PANEL_OBJECT_APPLET, toplevel, position, FALSE);
path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
diff --git a/mate-panel/panel-enums-gsettings.h b/mate-panel/panel-enums-gsettings.h
index 89e8f7e1..bc8a9c42 100644
--- a/mate-panel/panel-enums-gsettings.h
+++ b/mate-panel/panel-enums-gsettings.h
@@ -61,12 +61,6 @@ typedef enum {
} PanelObjectType;
typedef enum {
- PANEL_EDGE_START = 0,
- PANEL_EDGE_CENTER = 1,
- PANEL_EDGE_END = 2
-} PanelObjectEdgeRelativity;
-
-typedef enum {
PANEL_ACTION_NONE = 0,
PANEL_ACTION_LOCK,
PANEL_ACTION_LOGOUT,
diff --git a/mate-panel/panel-layout.c b/mate-panel/panel-layout.c
index 127b06fd..d1710f9e 100644
--- a/mate-panel/panel-layout.c
+++ b/mate-panel/panel-layout.c
@@ -77,7 +77,6 @@ static PanelLayoutKeyDefinition panel_layout_object_keys[] = {
{ PANEL_OBJECT_TOPLEVEL_ID_KEY, G_TYPE_STRING },
{ PANEL_OBJECT_POSITION_KEY, G_TYPE_INT },
{ PANEL_OBJECT_PANEL_RIGHT_STICK_KEY, G_TYPE_BOOLEAN },
- { PANEL_OBJECT_RELATIVE_TO_EDGE_KEY, G_TYPE_STRING },
{ PANEL_OBJECT_LOCKED_KEY, G_TYPE_BOOLEAN },
{ PANEL_OBJECT_APPLET_IID_KEY, G_TYPE_STRING },
{ PANEL_OBJECT_ATTACHED_TOPLEVEL_ID_KEY, G_TYPE_STRING },
diff --git a/mate-panel/panel-menu-bar.c b/mate-panel/panel-menu-bar.c
index fa35d57f..b348ae48 100644
--- a/mate-panel/panel-menu-bar.c
+++ b/mate-panel/panel-menu-bar.c
@@ -381,7 +381,7 @@ void panel_menu_bar_create(PanelToplevel* toplevel, int position)
{
char* id;
- id = panel_profile_prepare_object(PANEL_OBJECT_MENU_BAR, toplevel, position);
+ id = panel_profile_prepare_object(PANEL_OBJECT_MENU_BAR, toplevel, position, FALSE);
panel_profile_add_to_list(PANEL_GSETTINGS_OBJECTS, id);
g_free(id);
}
diff --git a/mate-panel/panel-menu-button.c b/mate-panel/panel-menu-button.c
index 793425b7..92925fd8 100644
--- a/mate-panel/panel-menu-button.c
+++ b/mate-panel/panel-menu-button.c
@@ -967,7 +967,7 @@ panel_menu_button_create (PanelToplevel *toplevel,
const char *scheme;
char *id;
- id = panel_profile_prepare_object (PANEL_OBJECT_MENU, toplevel, position);
+ id = panel_profile_prepare_object (PANEL_OBJECT_MENU, toplevel, position, FALSE);
path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c
index 47d6d95b..5f1013f1 100644
--- a/mate-panel/panel-profile.c
+++ b/mate-panel/panel-profile.c
@@ -1229,9 +1229,10 @@ panel_profile_destroy_toplevel (const char *id)
}
char *
-panel_profile_prepare_object_with_id (PanelObjectType object_type,
- const char *toplevel_id,
- int position)
+panel_profile_prepare_object_with_id (PanelObjectType object_type,
+ const char *toplevel_id,
+ int position,
+ gboolean right_stick)
{
PanelGSettingsKeyType key_type;
char *id;
@@ -1248,6 +1249,7 @@ panel_profile_prepare_object_with_id (PanelObjectType object_type,
g_settings_set_enum (settings, PANEL_OBJECT_TYPE_KEY, object_type);
g_settings_set_string (settings, PANEL_OBJECT_TOPLEVEL_ID_KEY, toplevel_id);
g_settings_set_int (settings, PANEL_OBJECT_POSITION_KEY, position);
+ g_settings_set_boolean (settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY, right_stick);
/* Force writing the settings in order to reserve the object ID *now*,
* so that a later call to panel_profile_find_new_id() won't find the same
@@ -1261,13 +1263,15 @@ panel_profile_prepare_object_with_id (PanelObjectType object_type,
}
char *
-panel_profile_prepare_object (PanelObjectType object_type,
- PanelToplevel *toplevel,
- int position)
+panel_profile_prepare_object (PanelObjectType object_type,
+ PanelToplevel *toplevel,
+ int position,
+ gboolean right_stick)
{
return panel_profile_prepare_object_with_id (object_type,
panel_profile_get_toplevel_id (toplevel),
- position);
+ position,
+ right_stick);
}
void
@@ -1285,13 +1289,13 @@ panel_profile_delete_object (AppletInfo *applet_info)
static void
panel_profile_load_object (char *id)
{
- PanelObjectType object_type;
- char *object_path;
- char *toplevel_id;
- int position;
- PanelObjectEdgeRelativity edge_relativity;
- gboolean locked;
- GSettings *settings;
+ PanelObjectType object_type;
+ char *object_path;
+ char *toplevel_id;
+ int position;
+ gboolean right_stick;
+ gboolean locked;
+ GSettings *settings;
object_path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, object_path);
@@ -1299,53 +1303,14 @@ panel_profile_load_object (char *id)
object_type = g_settings_get_enum (settings, PANEL_OBJECT_TYPE_KEY);
position = g_settings_get_int (settings, PANEL_OBJECT_POSITION_KEY);
toplevel_id = g_settings_get_string (settings, PANEL_OBJECT_TOPLEVEL_ID_KEY);
- edge_relativity = g_settings_get_enum (settings, PANEL_OBJECT_RELATIVE_TO_EDGE_KEY);
+ right_stick = g_settings_get_boolean (settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY);
locked = g_settings_get_boolean (settings, PANEL_OBJECT_LOCKED_KEY);
- /* If a panel layout uses the deprecated 'panel-right-stick' property,
- * interpret the position of the applet relative to the applet's left
- * side, rather than its right like we'd do for end-relative objects.
- * The position of an end-relative applet is relative to the *right*
- * side of the applet, which makes more sense, IMHO. The difference
- * between these two positioning schemes is on the order of the width
- * of the applet; without this backwards-compatible safeguard, many of
- * the user's manually-placed right-stuck applets may be moved far out
- * of place when they upgrade the panel to this version.
- *
- * The `panel-right-stick` property will, unfortunately, remain set,
- * unless and until the user explicitly moves the applet under the new
- * version of the panel. Keeping the `panel-right-stick` property set
- * is necessary since we can't know the equivalent 'edge-relative'
- * position to use in the place of the old, 'right-stuck' position;
- * after all, we have no idea of the size of the applet when it was
- * first positioned on the panel. (Some applets dynamically change
- * size; sure, chances are right-stuck applets will be forced /
- * constrained to the very far right side of the panel, but who knows,
- * somebody might have set the positions of their applets using a
- * layout file or directly via GSettings.)
- *
- * If the user moves the applets, of course, the applets will be
- * repositioned edge-relatively, which is good -- unless the user ever
- * downgrades the panel, in which case the applets will be in the wrong
- * places. However, there's a limit to what you can do -- hopefully
- * the user will only downgrade the panel if they know what they are
- * doing, and the user will have a completely screwed-up panel if they
- * *center*-stuck applets and then downgraded. So the point of this
- * hack is to ensure the user experiences a seamless (or nearly
- * seamless) transition forward, but if the user moves backward a few
- * versions, then we really can't help them.
- */
- if (g_settings_get_boolean (settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY)) {
- edge_relativity = PANEL_EDGE_END;
- g_settings_set_enum (settings, PANEL_OBJECT_RELATIVE_TO_EDGE_KEY, edge_relativity);
- }
-
-
mate_panel_applet_queue_applet_to_load (id,
object_type,
toplevel_id,
position,
- edge_relativity,
+ right_stick,
locked);
g_free (toplevel_id);
diff --git a/mate-panel/panel-profile.h b/mate-panel/panel-profile.h
index 929f6a14..36d4f217 100644
--- a/mate-panel/panel-profile.h
+++ b/mate-panel/panel-profile.h
@@ -50,21 +50,23 @@ gboolean panel_profile_is_writable_show_program_list (void);
gboolean panel_profile_get_enable_program_list (void);
gboolean panel_profile_get_enable_autocompletion (void);
-void panel_profile_add_to_list (PanelGSettingsKeyType type,
- const char *id);
-void panel_profile_remove_from_list (PanelGSettingsKeyType type,
- const char *id);
+void panel_profile_add_to_list (PanelGSettingsKeyType type,
+ const char *id);
+void panel_profile_remove_from_list (PanelGSettingsKeyType type,
+ const char *id);
gboolean panel_profile_id_lists_are_writable (void);
-void panel_profile_create_toplevel (GdkScreen *screen);
-PanelToplevel *panel_profile_load_toplevel (const char *toplevel_id);
-void panel_profile_delete_toplevel (PanelToplevel *toplevel);
-char *panel_profile_prepare_object (PanelObjectType object_type,
- PanelToplevel *toplevel,
- int position);
-char *panel_profile_prepare_object_with_id (PanelObjectType object_type,
- const char *toplevel_id,
- int position);
-void panel_profile_delete_object (AppletInfo *applet_info);
+void panel_profile_create_toplevel (GdkScreen *screen);
+PanelToplevel *panel_profile_load_toplevel (const char *toplevel_id);
+void panel_profile_delete_toplevel (PanelToplevel *toplevel);
+char *panel_profile_prepare_object (PanelObjectType object_type,
+ PanelToplevel *toplevel,
+ int position,
+ gboolean right_stick);
+char *panel_profile_prepare_object_with_id (PanelObjectType object_type,
+ const char *toplevel_id,
+ int position,
+ gboolean right_stick);
+void panel_profile_delete_object (AppletInfo *applet_info);
gboolean panel_profile_key_is_writable (PanelToplevel *toplevel,
gchar *key);
diff --git a/mate-panel/panel-schemas.h b/mate-panel/panel-schemas.h
index 18f7e968..1b787288 100644
--- a/mate-panel/panel-schemas.h
+++ b/mate-panel/panel-schemas.h
@@ -47,7 +47,6 @@
#define PANEL_OBJECT_TOPLEVEL_ID_KEY "toplevel-id"
#define PANEL_OBJECT_POSITION_KEY "position"
#define PANEL_OBJECT_PANEL_RIGHT_STICK_KEY "panel-right-stick"
-#define PANEL_OBJECT_RELATIVE_TO_EDGE_KEY "relative-to-edge"
#define PANEL_OBJECT_LOCKED_KEY "locked"
#define PANEL_OBJECT_APPLET_IID_KEY "applet-iid"
#define PANEL_OBJECT_ATTACHED_TOPLEVEL_ID_KEY "attached-toplevel-id"
diff --git a/mate-panel/panel-separator.c b/mate-panel/panel-separator.c
index 0dd8e894..864d3107 100644
--- a/mate-panel/panel-separator.c
+++ b/mate-panel/panel-separator.c
@@ -263,7 +263,7 @@ panel_separator_create (PanelToplevel *toplevel,
char *id;
id = panel_profile_prepare_object (PANEL_OBJECT_SEPARATOR,
- toplevel, position);
+ toplevel, position, FALSE);
panel_profile_add_to_list (PANEL_GSETTINGS_OBJECTS, id);
g_free (id);
}
diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c
index 85779b15..2eb6e77a 100644
--- a/mate-panel/panel-toplevel.c
+++ b/mate-panel/panel-toplevel.c
@@ -2898,8 +2898,8 @@ panel_toplevel_move_resize_window (PanelToplevel *toplevel,
{
GtkWidget *widget;
-/* GList *list;
- PanelObjectEdgeRelativity edge_relativity;*/
+ GList *list;
+ gboolean stick;
widget = GTK_WIDGET (toplevel);
@@ -2919,6 +2919,30 @@ panel_toplevel_move_resize_window (PanelToplevel *toplevel,
gdk_window_resize (gtk_widget_get_window (widget),
toplevel->priv->geometry.width,
toplevel->priv->geometry.height);
+
+ if (resize || move) {
+ for (list = toplevel->priv->panel_widget->applet_list; list != NULL; list = g_list_next (list)) {
+ AppletData *ad = list->data;
+ const char *id = mate_panel_applet_get_id_by_widget (ad->applet);
+
+ if (!id)
+ return;
+
+ AppletInfo *info;
+ info = mate_panel_applet_get_by_id (id);
+
+ stick = g_settings_get_boolean (info->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY);
+
+ if (stick) {
+ int position = g_settings_get_int (info->settings, PANEL_OBJECT_POSITION_KEY);
+ if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK) {
+ ad->pos = toplevel->priv->geometry.width - position;
+ } else {
+ ad->pos = toplevel->priv->geometry.height - position;
+ }
+ }
+ }
+ }
}
static void
diff --git a/mate-panel/panel-widget.c b/mate-panel/panel-widget.c
index 822b8100..a8c01854 100644
--- a/mate-panel/panel-widget.c
+++ b/mate-panel/panel-widget.c
@@ -30,11 +30,8 @@
#include "panel-globals.h"
#include "panel-profile.h"
#include "panel-lockdown.h"
-#include "panel-schemas.h"
-#define MOVE_INCREMENT 1
-/* The following was originally from panel-toplevel.c */
-#define SNAP_TOLERANCE_FACTOR 6
+#define MOVE_INCREMENT 1
typedef enum {
PANEL_SWITCH_MOVE = 0,
@@ -626,92 +623,36 @@ get_applet_list_pos (PanelWidget *panel,
return NULL;
}
-/*
- * This function determines whether the given panel applet should be positioned
- * relative to the center or end of the panel; that is, whether the applet
- * is part of a contiguous group of other applets, one of which touches the
- * center or end of the panel.
- */
-PanelObjectEdgeRelativity
-panel_widget_determine_applet_edge_relativity (PanelWidget *panel_widget,
- GtkWidget *widget)
+/*tells us if an applet is "stuck" on the right side*/
+int
+panel_widget_is_applet_stuck (PanelWidget *panel_widget,
+ GtkWidget *widget)
{
- AppletData *applet_in_question;
- gboolean applet_is_centered = FALSE;
+ AppletData *applet;
- g_return_val_if_fail (PANEL_IS_WIDGET (panel_widget), PANEL_EDGE_START);
- g_return_val_if_fail (GTK_IS_WIDGET (widget), PANEL_EDGE_START);
+ g_return_val_if_fail (PANEL_IS_WIDGET (panel_widget), FALSE);
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
- applet_in_question = g_object_get_data (G_OBJECT (widget), MATE_PANEL_APPLET_DATA);
- if (applet_in_question) {
- GList *applet_list, *l;
- AppletData *applet;
- int start_pos, end_pos;
+ applet = g_object_get_data (G_OBJECT (widget), MATE_PANEL_APPLET_DATA);
+ if (applet) {
+ GList *applet_list, *l;
+ int end_pos = -1;
- applet_list = g_list_find (panel_widget->applet_list, applet_in_question);
- start_pos = applet_in_question->pos + applet_in_question->cells;
- end_pos = applet_in_question->pos;
+ applet_list = g_list_find (panel_widget->applet_list, applet);
- /*
- * Start by moving towards the start of the panel, checking
- * whether any applets lie on the panel's center.
- */
- for (l = applet_list; l; l = l->prev)
- {
+ for (l = applet_list; l; l = l->next) {
applet = l->data;
- if (applet->pos + applet->cells < end_pos)
+ if (end_pos != -1 && applet->pos != end_pos)
break;
- if (applet->pos <= panel_widget->size/2 &&
- applet->pos + applet->cells > panel_widget->size/2)
- applet_is_centered = TRUE;
-
- end_pos -= applet->cells;
- if (end_pos <= 0)
- /*
- * If the applet in question is part of a line
- * of contiguous applets, the first of which
- * touches the start of the panel, then don't
- * center this applet under any circumstances.
- */
- return PANEL_EDGE_START;
- }
-
- if (applet_is_centered)
- return PANEL_EDGE_CENTER;
-
- /*
- * Now move towards the panel's end, looking for applets that
- * cross the center of the panel.
- */
- for (l = applet_list; l; l = l->next)
- {
- applet = l->data;
-
- if (applet->pos > start_pos)
- break;
-
- if (applet->pos <= panel_widget->size/2 &&
- applet->pos + applet->cells > panel_widget->size/2)
- applet_is_centered = TRUE;
-
- start_pos += applet->cells;
- if (start_pos >= panel_widget->size)
- /*
- * If the applet in question is part of a line
- * of contiguous applets, the last of which
- * touches the end of the panel, then the
- * applet is actually end-relative.
- */
- return PANEL_EDGE_END;
+ end_pos = applet->pos + applet->cells;
+ if (end_pos >= panel_widget->size)
+ return TRUE;
}
}
- if (applet_is_centered)
- return PANEL_EDGE_CENTER;
- else
- return PANEL_EDGE_START;
+ return FALSE;
}
static int
@@ -735,24 +676,6 @@ get_size_from_hints (AppletData *ad, int cells)
return MAX (cells, ad->min_cells);
}
-/*
- * A utility function to adjust an applet's position by its allocated size,
- * if the applet is end-relative or centered.
- */
-static void
-adjust_applet_position (PanelWidget *panel,
- AppletData *ad)
-{
- PanelObjectEdgeRelativity edge_relativity;
-
- edge_relativity = panel_widget_determine_applet_edge_relativity (panel, ad->applet);
-
- if (edge_relativity == PANEL_EDGE_CENTER)
- ad->pos += ad->cells/2;
- else if (edge_relativity == PANEL_EDGE_END)
- ad->pos += ad->cells;
-}
-
static void
panel_widget_jump_applet_right (PanelWidget *panel,
GList *list,
@@ -782,7 +705,6 @@ panel_widget_jump_applet_right (PanelWidget *panel,
jump_right:
ad->pos = ad->constrained = pos;
- adjust_applet_position (panel, ad);
panel->applet_list = g_list_remove_link (panel->applet_list, list);
panel->applet_list = panel_g_list_insert_before (panel->applet_list, next, list);
gtk_widget_queue_resize (GTK_WIDGET (panel));
@@ -807,7 +729,6 @@ panel_widget_switch_applet_right (PanelWidget *panel,
if (!nad || nad->constrained >= ad->constrained + ad->min_cells + MOVE_INCREMENT) {
ad->pos = ad->constrained += MOVE_INCREMENT;
- adjust_applet_position (panel, ad);
gtk_widget_queue_resize (GTK_WIDGET (panel));
emit_applet_moved (panel, ad);
return;
@@ -823,8 +744,6 @@ panel_widget_switch_applet_right (PanelWidget *panel,
nad->constrained = nad->pos = ad->constrained;
ad->constrained = ad->pos = ad->constrained + nad->min_cells;
- adjust_applet_position (panel, nad);
- adjust_applet_position (panel, ad);
panel->applet_list = panel_g_list_swap_next (panel->applet_list, list);
gtk_widget_queue_resize (GTK_WIDGET (panel));
@@ -862,7 +781,6 @@ panel_widget_jump_applet_left (PanelWidget *panel,
jump_left:
ad->pos = ad->constrained = pos;
- adjust_applet_position (panel, ad);
panel->applet_list = g_list_remove_link (panel->applet_list, list);
panel->applet_list = panel_g_list_insert_after (panel->applet_list, prev, list);
gtk_widget_queue_resize (GTK_WIDGET (panel));
@@ -885,7 +803,6 @@ panel_widget_switch_applet_left (PanelWidget *panel,
if (!pad || pad->constrained + pad->min_cells <= ad->constrained - MOVE_INCREMENT) {
ad->pos = ad->constrained -= MOVE_INCREMENT;
- adjust_applet_position (panel, ad);
gtk_widget_queue_resize (GTK_WIDGET (panel));
emit_applet_moved (panel, ad);
return;
@@ -901,8 +818,6 @@ panel_widget_switch_applet_left (PanelWidget *panel,
ad->constrained = ad->pos = pad->constrained;
pad->constrained = pad->pos = ad->constrained + ad->min_cells;
- adjust_applet_position (panel, ad);
- adjust_applet_position (panel, pad);
panel->applet_list = panel_g_list_swap_prev (panel->applet_list, list);
gtk_widget_queue_resize (GTK_WIDGET (panel));
@@ -1145,7 +1060,6 @@ panel_widget_push_applet_right (PanelWidget *panel,
if (!nad || nad->constrained >= ad->constrained + ad->min_cells + push) {
ad->pos = ad->constrained += push;
- adjust_applet_position (panel, ad);
gtk_widget_queue_resize (GTK_WIDGET (panel));
emit_applet_moved (panel, ad);
return TRUE;
@@ -1157,7 +1071,6 @@ panel_widget_push_applet_right (PanelWidget *panel,
return FALSE;
ad->pos = ad->constrained += push;;
- adjust_applet_position (panel, ad);
gtk_widget_queue_resize (GTK_WIDGET (panel));
emit_applet_moved (panel, ad);
@@ -1186,7 +1099,6 @@ panel_widget_push_applet_left (PanelWidget *panel,
if (!pad || pad->constrained + pad->min_cells <= ad->constrained - push) {
ad->pos = ad->constrained -= push;
- adjust_applet_position (panel, ad);
gtk_widget_queue_resize (GTK_WIDGET (panel));
emit_applet_moved (panel, ad);
return TRUE;
@@ -1198,7 +1110,6 @@ panel_widget_push_applet_left (PanelWidget *panel,
return FALSE;
ad->pos = ad->constrained -= push;
- adjust_applet_position (panel, ad);
gtk_widget_queue_resize (GTK_WIDGET (panel));
emit_applet_moved (panel, ad);
@@ -1241,6 +1152,46 @@ panel_widget_push_move (PanelWidget *panel,
}
}
+/*this is a special function and may fail if called improperly, it works
+only under special circumstance when we know there is nothing from
+old_size to panel->size*/
+static void
+panel_widget_right_stick(PanelWidget *panel,int old_size)
+{
+ int i,pos;
+ GList *list,*prev;
+ AppletData *ad;
+
+ g_return_if_fail(PANEL_IS_WIDGET(panel));
+ g_return_if_fail(old_size>=0);
+
+ if(old_size>=panel->size ||
+ panel->packed)
+ return;
+
+ list = get_applet_list_pos(panel,old_size-1);
+
+ if(!list)
+ return;
+
+ pos = panel->size-1;
+
+ ad = list->data;
+ do {
+ i = ad->pos;
+ ad->pos = ad->constrained = pos--;
+ ad->cells = 1;
+ prev = list;
+ list = g_list_previous(list);
+ if(!list)
+ break;
+ ad = list->data;
+ } while(ad->pos + ad->cells == i);
+
+ for (list = prev; list; list = list->next)
+ emit_applet_moved (panel, list->data);
+}
+
static void
panel_widget_get_preferred_size(GtkWidget *widget,
GtkRequisition *minimum_size,
@@ -1410,6 +1361,7 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
PanelWidget *panel;
GList *list;
int i;
+ int old_size;
gboolean ltr;
g_return_if_fail(PANEL_IS_WIDGET(widget));
@@ -1417,6 +1369,7 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
panel = PANEL_WIDGET(widget);
+ old_size = panel->size;
ltr = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR;
gtk_widget_set_allocation (widget, allocation);
@@ -1431,6 +1384,8 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
panel->size = allocation->width;
else
panel->size = allocation->height;
+ if(old_size<panel->size)
+ panel_widget_right_stick(panel,old_size);
if (panel->packed) {
/* we're assuming the order is the same as the one that was
@@ -1487,30 +1442,13 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
} else { /*not packed*/
- /*
- * First, recalculate the ideal position for each applet on the
- * panel, since the panel changed size, and the position of
- * end-relative and center-relative applets depends on the
- * exact size of the panel.
- *
- * However, if some applet uses a large amount of space on the
- * panel, it's possible that the ideal applet positions cannot
- * be attained, unless of course panel applets were to overlap.
- * Since we don't want any panel applets to overlap, shift any
- * following applets further over to the right as much as
- * necessary.
- */
-
+ /* First make sure there's enough room on the left */
i = 0;
- for (list = panel->applet_list; list; list = list->next)
- {
+ for (list = panel->applet_list;
+ list != NULL;
+ list = g_list_next (list)) {
AppletData *ad = list->data;
GtkRequisition chreq;
- const char *id;
- AppletInfo *info;
- int position = ad->pos;
- PanelObjectEdgeRelativity edge_relativity = PANEL_EDGE_START;
- gboolean right_stuck = FALSE;
gtk_widget_get_preferred_size (ad->applet, &chreq, NULL);
@@ -1526,96 +1464,10 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
ad->min_cells = ad->size_hints [ad->size_hints_len - 1];
}
- id = mate_panel_applet_get_id_by_widget (ad->applet);
- if (id)
- {
- info = mate_panel_applet_get_by_id (id);
- position = g_settings_get_int (info->settings,
- PANEL_OBJECT_POSITION_KEY);
- edge_relativity = g_settings_get_enum (info->settings,
- PANEL_OBJECT_RELATIVE_TO_EDGE_KEY);
- right_stuck = g_settings_get_boolean (info->settings,
- PANEL_OBJECT_PANEL_RIGHT_STICK_KEY);
- }
-
- /*
- * Do not attempt to re-position the applet if it is
- * currently being dragged or otherwise moved by the
- * user; otherwise, we'll immediately undo the user's
- * last move and thus thwart all the user's attempts
- * to move the applet!
- */
- if (ad != panel->currently_dragged_applet)
- {
- if (edge_relativity == PANEL_EDGE_CENTER)
- {
- ad->pos = panel->size/2 + position;
- ad->constrained = ad->pos - ad->cells/2;
- }
- else if (edge_relativity == PANEL_EDGE_END)
- {
- ad->pos = panel->size - position;
- /*
- * If the `panel-right-stick` property
- * is set on the applet, position the
- * left side of the applet relative to
- * the right side of the panel, not
- * the right side of the applet relative
- * to the right side of the panel like
- * we'd normally do. This is a hack for
- * better backward compatibility. See
- * the huge comment in the function
- * `panel_profile_load_object ()` in
- * the file `panel-profile.c` for much,
- * much more discussion of this hack.
- */
- if (right_stuck)
- ad->constrained = ad->pos;
- else
- ad->constrained = ad->pos - ad->cells;
- }
- else
- {
- ad->pos = position;
- ad->constrained = ad->pos;
- }
- }
-
- /*
- * Now if the previous applet uses too much room on the
- * panel to ideally fit this applet, move this applet
- * further over to the right to compensate.
- *
- * Centered applets are a somewhat different story.
- * If the current applet is centered, and the previous
- * applet is also centered and has a negative relative
- * position (so the previous applet is "left" of
- * center), move the *previous* applet over to the
- * *left* to compensate. This way, applets at dead
- * center will remain at or near dead center.
- */
+ ad->constrained = ad->pos;
if (ad->constrained < i)
- {
- AppletData *pad = NULL;
- PanelObjectEdgeRelativity previous_edge_relativity;
-
- previous_edge_relativity = PANEL_EDGE_START;
-
- if (list->prev)
- {
- pad = list->prev->data;
- previous_edge_relativity = panel_widget_determine_applet_edge_relativity (panel, pad->applet);
- }
-
- if (edge_relativity == PANEL_EDGE_CENTER &&
- pad &&
- previous_edge_relativity == PANEL_EDGE_CENTER &&
- pad->constrained + pad->cells/2 < panel->size/2)
- pad->constrained = ad->constrained - pad->cells;
- else
- ad->constrained = i;
- }
+ ad->constrained = i;
i = ad->constrained + ad->cells;
}
@@ -1902,20 +1754,12 @@ panel_widget_applet_drag_start_no_grab (PanelWidget *panel,
static void
panel_widget_applet_drag_end_no_grab (PanelWidget *panel)
{
- AppletInfo *info;
-
g_return_if_fail (panel != NULL);
g_return_if_fail (PANEL_IS_WIDGET (panel));
#ifdef PANEL_WIDGET_DEBUG
g_message("Ending drag\n");
#endif
-
- /* Immediately save the new position of the applet. */
- info = g_object_get_data (G_OBJECT (panel->currently_dragged_applet->applet), "applet_info");
- if (info)
- mate_panel_applet_save_position (info, info->id, TRUE);
-
panel->currently_dragged_applet = NULL;
mate_panel_applet_in_drag = FALSE;
@@ -2156,7 +2000,6 @@ panel_widget_nice_move (PanelWidget *panel,
return;
ad->pos = ad->constrained = pos;
- adjust_applet_position (panel, ad);
panel->applet_list =
panel_g_list_resort_item (panel->applet_list, ad,
@@ -2182,10 +2025,6 @@ panel_widget_applet_move_to_cursor (PanelWidget *panel)
GSList *forb;
GdkModifierType mods;
AppletData *ad;
- GtkSettings *settings;
- int drag_threshold;
- int absolute_moveby;
- int centered_applet_position;
g_return_if_fail(PANEL_IS_WIDGET(panel));
@@ -2254,51 +2093,16 @@ panel_widget_applet_move_to_cursor (PanelWidget *panel)
movement = PANEL_FREE_MOVE;
}
- moveby = panel_widget_get_moveby (panel, pos, ad->drag_off);
-
- /*
- * If the applet is currently positioned at the dead center of the
- * panel, or if the user moved the mouse across the center of the
- * panel (but not farther from the center than the drag-and-drop
- * threshold times a specific constant), make the applet "stick" to
- * the center of the panel until the user tries to drag the applet far
- * away from the center again. This way, the user can move an applet
- * to the center of the panel without needing superhuman muscle
- * control to get the applet perfectly centered.
- */
- settings = gtk_widget_get_settings (GTK_WIDGET (panel));
- g_object_get (G_OBJECT (settings),
- "gtk-dnd-drag-threshold", &drag_threshold,
- NULL);
-
- centered_applet_position = panel->size/2 - ad->cells/2;
-
- if ((moveby < 0 && pos > centered_applet_position &&
- pos+moveby <= centered_applet_position &&
- pos+moveby >= centered_applet_position - drag_threshold*SNAP_TOLERANCE_FACTOR) ||
- (moveby > 0 && pos < centered_applet_position &&
- pos+moveby >= centered_applet_position &&
- pos+moveby <= centered_applet_position + drag_threshold*SNAP_TOLERANCE_FACTOR))
- moveby = centered_applet_position - pos;
- else if (pos == centered_applet_position)
- {
- if (moveby < 0)
- absolute_moveby = -moveby;
- else
- absolute_moveby = moveby;
-
- if (absolute_moveby < drag_threshold*SNAP_TOLERANCE_FACTOR)
- return;
- }
-
switch (movement) {
case PANEL_SWITCH_MOVE:
+ moveby = panel_widget_get_moveby (panel, pos, ad->drag_off);
panel_widget_switch_move (panel, ad, moveby);
break;
case PANEL_FREE_MOVE:
panel_widget_nice_move (panel, ad, panel_widget_get_cursorloc (panel));
break;
case PANEL_PUSH_MOVE:
+ moveby = panel_widget_get_moveby (panel, pos, ad->drag_off);
panel_widget_push_move (panel, ad, moveby);
break;
}
@@ -2769,7 +2573,6 @@ panel_widget_reparent (PanelWidget *old_panel,
if (info && info->type == PANEL_OBJECT_APPLET)
mate_panel_applet_frame_set_panel (MATE_PANEL_APPLET_FRAME (ad->applet), new_panel);
- adjust_applet_position (new_panel, ad);
if (gtk_widget_get_can_focus (GTK_WIDGET (new_panel)))
gtk_widget_set_can_focus (GTK_WIDGET (new_panel), FALSE);
diff --git a/mate-panel/panel-widget.h b/mate-panel/panel-widget.h
index 8f2846dd..e5dc3da8 100644
--- a/mate-panel/panel-widget.h
+++ b/mate-panel/panel-widget.h
@@ -191,9 +191,9 @@ void panel_widget_draw_all (PanelWidget *panel,
void panel_widget_draw_icon (PanelWidget *panel,
ButtonWidget *applet);
-/*Tells us to which panel edge (start, center, end) the applet is relative*/
-PanelObjectEdgeRelativity panel_widget_determine_applet_edge_relativity (PanelWidget *panel,
- GtkWidget *applet);
+/*tells us if an applet is "stuck" on the right side*/
+int panel_widget_is_applet_stuck (PanelWidget *panel,
+ GtkWidget *applet);
/*get pos of the cursor location in panel coordinates*/
int panel_widget_get_cursorloc (PanelWidget *panel);
diff --git a/mate-panel/panel.c b/mate-panel/panel.c
index 89544246..e854cf73 100644
--- a/mate-panel/panel.c
+++ b/mate-panel/panel.c
@@ -1397,24 +1397,24 @@ panel_screen_from_panel_widget (PanelWidget *panel)
return gtk_window_get_screen (GTK_WINDOW (panel->toplevel));
}
-PanelObjectEdgeRelativity
-panel_determine_applet_edge_relativity (GtkWidget *applet)
+gboolean
+panel_is_applet_right_stick (GtkWidget *applet)
{
GtkWidget *parent;
PanelWidget *panel_widget;
- g_return_val_if_fail (GTK_IS_WIDGET (applet), PANEL_EDGE_START);
+ g_return_val_if_fail (GTK_IS_WIDGET (applet), FALSE);
parent = gtk_widget_get_parent (applet);
- g_return_val_if_fail (PANEL_IS_WIDGET (parent), PANEL_EDGE_START);
+ g_return_val_if_fail (PANEL_IS_WIDGET (parent), FALSE);
panel_widget = PANEL_WIDGET (parent);
if (!panel_toplevel_get_expand (panel_widget->toplevel))
- return PANEL_EDGE_START;
+ return FALSE;
- return panel_widget_determine_applet_edge_relativity (panel_widget, applet);
+ return panel_widget_is_applet_stuck (panel_widget, applet);
}
static void
diff --git a/mate-panel/panel.h b/mate-panel/panel.h
index 69bfb546..bf1517ec 100644
--- a/mate-panel/panel.h
+++ b/mate-panel/panel.h
@@ -26,7 +26,7 @@ PanelData *panel_setup (PanelToplevel *toplevel);
GdkScreen *panel_screen_from_panel_widget (PanelWidget *panel);
-PanelObjectEdgeRelativity panel_determine_applet_edge_relativity (GtkWidget *applet);
+gboolean panel_is_applet_right_stick (GtkWidget *applet);
gboolean panel_check_dnd_target_data (GtkWidget *widget,
GdkDragContext *context,