[gnome-panel] panel: remove insert_pack_type from PanelData
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] panel: remove insert_pack_type from PanelData
- Date: Mon, 19 Dec 2016 00:37:05 +0000 (UTC)
commit 9eaf9c17bd989c8a1dbb126665ff19ff8a2ba9e9
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Mon Dec 19 00:26:15 2016 +0200
panel: remove insert_pack_type from PanelData
gnome-panel/panel-addto-dialog.c | 16 +++++++++++++---
gnome-panel/panel.c | 30 +++++++++---------------------
gnome-panel/panel.h | 10 +---------
3 files changed, 23 insertions(+), 33 deletions(-)
---
diff --git a/gnome-panel/panel-addto-dialog.c b/gnome-panel/panel-addto-dialog.c
index d56cb29..3b38ff5 100644
--- a/gnome-panel/panel-addto-dialog.c
+++ b/gnome-panel/panel-addto-dialog.c
@@ -1239,13 +1239,13 @@ panel_addto_present (GtkMenuItem *item,
{
PanelAddtoDialog *dialog;
PanelToplevel *toplevel;
- PanelData *pd;
+ PanelObjectPackType insert_pack_type;
+ GdkEvent *current_event;
GdkScreen *screen;
gint screen_height;
gint height;
toplevel = panel_widget->toplevel;
- pd = g_object_get_data (G_OBJECT (toplevel), "PanelData");
if (!panel_addto_dialog_quark)
panel_addto_dialog_quark =
@@ -1263,7 +1263,17 @@ panel_addto_present (GtkMenuItem *item,
panel_addto_present_applets (dialog);
}
- dialog->insert_pack_type = pd ? pd->insert_pack_type : PANEL_OBJECT_PACK_START;
+ insert_pack_type = PANEL_OBJECT_PACK_START;
+ current_event = gtk_get_current_event ();
+
+ if (current_event != NULL) {
+ if (current_event->type == GDK_BUTTON_PRESS)
+ insert_pack_type = panel_widget_get_insert_pack_type_at_cursor (panel_widget);
+
+ gdk_event_free (current_event);
+ }
+
+ dialog->insert_pack_type = insert_pack_type;
gtk_window_set_screen (GTK_WINDOW (dialog), screen);
gtk_window_set_default_size (GTK_WINDOW (dialog),
height * 8 / 7, height);
diff --git a/gnome-panel/panel.c b/gnome-panel/panel.c
index 615ddee..e263fb9 100644
--- a/gnome-panel/panel.c
+++ b/gnome-panel/panel.c
@@ -43,6 +43,13 @@
#include "panel-schemas.h"
#include "panel-user-menu.h"
+typedef struct _PanelData PanelData;
+struct _PanelData {
+ GtkWidget *panel;
+ GtkWidget *menu;
+ guint deactivate_idle;
+};
+
enum {
TARGET_URL,
TARGET_NETSCAPE_URL,
@@ -119,8 +126,6 @@ deactivate_idle (gpointer data)
PanelData *pd = data;
pd->deactivate_idle = 0;
- pd->insert_pack_type = PANEL_OBJECT_PACK_START;
-
return FALSE;
}
@@ -241,22 +246,8 @@ panel_popup_menu (PanelToplevel *toplevel,
{
PanelWidget *panel_widget;
GtkWidget *menu;
- PanelData *panel_data;
- GdkEvent *current_event;
panel_widget = panel_toplevel_get_panel_widget (toplevel);
- panel_data = g_object_get_data (G_OBJECT (toplevel), "PanelData");
-
- current_event = gtk_get_current_event ();
- if (!current_event)
- return FALSE;
-
- if (current_event->type == GDK_BUTTON_PRESS)
- panel_data->insert_pack_type = panel_widget_get_insert_pack_type_at_cursor (panel_widget);
- else
- panel_data->insert_pack_type = PANEL_OBJECT_PACK_START;
-
- gdk_event_free (current_event);
menu = make_popup_panel_menu (panel_widget);
if (!menu)
@@ -1187,20 +1178,19 @@ panel_widget_setup(PanelWidget *panel)
NULL);
}
-PanelData *
+void
panel_setup (PanelToplevel *toplevel)
{
PanelWidget *panel_widget;
PanelData *pd;
- g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), NULL);
+ g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel));
panel_widget = panel_toplevel_get_panel_widget (toplevel);
pd = g_new0 (PanelData,1);
pd->menu = NULL;
pd->panel = GTK_WIDGET (toplevel);
- pd->insert_pack_type = PANEL_OBJECT_PACK_START;
pd->deactivate_idle = 0;
g_object_set_data (G_OBJECT (toplevel), "PanelData", pd);
@@ -1227,8 +1217,6 @@ panel_setup (PanelToplevel *toplevel)
G_CALLBACK (panel_orient_change), panel_widget);
g_signal_connect (toplevel, "destroy", G_CALLBACK (panel_destroy), pd);
-
- return pd;
}
GdkScreen *
diff --git a/gnome-panel/panel.h b/gnome-panel/panel.h
index 4893d5b..3c4f977 100644
--- a/gnome-panel/panel.h
+++ b/gnome-panel/panel.h
@@ -8,17 +8,9 @@
G_BEGIN_DECLS
-typedef struct _PanelData PanelData;
-struct _PanelData {
- GtkWidget *panel;
- GtkWidget *menu;
- PanelObjectPackType insert_pack_type;
- guint deactivate_idle;
-};
-
void orientation_change(AppletInfo *info, PanelWidget *panel);
-PanelData *panel_setup (PanelToplevel *toplevel);
+void panel_setup (PanelToplevel *toplevel);
GdkScreen *panel_screen_from_panel_widget (PanelWidget *panel);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]