[gnome-panel] libpanel-util: remove panel-list.[c/h]



commit 683ccb2751c865447f912a5d84a6631c5eacdc2f
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Mar 7 21:04:47 2020 +0200

    libpanel-util: remove panel-list.[c/h]
    
    Move remaining functions to place where they are used.

 gnome-panel/libpanel-util/Makefile.am  |  2 -
 gnome-panel/libpanel-util/panel-list.c | 87 ----------------------------------
 gnome-panel/libpanel-util/panel-list.h | 37 ---------------
 gnome-panel/panel-widget.c             | 60 ++++++++++++++++++++++-
 4 files changed, 58 insertions(+), 128 deletions(-)
---
diff --git a/gnome-panel/libpanel-util/Makefile.am b/gnome-panel/libpanel-util/Makefile.am
index 737af572a..122f18f82 100644
--- a/gnome-panel/libpanel-util/Makefile.am
+++ b/gnome-panel/libpanel-util/Makefile.am
@@ -44,8 +44,6 @@ libpanel_util_la_SOURCES =            \
        panel-keyfile.h                 \
        panel-launch.c                  \
        panel-launch.h                  \
-       panel-list.c                    \
-       panel-list.h                    \
        panel-screensaver.c             \
        panel-screensaver.h             \
        panel-session-manager.c         \
diff --git a/gnome-panel/panel-widget.c b/gnome-panel/panel-widget.c
index 0ef0f68c0..59bde4960 100644
--- a/gnome-panel/panel-widget.c
+++ b/gnome-panel/panel-widget.c
@@ -13,8 +13,6 @@
 #include <gtk/gtk.h>
 #include <gtk/gtkx.h>
 
-#include <libpanel-util/panel-list.h>
-
 #include "applet.h"
 #include "panel-widget.h"
 #include "button-widget.h"
@@ -883,6 +881,35 @@ panel_widget_move_to_pack (PanelWidget         *panel,
  * Switch move
  */
 
+static GList *
+panel_g_list_swap_next (GList *list,
+                        GList *dl)
+{
+       GList *t;
+
+       if (!dl)
+               return list;
+
+       if (!dl->next)
+               return list;
+
+       if (dl->prev)
+               dl->prev->next = dl->next;
+       t = dl->prev;
+       dl->prev = dl->next;
+       dl->next->prev = t;
+       if (dl->next->next)
+               dl->next->next->prev = dl;
+       t = dl->next->next;
+       dl->next->next = dl;
+       dl->next = t;
+
+       if (list == dl)
+               return dl->prev;
+
+       return list;
+}
+
 /* if force_switch is set, moveby will be ignored */
 static gboolean
 panel_widget_switch_applet_right (PanelWidget *panel,
@@ -949,6 +976,35 @@ panel_widget_switch_applet_right (PanelWidget *panel,
        return FALSE;
 }
 
+static GList *
+panel_g_list_swap_prev (GList *list,
+                        GList *dl)
+{
+       GList *t;
+
+       if (!dl)
+               return list;
+
+       if (!dl->prev)
+               return list;
+
+       if (dl->next)
+               dl->next->prev = dl->prev;
+       t = dl->next;
+       dl->next = dl->prev;
+       dl->prev->next = t;
+       if (dl->prev->prev)
+               dl->prev->prev->next = dl;
+       t = dl->prev->prev;
+       dl->prev->prev = dl;
+       dl->prev = t;
+
+       if (list == dl->next)
+               return dl;
+
+       return list;
+}
+
 /* if force_switch is set, moveby will be ignored */
 static gboolean
 panel_widget_switch_applet_left (PanelWidget *panel,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]