[gnome-panel/wip/packed-objects: 9/17] panel: Remove free-move mode for moving objects
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/packed-objects: 9/17] panel: Remove free-move mode for moving objects
- Date: Thu, 31 Mar 2011 07:00:09 +0000 (UTC)
commit 22f41fedab82c54c0601f17220ded608ebf770dd
Author: Vincent Untz <vuntz gnome org>
Date: Wed Mar 30 23:47:42 2011 +0530
panel: Remove free-move mode for moving objects
With the new packed model, free-move does not make any sense: we don't
want to move an object to an arbitrary spot; we're only interested in
switching/pushing to move an object from one pack to another pack
(switching if it's the first/last one, pushing which also push other
objects=, or inside a specific pack (switching).
gnome-panel/panel-widget.c | 188 --------------------------------------------
gnome-panel/panel-widget.h | 2 -
2 files changed, 0 insertions(+), 190 deletions(-)
---
diff --git a/gnome-panel/panel-widget.c b/gnome-panel/panel-widget.c
index 94aa482..5b94717 100644
--- a/gnome-panel/panel-widget.c
+++ b/gnome-panel/panel-widget.c
@@ -31,7 +31,6 @@
typedef enum {
PANEL_SWITCH_MOVE = 0,
- PANEL_FREE_MOVE,
PANEL_PUSH_MOVE
} PanelMovementType;
@@ -45,7 +44,6 @@ enum {
APPLET_REMOVED_SIGNAL,
PUSH_MOVE_SIGNAL,
SWITCH_MOVE_SIGNAL,
- FREE_MOVE_SIGNAL,
TAB_MOVE_SIGNAL,
END_MOVE_SIGNAL,
POPUP_PANEL_MENU_SIGNAL,
@@ -87,8 +85,6 @@ static void panel_widget_push_move_applet (PanelWidget *panel,
GtkDirectionType dir);
static void panel_widget_switch_move_applet (PanelWidget *panel,
GtkDirectionType dir);
-static void panel_widget_free_move_applet (PanelWidget *panel,
- GtkDirectionType dir);
static void panel_widget_tab_move (PanelWidget *panel,
gboolean next);
static void panel_widget_end_move (PanelWidget *panel);
@@ -174,8 +170,6 @@ add_all_move_bindings (PanelWidget *panel)
add_move_bindings (binding_set, GDK_SHIFT_MASK, "push_move");
add_move_bindings (binding_set, GDK_CONTROL_MASK, "switch_move");
- add_move_bindings (binding_set, GDK_MOD1_MASK, "free_move");
- add_move_bindings (binding_set, 0, "free_move");
add_tab_bindings (binding_set, 0, TRUE);
add_tab_bindings (binding_set, GDK_SHIFT_MASK, FALSE);
@@ -369,18 +363,6 @@ panel_widget_class_init (PanelWidgetClass *class)
1,
GTK_TYPE_DIRECTION_TYPE);
- panel_widget_signals[FREE_MOVE_SIGNAL] =
- g_signal_new ("free_move",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (PanelWidgetClass, free_move),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__ENUM,
- G_TYPE_NONE,
- 1,
- GTK_TYPE_DIRECTION_TYPE);
-
panel_widget_signals[TAB_MOVE_SIGNAL] =
g_signal_new ("tab_move",
G_TYPE_FROM_CLASS (class),
@@ -411,7 +393,6 @@ panel_widget_class_init (PanelWidgetClass *class)
class->applet_removed = NULL;
class->push_move = panel_widget_push_move_applet;
class->switch_move = panel_widget_switch_move_applet;
- class->free_move = panel_widget_free_move_applet;
class->tab_move = panel_widget_tab_move;
class->end_move = panel_widget_end_move;
@@ -1819,144 +1800,6 @@ panel_widget_get_moveby (PanelWidget *panel, int pos, int offset)
return panel_widget_get_cursorloc (panel) - offset - pos;
}
-static GList *
-walk_up_to (int pos, GList *list)
-{
- AppletData *ad;
-
- g_return_val_if_fail (list != NULL, NULL);
-
- ad = list->data;
-
- if (ad->constrained <= pos &&
- ad->constrained + ad->cells > pos)
- return list;
- while (list->next != NULL &&
- ad->constrained + ad->cells <= pos) {
- list = list->next;
- ad = list->data;
- }
- while (list->prev != NULL &&
- ad->constrained > pos) {
- list = list->prev;
- ad = list->data;
- }
- return list;
-}
-
-static GtkWidget *
-is_in_applet (int pos, AppletData *ad)
-{
- g_return_val_if_fail (ad != NULL, NULL);
-
- if (ad->constrained <= pos &&
- ad->constrained + ad->min_cells > pos)
- return ad->applet;
- return NULL;
-}
-
-static int
-panel_widget_get_free_spot (PanelWidget *panel,
- AppletData *ad,
- int place)
-{
- int i, e;
- int start;
- int right = -1, left = -1;
- GList *list;
-
- g_return_val_if_fail (PANEL_IS_WIDGET (panel), -1);
- g_return_val_if_fail (ad != NULL, -1);
-
- if (ad->constrained >= panel->size)
- return -1;
-
- if (panel->applet_list == NULL) {
- if (place + ad->min_cells > panel->size)
- return panel->size-ad->min_cells;
- else
- return place;
- }
-
- list = panel->applet_list;
-
- start = place - ad->drag_off;
- if (start < 0)
- start = 0;
- for (e = 0, i = start; i < panel->size; i++) {
- GtkWidget *applet;
- list = walk_up_to (i, list);
- applet = is_in_applet (i, list->data);
- if (applet == NULL ||
- applet == ad->applet) {
- e++;
- if (e >= ad->min_cells) {
- right = i - e + 1;
- break;
- }
- } else {
- e = 0;
- }
- }
-
- start = place + ad->drag_off;
- if (start >= panel->size)
- start = panel->size - 1;
- for (e = 0, i = start; i >= 0; i--) {
- GtkWidget *applet;
- list = walk_up_to (i, list);
- applet = is_in_applet (i, list->data);
- if (applet == NULL ||
- applet == ad->applet) {
- e++;
- if (e >= ad->min_cells) {
- left = i;
- break;
- }
- } else {
- e=0;
- }
- }
-
- start = place - ad->drag_off;
-
- if (left == -1) {
- if (right == -1)
- return -1;
- else
- return right;
- } else {
- if (right == -1)
- return left;
- else
- return abs (left - start) > abs (right - start) ?
- right : left;
- }
-}
-
-static void
-panel_widget_nice_move (PanelWidget *panel,
- AppletData *ad,
- int pos)
-{
- g_return_if_fail (PANEL_IS_WIDGET (panel));
- g_return_if_fail (ad != NULL);
-
- pos = panel_widget_get_free_spot (panel, ad, pos);
- if (pos < 0 || pos == ad->pos)
- return;
-
- ad->pos = ad->constrained = pos;
-
- panel->applet_list =
- panel_g_list_resort_item (panel->applet_list, ad,
- (GCompareFunc)applet_data_compare);
-
- gtk_widget_queue_resize (GTK_WIDGET (panel));
-
- emit_applet_moved (panel, ad);
-}
-
/* schedule to run the below function */
static void schedule_try_move (PanelWidget *panel, gboolean repeater);
@@ -2032,8 +1875,6 @@ panel_widget_applet_move_to_cursor (PanelWidget *panel)
movement = PANEL_SWITCH_MOVE;
else if (panel->dragged_state & GDK_SHIFT_MASK)
movement = PANEL_PUSH_MOVE;
- else if (panel->dragged_state & GDK_MOD1_MASK)
- movement = PANEL_FREE_MOVE;
}
switch (movement) {
@@ -2041,9 +1882,6 @@ panel_widget_applet_move_to_cursor (PanelWidget *panel)
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);
@@ -2631,32 +2469,6 @@ panel_widget_switch_move_applet (PanelWidget *panel,
}
}
-static void
-panel_widget_free_move_applet (PanelWidget *panel,
- GtkDirectionType dir)
-{
- AppletData *ad;
- gint increment = MOVE_INCREMENT;
-
- ad = panel->currently_dragged_applet;
-
- g_return_if_fail (ad);
-
- switch (dir) {
- case GTK_DIR_LEFT:
- case GTK_DIR_UP:
- increment = -increment;
- break;
- case GTK_DIR_RIGHT:
- case GTK_DIR_DOWN:
- break;
- default:
- return;
- }
-
- panel_widget_nice_move (panel, ad, increment + ad->constrained + ad->drag_off);
-}
-
static void
panel_widget_tab_move (PanelWidget *panel,
gboolean next)
diff --git a/gnome-panel/panel-widget.h b/gnome-panel/panel-widget.h
index 5bb9105..0c0308d 100644
--- a/gnome-panel/panel-widget.h
+++ b/gnome-panel/panel-widget.h
@@ -139,8 +139,6 @@ struct _PanelWidgetClass
GtkDirectionType dir);
void (* switch_move) (PanelWidget *panel,
GtkDirectionType dir);
- void (* free_move) (PanelWidget *panel,
- GtkDirectionType dir);
void (* tab_move) (PanelWidget *panel,
gboolean next);
void (* end_move) (PanelWidget *panel);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]