Reuse PanelToplevel window as actual panel class.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Thu, 14 Aug 2014 15:19:12 +0000 (18:19 +0300)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 16 Aug 2014 16:23:39 +0000 (19:23 +0300)
This way we can:
1) spare destroying function, just use gtk_widget_destroy();
2) simplify access Plugin->Panel to gtk_widget_get_toplevel();
3) simplify access toplevel window of Panel to GTK_WINDOW(p).
Old Panel is priv mamber of new LXPanel class. No extra memory consumed
because we can remove topgwin member from Panel structure later.

32 files changed:
src/configurator.c
src/icon-grid-old.c
src/misc.c
src/misc.h
src/panel.c
src/panel.h
src/plugin.c
src/plugin.h
src/plugins/batt/batt.c
src/plugins/cpu/cpu.c
src/plugins/cpufreq/cpufreq.c
src/plugins/dclock.c
src/plugins/deskno/deskno.c
src/plugins/dirmenu.c
src/plugins/indicator/indicator.c
src/plugins/kbled/kbled.c
src/plugins/launchtaskbar.c
src/plugins/menu.c
src/plugins/monitors/monitors.c
src/plugins/netstat/netstat.c
src/plugins/netstatus/netstatus.c
src/plugins/pager.c
src/plugins/separator.c
src/plugins/space.c
src/plugins/thermal/thermal.c
src/plugins/tray.c
src/plugins/volume/volume.c
src/plugins/volumealsa/volumealsa.c
src/plugins/wincmd.c
src/plugins/xkb/xkb-plugin.c
src/plugins/xkb/xkb.h
src/private.h

index 2b6ece1..72407a7 100644 (file)
@@ -43,7 +43,7 @@ enum{
     N_COLS
 };
 
-void panel_configure(Panel* p, int sel_page );
+void panel_configure(LXPanel* p, int sel_page );
 void restart(void);
 void gtk_run(void);
 void logout(void);
@@ -90,6 +90,7 @@ extern int config;
  * 0 to 255, and (2^(2n) - 1) / (2^n - 1) = 2^n + 1 = 257, with n = 8. */
 static guint16 const alpha_scale_factor = 257;
 
+void panel_config_save(Panel *p);
 void panel_global_config_save( Panel* p, FILE *fp);
 void panel_plugin_config_save( Panel* p, FILE *fp);
 
@@ -119,18 +120,15 @@ response_event(GtkDialog *widget, gint arg1, Panel* panel )
 }
 
 static void
-update_panel_geometry( Panel* p )
+update_panel_geometry( LXPanel* p )
 {
     /* Guard against being called early in panel creation. */
-    if (p->topgwin != NULL)
-    {
-        calculate_position(p);
-        gtk_widget_set_size_request(p->topgwin, p->aw, p->ah);
-        gdk_window_move(gtk_widget_get_window(p->topgwin), p->ax, p->ay);
-        panel_update_background(p);
-        panel_establish_autohide(p);
-        panel_set_wm_strut(p);
-    }
+    _calculate_position(p);
+    gtk_widget_set_size_request(GTK_WIDGET(p), p->priv->aw, p->priv->ah);
+    gdk_window_move(gtk_widget_get_window(GTK_WIDGET(p)), p->priv->ax, p->priv->ay);
+    _panel_update_background(p);
+    _panel_establish_autohide(p);
+    _panel_set_wm_strut(p);
 }
 
 static gboolean edge_selector(Panel* p, int edge)
@@ -144,107 +142,120 @@ gboolean panel_edge_available(Panel* p, int edge, gint monitor)
     GSList* l;
     for (l = all_panels; l != NULL; l = l->next)
         {
-        Panel* pl = (Panel*) l->data;
-        if ((pl != p) && (pl->edge == edge) && (pl->monitor == monitor))
+        LXPanel* pl = (LXPanel*) l->data;
+        if ((pl->priv != p) && (pl->priv->edge == edge) && (pl->priv->monitor == monitor))
             return FALSE;
         }
     return TRUE;
 }
 
-static void set_edge(Panel* p, int edge)
+static void set_edge(LXPanel* panel, int edge)
 {
+    Panel *p = panel->priv;
+
     p->edge = edge;
-    update_panel_geometry(p);
-    panel_set_panel_configuration_changed(p);
+    update_panel_geometry(panel);
+    _panel_set_panel_configuration_changed(panel);
     UPDATE_GLOBAL_STRING(p, "edge", num2str(edge_pair, edge, "none"));
 }
 
-static void edge_bottom_toggle(GtkToggleButton *widget, Panel *p)
+static void edge_bottom_toggle(GtkToggleButton *widget, LXPanel *p)
 {
     if (gtk_toggle_button_get_active(widget))
         set_edge(p, EDGE_BOTTOM);
 }
 
-static void edge_top_toggle(GtkToggleButton *widget, Panel *p)
+static void edge_top_toggle(GtkToggleButton *widget, LXPanel *p)
 {
     if (gtk_toggle_button_get_active(widget))
         set_edge(p, EDGE_TOP);
 }
 
-static void edge_left_toggle(GtkToggleButton *widget, Panel *p)
+static void edge_left_toggle(GtkToggleButton *widget, LXPanel *p)
 {
     if (gtk_toggle_button_get_active(widget))
         set_edge(p, EDGE_LEFT);
 }
 
-static void edge_right_toggle(GtkToggleButton *widget, Panel *p)
+static void edge_right_toggle(GtkToggleButton *widget, LXPanel *p)
 {
     if (gtk_toggle_button_get_active(widget))
         set_edge(p, EDGE_RIGHT);
 }
 
-static void set_monitor(GtkAdjustment *widget, Panel *p)
+static void set_monitor(GtkAdjustment *widget, LXPanel *panel)
 {
+    Panel *p = panel->priv;
+
     p->monitor = gtk_adjustment_get_value(widget);
-    update_panel_geometry(p);
-    panel_set_panel_configuration_changed(p);
+    update_panel_geometry(panel);
+    _panel_set_panel_configuration_changed(panel);
     UPDATE_GLOBAL_INT(p, "monitor", p->monitor);
 }
 
-static void set_alignment(Panel* p, int align)
+static void set_alignment(LXPanel* panel, int align)
 {
+    Panel *p = panel->priv;
+
     if (p->margin_control)
         gtk_widget_set_sensitive(p->margin_control, (align != ALLIGN_CENTER));
     p->allign = align;
-    update_panel_geometry(p);
+    update_panel_geometry(panel);
     UPDATE_GLOBAL_STRING(p, "allign", num2str(allign_pair, align, "none"));
 }
 
-static void align_left_toggle(GtkToggleButton *widget, Panel *p)
+static void align_left_toggle(GtkToggleButton *widget, LXPanel *p)
 {
     if (gtk_toggle_button_get_active(widget))
         set_alignment(p, ALLIGN_LEFT);
 }
 
-static void align_center_toggle(GtkToggleButton *widget, Panel *p)
+static void align_center_toggle(GtkToggleButton *widget, LXPanel *p)
 {
     if (gtk_toggle_button_get_active(widget))
         set_alignment(p, ALLIGN_CENTER);
 }
 
-static void align_right_toggle(GtkToggleButton *widget, Panel *p)
+static void align_right_toggle(GtkToggleButton *widget, LXPanel *p)
 {
     if (gtk_toggle_button_get_active(widget))
         set_alignment(p, ALLIGN_RIGHT);
 }
 
 static void
-set_margin( GtkSpinButton* spin,  Panel* p  )
+set_margin(GtkSpinButton* spin, LXPanel* panel)
 {
+    Panel *p = panel->priv;
+
     p->margin = (int)gtk_spin_button_get_value(spin);
-    update_panel_geometry(p);
+    update_panel_geometry(panel);
     UPDATE_GLOBAL_INT(p, "margin", p->margin);
 }
 
 static void
-set_width(  GtkSpinButton* spin, Panel* p )
+set_width(GtkSpinButton* spin, LXPanel* panel)
 {
+    Panel *p = panel->priv;
+
     p->width = (int)gtk_spin_button_get_value(spin);
-    update_panel_geometry(p);
+    update_panel_geometry(panel);
     UPDATE_GLOBAL_INT(p, "width", p->width);
 }
 
 static void
-set_height( GtkSpinButton* spin, Panel* p )
+set_height(GtkSpinButton* spin, LXPanel* panel)
 {
+    Panel *p = panel->priv;
+
     p->height = (int)gtk_spin_button_get_value(spin);
-    update_panel_geometry(p);
+    update_panel_geometry(panel);
     UPDATE_GLOBAL_INT(p, "height", p->height);
 }
 
-static void set_width_type( GtkWidget *item, Panel* p )
+static void set_width_type( GtkWidget *item, LXPanel* panel )
 {
     GtkWidget* spin;
+    Panel *p = panel->priv;
     int widthtype;
     gboolean t;
     widthtype = gtk_combo_box_get_active(GTK_COMBO_BOX(item)) + 1;
@@ -273,7 +284,7 @@ static void set_width_type( GtkWidget *item, Panel* p )
     } else
         return;
 
-    update_panel_geometry(p);
+    update_panel_geometry(panel);
     UPDATE_GLOBAL_STRING(p, "widthtype", num2str(width_pair, widthtype, "none"));
 }
 
@@ -423,35 +434,43 @@ on_use_font_size_toggled( GtkToggleButton* btn,   Panel* p )
 
 
 static void
-set_dock_type(GtkToggleButton* toggle,  Panel* p )
+set_dock_type(GtkToggleButton* toggle, LXPanel* panel)
 {
+    Panel *p = panel->priv;
+
     p->setdocktype = gtk_toggle_button_get_active(toggle) ? 1 : 0;
     panel_set_dock_type( p );
-    update_panel_geometry(p);
+    update_panel_geometry(panel);
     UPDATE_GLOBAL_INT(p, "setdocktype", p->setdocktype);
 }
 
 static void
-set_strut(GtkToggleButton* toggle,  Panel* p )
+set_strut(GtkToggleButton* toggle, LXPanel* panel)
 {
+    Panel *p = panel->priv;
+
     p->setstrut = gtk_toggle_button_get_active(toggle) ? 1 : 0;
-    update_panel_geometry(p);
+    update_panel_geometry(panel);
     UPDATE_GLOBAL_INT(p, "setpartialstrut", p->setstrut);
 }
 
 static void
-set_autohide(GtkToggleButton* toggle,  Panel* p )
+set_autohide(GtkToggleButton* toggle, LXPanel* panel)
 {
+    Panel *p = panel->priv;
+
     p->autohide = gtk_toggle_button_get_active(toggle) ? 1 : 0;
-    update_panel_geometry(p);
+    update_panel_geometry(panel);
     UPDATE_GLOBAL_INT(p, "autohide", p->autohide);
 }
 
 static void
-set_height_when_minimized( GtkSpinButton* spin,  Panel* p  )
+set_height_when_minimized(GtkSpinButton* spin, LXPanel* panel)
 {
+    Panel *p = panel->priv;
+
     p->height_when_hidden = (int)gtk_spin_button_get_value(spin);
-    update_panel_geometry(p);
+    update_panel_geometry(panel);
     UPDATE_GLOBAL_INT(p, "heightwhenhidden", p->height_when_hidden);
 }
 
@@ -496,7 +515,7 @@ on_plugin_expand_toggled(GtkCellRendererToggle* render, char* path, GtkTreeView*
         guint padding;
         GtkPackType pack_type;
         LXPanelPluginInit *init;
-        Panel *panel;
+        LXPanel *panel;
 
         gtk_tree_model_get( model, &it, COL_DATA, &pl, COL_EXPAND, &expand, -1 );
         init = PLUGIN_CLASS(pl);
@@ -505,14 +524,15 @@ on_plugin_expand_toggled(GtkCellRendererToggle* render, char* path, GtkTreeView*
         if (init->expand_available)
         {
             config_setting_t *s = g_object_get_qdata(G_OBJECT(pl), lxpanel_plugin_qconf);
+            GtkBox *box = GTK_BOX(panel->priv->box);
             /* Only honor "stretch" if allowed by the plugin. */
             expand = ! expand;
             gtk_list_store_set( GTK_LIST_STORE(model), &it, COL_EXPAND, expand, -1 );
 
             /* Query the old packing of the plugin widget.
              * Apply the new packing with only "expand" modified. */
-            gtk_box_query_child_packing( GTK_BOX(panel->box), pl, &old_expand, &fill, &padding, &pack_type );
-            gtk_box_set_child_packing( GTK_BOX(panel->box), pl, expand, fill, padding, pack_type );
+            gtk_box_query_child_packing( box, pl, &old_expand, &fill, &padding, &pack_type );
+            gtk_box_set_child_packing( box, pl, expand, fill, padding, pack_type );
             if (expand)
                 config_group_set_int(s, "expand", 1);
             else
@@ -533,7 +553,7 @@ static void on_stretch_render(GtkTreeViewColumn * column, GtkCellRenderer * rend
         NULL);
 }
 
-static void init_plugin_list( Panel* p, GtkTreeView* view, GtkWidget* label )
+static void init_plugin_list( LXPanel* p, GtkTreeView* view, GtkWidget* label )
 {
     GtkListStore* list;
     GtkTreeViewColumn* col;
@@ -562,13 +582,13 @@ static void init_plugin_list( Panel* p, GtkTreeView* view, GtkWidget* label )
     gtk_tree_view_append_column( view, col );
 
     list = gtk_list_store_new( N_COLS, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_POINTER );
-    plugins = p->box ? gtk_container_get_children(GTK_CONTAINER(p->box)) : NULL;
+    plugins = p->priv->box ? gtk_container_get_children(GTK_CONTAINER(p->priv->box)) : NULL;
     for( l = plugins; l; l = l->next )
     {
         GtkTreeIter it;
         gboolean expand;
         GtkWidget *w = (GtkWidget*)l->data;
-        gtk_container_child_get(GTK_CONTAINER(p->box), w, "expand", &expand, NULL);
+        gtk_container_child_get(GTK_CONTAINER(p->priv->box), w, "expand", &expand, NULL);
         gtk_list_store_append( list, &it );
         gtk_list_store_set( list, &it,
                             COL_NAME, _(PLUGIN_CLASS(w)->name),
@@ -609,7 +629,7 @@ static void on_add_plugin_response( GtkDialog* dlg,
                                     int response,
                                     GtkTreeView* _view )
 {
-    Panel* p = (Panel*) g_object_get_data( G_OBJECT(_view), "panel" );
+    LXPanel* p = (LXPanel*) g_object_get_data( G_OBJECT(_view), "panel" );
     if( response == GTK_RESPONSE_OK )
     {
         GtkTreeView* view;
@@ -625,7 +645,7 @@ static void on_add_plugin_response( GtkDialog* dlg,
             GtkWidget *pl;
             config_setting_t *cfg;
 
-            cfg = config_group_add_subgroup(config_root_setting(p->config),
+            cfg = config_group_add_subgroup(config_root_setting(p->priv->config),
                                             "Plugin");
             gtk_tree_model_get( model, &it, 1, &type, -1 );
             config_group_set_string(cfg, "type", type);
@@ -634,10 +654,10 @@ static void on_add_plugin_response( GtkDialog* dlg,
                 GtkTreePath* tree_path;
                 gboolean expand;
 
-                panel_config_save(p);
+                panel_config_save(p->priv);
 
                 plugin_widget_set_background(pl, p);
-                gtk_container_child_get(GTK_CONTAINER(p->box), pl, "expand", &expand, NULL);
+                gtk_container_child_get(GTK_CONTAINER(p->priv->box), pl, "expand", &expand, NULL);
                 model = gtk_tree_view_get_model( _view );
                 gtk_list_store_append( GTK_LIST_STORE(model), &it );
                 gtk_list_store_set( GTK_LIST_STORE(model), &it,
@@ -672,7 +692,7 @@ static void on_add_plugin( GtkButton* btn, GtkTreeView* _view )
     GHashTableIter iter;
     gpointer key, val;
 
-    Panel* p = (Panel*) g_object_get_data( G_OBJECT(_view), "panel" );
+    LXPanel* p = (LXPanel*) g_object_get_data( G_OBJECT(_view), "panel" );
 
     classes = lxpanel_get_all_types();
 
@@ -686,8 +706,8 @@ static void on_add_plugin( GtkButton* btn, GtkTreeView* _view )
     panel_apply_icon(GTK_WINDOW(dlg));
 
     /* fix background */
-    if (p->background)
-        gtk_widget_set_style(dlg, p->defstyle);
+    if (p->priv->background)
+        gtk_widget_set_style(dlg, p->priv->defstyle);
 
     /* gtk_widget_set_sensitive( parent_win, FALSE ); */
     scroll = gtk_scrolled_window_new( NULL, NULL );
@@ -760,7 +780,7 @@ static void on_remove_plugin( GtkButton* btn, GtkTreeView* view )
     GtkTreeSelection* tree_sel = gtk_tree_view_get_selection( view );
     GtkWidget* pl;
 
-    Panel* p = (Panel*) g_object_get_data( G_OBJECT(view), "panel" );
+    LXPanel* p = (LXPanel*) g_object_get_data( G_OBJECT(view), "panel" );
 
     if( gtk_tree_selection_get_selected( tree_sel, &model, &it ) )
     {
@@ -776,7 +796,7 @@ static void on_remove_plugin( GtkButton* btn, GtkTreeView* view )
         /* reset conf pointer because the widget still may be referenced by configurator */
         g_object_set_qdata(G_OBJECT(pl), lxpanel_plugin_qconf, NULL);
         gtk_widget_destroy(pl);
-        panel_config_save(p);
+        panel_config_save(p->priv);
     }
 }
 
@@ -796,16 +816,16 @@ void modify_plugin( GtkTreeView* view )
     if (init->config)
     {
         GtkWidget *dlg;
-        Panel *panel = PLUGIN_PANEL(pl);
+        LXPanel *panel = PLUGIN_PANEL(pl);
         dlg = init->config(panel, pl, GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(view))));
         if (dlg)
             _panel_show_config_dialog(panel, pl, dlg);
     }
 }
 
-static int get_widget_index(Panel* p, GtkWidget* pl)
+static int get_widget_index(LXPanel* p, GtkWidget* pl)
 {
-    GList *plugins = gtk_container_get_children(GTK_CONTAINER(p->box));
+    GList *plugins = gtk_container_get_children(GTK_CONTAINER(p->priv->box));
     int i = g_list_index(plugins, pl);
     g_list_free(plugins);
     return i;
@@ -818,7 +838,7 @@ static void on_moveup_plugin(  GtkButton* btn, GtkTreeView* view )
     GtkTreeSelection* tree_sel = gtk_tree_view_get_selection( view );
     int i;
 
-    Panel* panel = (Panel*) g_object_get_data( G_OBJECT(view), "panel" );
+    LXPanel* panel = (LXPanel*) g_object_get_data( G_OBJECT(view), "panel" );
 
     if( ! gtk_tree_model_get_iter_first( model, &it ) )
         return;
@@ -840,8 +860,8 @@ static void on_moveup_plugin(  GtkButton* btn, GtkTreeView* view )
                 i = 1;
             config_setting_move_elem(s, config_setting_get_parent(s), i);
             /* reorder in panel */
-            gtk_box_reorder_child(GTK_BOX(panel->box), pl, i - 1);
-            panel_config_save(panel);
+            gtk_box_reorder_child(GTK_BOX(panel->priv->box), pl, i - 1);
+            panel_config_save(panel->priv);
             return;
         }
         prev = it;
@@ -857,7 +877,7 @@ static void on_movedown_plugin(  GtkButton* btn, GtkTreeView* view )
     config_setting_t *s;
     int i;
 
-    Panel* panel = (Panel*) g_object_get_data( G_OBJECT(view), "panel" );
+    LXPanel* panel = (LXPanel*) g_object_get_data( G_OBJECT(view), "panel" );
 
     if( ! gtk_tree_selection_get_selected( tree_sel, &model, &it ) )
         return;
@@ -875,8 +895,8 @@ static void on_movedown_plugin(  GtkButton* btn, GtkTreeView* view )
     /* reorder in config, 0 is Global */
     config_setting_move_elem(s, config_setting_get_parent(s), i + 1);
     /* reorder in panel */
-    gtk_box_reorder_child(GTK_BOX(panel->box), pl, i);
-    panel_config_save(panel);
+    gtk_box_reorder_child(GTK_BOX(panel->priv->box), pl, i);
+    panel_config_save(panel->priv);
 }
 
 static void
@@ -924,8 +944,9 @@ static void on_app_chooser_destroy(GtkComboBox *fm, gpointer _unused)
     }
 }
 
-void panel_configure( Panel* p, int sel_page )
+void panel_configure( LXPanel* panel, int sel_page )
 {
+    Panel *p = panel->priv;
     GtkBuilder* builder;
     GtkWidget *w, *w2, *tint_clr;
     FmMimeType *mt;
@@ -948,7 +969,7 @@ void panel_configure( Panel* p, int sel_page )
     }
 
     p->pref_dialog = (GtkWidget*)gtk_builder_get_object( builder, "panel_pref" );
-    gtk_window_set_transient_for(GTK_WINDOW(p->pref_dialog), panel_get_toplevel_window(p));
+    gtk_window_set_transient_for(GTK_WINDOW(p->pref_dialog), GTK_WINDOW(panel));
     g_signal_connect(p->pref_dialog, "response", G_CALLBACK(response_event), p);
     g_object_add_weak_pointer( G_OBJECT(p->pref_dialog), (gpointer) &p->pref_dialog );
     gtk_window_set_position( GTK_WINDOW(p->pref_dialog), GTK_WIN_POS_CENTER );
@@ -957,16 +978,16 @@ void panel_configure( Panel* p, int sel_page )
     /* position */
     w = (GtkWidget*)gtk_builder_get_object( builder, "edge_bottom" );
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), edge_selector(p, EDGE_BOTTOM));
-    g_signal_connect(w, "toggled", G_CALLBACK(edge_bottom_toggle), p);
+    g_signal_connect(w, "toggled", G_CALLBACK(edge_bottom_toggle), panel);
     w = (GtkWidget*)gtk_builder_get_object( builder, "edge_top" );
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), edge_selector(p, EDGE_TOP));
-    g_signal_connect(w, "toggled", G_CALLBACK(edge_top_toggle), p);
+    g_signal_connect(w, "toggled", G_CALLBACK(edge_top_toggle), panel);
     w = (GtkWidget*)gtk_builder_get_object( builder, "edge_left" );
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), edge_selector(p, EDGE_LEFT));
-    g_signal_connect(w, "toggled", G_CALLBACK(edge_left_toggle), p);
+    g_signal_connect(w, "toggled", G_CALLBACK(edge_left_toggle), panel);
     w = (GtkWidget*)gtk_builder_get_object( builder, "edge_right" );
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), edge_selector(p, EDGE_RIGHT));
-    g_signal_connect(w, "toggled", G_CALLBACK(edge_right_toggle), p);
+    g_signal_connect(w, "toggled", G_CALLBACK(edge_right_toggle), panel);
 
     /* monitor */
     monitors = 1;
@@ -977,25 +998,25 @@ void panel_configure( Panel* p, int sel_page )
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), p->monitor + 1);
     gtk_spin_button_set_range(GTK_SPIN_BUTTON(w), 1, monitors);
     gtk_widget_set_sensitive(w, monitors > 1);
-    g_signal_connect(w, "value-changed", G_CALLBACK(set_monitor), p);
+    g_signal_connect(w, "value-changed", G_CALLBACK(set_monitor), panel);
 
     /* alignment */
     p->alignment_left_label = w = (GtkWidget*)gtk_builder_get_object( builder, "alignment_left" );
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), (p->allign == ALLIGN_LEFT));
-    g_signal_connect(w, "toggled", G_CALLBACK(align_left_toggle), p);
+    g_signal_connect(w, "toggled", G_CALLBACK(align_left_toggle), panel);
     w = (GtkWidget*)gtk_builder_get_object( builder, "alignment_center" );
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), (p->allign == ALLIGN_CENTER));
-    g_signal_connect(w, "toggled", G_CALLBACK(align_center_toggle), p);
+    g_signal_connect(w, "toggled", G_CALLBACK(align_center_toggle), panel);
     p->alignment_right_label = w = (GtkWidget*)gtk_builder_get_object( builder, "alignment_right" );
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), (p->allign == ALLIGN_RIGHT));
-    g_signal_connect(w, "toggled", G_CALLBACK(align_right_toggle), p);
+    g_signal_connect(w, "toggled", G_CALLBACK(align_right_toggle), panel);
 
     /* margin */
     p->margin_control = w = (GtkWidget*)gtk_builder_get_object( builder, "margin" );
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), p->margin);
     gtk_widget_set_sensitive(p->margin_control, (p->allign != ALLIGN_CENTER));
     g_signal_connect( w, "value-changed",
-                      G_CALLBACK(set_margin), p);
+                      G_CALLBACK(set_margin), panel);
 
     /* size */
     p->width_label = (GtkWidget*)gtk_builder_get_object( builder, "width_label");
@@ -1008,19 +1029,19 @@ void panel_configure( Panel* p, int sel_page )
         upper = (((p->edge == EDGE_TOP) || (p->edge == EDGE_BOTTOM)) ? gdk_screen_width() : gdk_screen_height());
     gtk_spin_button_set_range( GTK_SPIN_BUTTON(w), 0, upper );
     gtk_spin_button_set_value( GTK_SPIN_BUTTON(w), p->width );
-    g_signal_connect( w, "value-changed", G_CALLBACK(set_width), p );
+    g_signal_connect( w, "value-changed", G_CALLBACK(set_width), panel );
 
     w = (GtkWidget*)gtk_builder_get_object( builder, "width_unit" );
     update_opt_menu( w, p->widthtype - 1 );
     g_object_set_data(G_OBJECT(w), "width_spin", p->width_control );
     g_signal_connect( w, "changed",
-                     G_CALLBACK(set_width_type), p);
+                     G_CALLBACK(set_width_type), panel);
 
     p->height_label = (GtkWidget*)gtk_builder_get_object( builder, "height_label");
     p->height_control = w = (GtkWidget*)gtk_builder_get_object( builder, "height" );
     gtk_spin_button_set_range( GTK_SPIN_BUTTON(w), PANEL_HEIGHT_MIN, PANEL_HEIGHT_MAX );
     gtk_spin_button_set_value( GTK_SPIN_BUTTON(w), p->height );
-    g_signal_connect( w, "value-changed", G_CALLBACK(set_height), p );
+    g_signal_connect( w, "value-changed", G_CALLBACK(set_height), panel );
 
     w = (GtkWidget*)gtk_builder_get_object( builder, "height_unit" );
     update_opt_menu( w, HEIGHT_PIXEL - 1);
@@ -1042,7 +1063,7 @@ void panel_configure( Panel* p, int sel_page )
     w = (GtkWidget*)gtk_builder_get_object( builder, "as_dock" );
     update_toggle_button( w, p->setdocktype );
     g_signal_connect( w, "toggled",
-                      G_CALLBACK(set_dock_type), p );
+                      G_CALLBACK(set_dock_type), panel );
 
     /* Explaination from Ruediger Arp <ruediger@gmx.net>:
         "Set Strut": Reserve panel's space so that it will not be
@@ -1056,17 +1077,17 @@ void panel_configure( Panel* p, int sel_page )
     w = (GtkWidget*)gtk_builder_get_object( builder, "reserve_space" );
     update_toggle_button( w, p->setstrut );
     g_signal_connect( w, "toggled",
-                      G_CALLBACK(set_strut), p );
+                      G_CALLBACK(set_strut), panel );
 
     w = (GtkWidget*)gtk_builder_get_object( builder, "autohide" );
     update_toggle_button( w, p->autohide );
     g_signal_connect( w, "toggled",
-                      G_CALLBACK(set_autohide), p );
+                      G_CALLBACK(set_autohide), panel );
 
     w = (GtkWidget*)gtk_builder_get_object( builder, "height_when_minimized" );
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), p->height_when_hidden);
     g_signal_connect( w, "value-changed",
-                      G_CALLBACK(set_height_when_minimized), p);
+                      G_CALLBACK(set_height_when_minimized), panel);
 
     /* transparancy */
     tint_clr = w = (GtkWidget*)gtk_builder_get_object( builder, "tint_clr" );
@@ -1158,7 +1179,7 @@ void panel_configure( Panel* p, int sel_page )
         g_signal_connect( w, "clicked", G_CALLBACK(on_movedown_plugin), plugin_list );
 
         w = (GtkWidget*)gtk_builder_get_object( builder, "plugin_desc" );
-        init_plugin_list( p, GTK_TREE_VIEW(plugin_list), w );
+        init_plugin_list( panel, GTK_TREE_VIEW(plugin_list), w );
     }
     /* advanced, applications */
     mt = fm_mime_type_from_name("inode/directory");
@@ -1221,6 +1242,11 @@ void panel_config_save( Panel* p )
     p->config_changed = 0;
 }
 
+void lxpanel_config_save(LXPanel *p)
+{
+    panel_config_save(p->priv);
+}
+
 void restart(void)
 {
     /* This is defined in panel.c */
@@ -1348,23 +1374,23 @@ static void generic_config_dlg_response(GtkWidget * dlg, int response, Panel * p
     panel_config_save(panel);
 }
 
-void _panel_show_config_dialog(Panel *panel, GtkWidget *p, GtkWidget *dlg)
+void _panel_show_config_dialog(LXPanel *panel, GtkWidget *p, GtkWidget *dlg)
 {
     gint x, y;
 
     /* If there is already a plugin configuration dialog open, close it.
      * Then record this one in case the panel or plugin is deleted. */
-    if (panel->plugin_pref_dialog != NULL)
-        gtk_dialog_response(GTK_DIALOG(panel->plugin_pref_dialog), GTK_RESPONSE_CLOSE);
-    panel->plugin_pref_dialog = dlg;
+    if (panel->priv->plugin_pref_dialog != NULL)
+        gtk_dialog_response(GTK_DIALOG(panel->priv->plugin_pref_dialog), GTK_RESPONSE_CLOSE);
+    panel->priv->plugin_pref_dialog = dlg;
 
     /* add some handlers to destroy the dialog on responce or widget destroy */
-    g_signal_connect(dlg, "response", G_CALLBACK(generic_config_dlg_response), panel);
+    g_signal_connect(dlg, "response", G_CALLBACK(generic_config_dlg_response), panel->priv);
     g_signal_connect(p, "destroy", G_CALLBACK(on_plugin_destroy), dlg);
     g_object_set_data(G_OBJECT(dlg), "generic-config-plugin", p);
 
     /* adjust config dialog window position to be near plugin */
-    gtk_window_set_transient_for(GTK_WINDOW(dlg), panel_get_toplevel_window(panel));
+    gtk_window_set_transient_for(GTK_WINDOW(dlg), GTK_WINDOW(panel));
 //    gtk_window_iconify(GTK_WINDOW(dlg));
     gtk_widget_show(dlg);
     lxpanel_plugin_popup_set_position_helper(panel, p, dlg, &x, &y);
@@ -1482,7 +1508,7 @@ static GtkWidget *_lxpanel_generic_config_dlg(const char *title, Panel *p,
 }
 
 /* new plugins API -- apply_func() gets GtkWidget* */
-GtkWidget *lxpanel_generic_config_dlg(const char *title, Panel *panel,
+GtkWidget *lxpanel_generic_config_dlg(const char *title, LXPanel *panel,
                                       GSourceFunc apply_func, GtkWidget *plugin,
                                       const char *name, ...)
 {
@@ -1492,7 +1518,7 @@ GtkWidget *lxpanel_generic_config_dlg(const char *title, Panel *panel,
     if (plugin == NULL)
         return NULL;
     va_start(args, name);
-    dlg = _lxpanel_generic_config_dlg(title, panel, apply_func, plugin, name, args);
+    dlg = _lxpanel_generic_config_dlg(title, panel->priv, apply_func, plugin, name, args);
     va_end(args);
     return dlg;
 }
@@ -1510,7 +1536,7 @@ GtkWidget* create_generic_config_dlg( const char* title, GtkWidget* parent,
     va_start(args, name);
     dlg = _lxpanel_generic_config_dlg(title, plugin->panel, apply_func, plugin, name, args);
     va_end(args);
-    _panel_show_config_dialog(plugin->panel, plugin->pwid, dlg);
+    _panel_show_config_dialog(plugin->panel->topgwin, plugin->pwid, dlg);
     return dlg;
 }
 
index 39fdad3..2e3d7b4 100644 (file)
@@ -137,7 +137,7 @@ static gboolean icon_grid_placement(IconGrid * ig)
 
     /* If the icon grid contains sockets, do special handling to get the background erased. */
     if (contains_sockets)
-        plugin_widget_set_background(ig->widget, ig->panel);
+        plugin_widget_set_background(ig->widget, ig->panel->topgwin);
     return FALSE;
 }
 
index 9d65626..316a2f6 100644 (file)
@@ -809,9 +809,9 @@ calculate_width(int scrw, int wtype, int allign, int margin,
 }
 
 
-void
-calculate_position(Panel *np)
+void _calculate_position(LXPanel *panel)
 {
+    Panel *np = panel->priv;
     GdkScreen *screen;
     GdkRectangle marea;
 
@@ -826,7 +826,7 @@ calculate_position(Panel *np)
         marea.width  = np->workarea[np->curdesk*4 + 2];
         marea.height = np->workarea[np->curdesk*4 + 3];
     } else {
-        screen = gtk_widget_get_screen(np->topgwin);
+        screen = gtk_widget_get_screen(GTK_WIDGET(panel));
         g_assert(np->monitor >= 0 && np->monitor < gdk_screen_get_n_monitors(screen));
         gdk_screen_get_monitor_geometry(screen,np->monitor,&marea);
     }
@@ -851,6 +851,11 @@ calculate_position(Panel *np)
     RET();
 }
 
+void calculate_position(Panel *np)
+{
+    _calculate_position(np->topgwin);
+}
+
 gchar *
 expand_tilda(const gchar *file)
 {
@@ -1107,7 +1112,7 @@ static gboolean fb_button_leave(GtkImage * widget, GdkEventCrossing * event, gpo
 
 
 /* consumes reference on icon */
-static GtkWidget *_lxpanel_button_new_for_icon(Panel *panel, FmIcon *icon,
+static GtkWidget *_lxpanel_button_new_for_icon(LXPanel *panel, FmIcon *icon,
                                                gint size, gulong highlight_color,
                                                const gchar *label)
 {
@@ -1140,7 +1145,7 @@ static GtkWidget *_lxpanel_button_new_for_icon(Panel *panel, FmIcon *icon,
         gtk_box_pack_start(GTK_BOX(inner), image, FALSE, FALSE, 0);
 
         GtkWidget * lbl = gtk_label_new("");
-        panel_draw_label_text(panel, lbl, label, FALSE, 1, TRUE);
+        lxpanel_draw_label_text(panel, lbl, label, FALSE, 1, TRUE);
         gtk_misc_set_padding(GTK_MISC(lbl), 2, 0);
         gtk_box_pack_end(GTK_BOX(inner), lbl, FALSE, FALSE, 0);
     }
@@ -1149,18 +1154,18 @@ static GtkWidget *_lxpanel_button_new_for_icon(Panel *panel, FmIcon *icon,
     return event_box;
 }
 
-GtkWidget *lxpanel_button_new_for_icon(Panel *panel, const gchar *name, GdkColor *color, const gchar *label)
+GtkWidget *lxpanel_button_new_for_icon(LXPanel *panel, const gchar *name, GdkColor *color, const gchar *label)
 {
     gulong highlight_color = color ? gcolor2rgb24(color) : PANEL_ICON_HIGHLIGHT;
     return _lxpanel_button_new_for_icon(panel, fm_icon_from_name(name),
-                                        panel->icon_size, highlight_color, label);
+                                        panel->priv->icon_size, highlight_color, label);
 }
 
-GtkWidget *lxpanel_button_new_for_fm_icon(Panel *panel, FmIcon *icon, GdkColor *color, const gchar *label)
+GtkWidget *lxpanel_button_new_for_fm_icon(LXPanel *panel, FmIcon *icon, GdkColor *color, const gchar *label)
 {
     gulong highlight_color = color ? gcolor2rgb24(color) : PANEL_ICON_HIGHLIGHT;
     return _lxpanel_button_new_for_icon(panel, g_object_ref(icon),
-                                        panel->icon_size, highlight_color, label);
+                                        panel->priv->icon_size, highlight_color, label);
 }
 
 /* parameters width and keep_ratio are unused, kept for backward compatibility */
@@ -1174,7 +1179,7 @@ GtkWidget * fb_button_new_from_file(
 GtkWidget * fb_button_new_from_file_with_label(
     const gchar * image_file, int width, int height, gulong highlight_color, gboolean keep_ratio, Panel * panel, const gchar * label)
 {
-    return _lxpanel_button_new_for_icon(panel, fm_icon_from_name(image_file), height, highlight_color, label);
+    return _lxpanel_button_new_for_icon(panel->topgwin, fm_icon_from_name(image_file), height, highlight_color, label);
 }
 
 char* translate_exec_to_cmd( const char* exec, const char* icon,
index 15b8df1..5104251 100644 (file)
@@ -72,13 +72,12 @@ void get_net_wm_state(Window win, NetWMState *nws);
 void get_net_wm_window_type(Window win, NetWMWindowType *nwwt);
 GPid get_net_wm_pid(Window win);
 
-void calculate_position(Panel *np);
 gchar *expand_tilda(const gchar *file);
 
 void get_button_spacing(GtkRequisition *req, GtkContainer *parent, gchar *name);
 guint32 gcolor2rgb24(GdkColor *color);
-GtkWidget *lxpanel_button_new_for_icon(Panel *panel, const gchar *name, GdkColor *color, const gchar *label);
-GtkWidget *lxpanel_button_new_for_fm_icon(Panel *panel, FmIcon *icon, GdkColor *color, const gchar *label);
+GtkWidget *lxpanel_button_new_for_icon(LXPanel *panel, const gchar *name, GdkColor *color, const gchar *label);
+GtkWidget *lxpanel_button_new_for_fm_icon(LXPanel *panel, FmIcon *icon, GdkColor *color, const gchar *label);
 void lxpanel_button_set_icon(GtkWidget* btn, const gchar *name, gint size);
 void lxpanel_button_update_icon(GtkWidget* btn, FmIcon *icon, gint size);
 
@@ -93,7 +92,7 @@ typedef enum {
 } PluginConfType;
 
 /* Parameters: const char* name, gpointer ret_value, PluginConfType type, ....NULL */
-extern GtkWidget *lxpanel_generic_config_dlg(const char *title, Panel *panel,
+extern GtkWidget *lxpanel_generic_config_dlg(const char *title, LXPanel *panel,
                                              GSourceFunc apply_func,
                                              GtkWidget *plugin,
                                              const char *name, ...);
index 8ed6f55..18da11c 100644 (file)
@@ -54,41 +54,86 @@ GSList* all_panels = NULL;  /* a single-linked list storing all panels */
 
 gboolean is_restarting = FALSE;
 
-static int panel_start(Panel *p);
-static void panel_start_gui(Panel *p);
+static int panel_start(LXPanel *p);
+static void panel_start_gui(LXPanel *p);
+static void ah_stop(LXPanel *p);
+static void on_root_bg_changed(FbBg *bg, LXPanel* p);
 
 gboolean is_in_lxde = FALSE;
 
-/* A hack used to be compatible with Gnome panel for gtk+ themes.
- * Some gtk+ themes define special styles for desktop panels.
- * http://live.gnome.org/GnomeArt/Tutorials/GtkThemes/GnomePanel
- * So we make a derived class from GtkWindow named PanelToplevel
- * and create the panels with it to be compatible with Gnome themes.
- */
-#define PANEL_TOPLEVEL_TYPE                            (panel_toplevel_get_type())
+G_DEFINE_TYPE(PanelToplevel, lxpanel, GTK_TYPE_WINDOW);
 
-typedef struct _PanelToplevel                  PanelToplevel;
-typedef struct _PanelToplevelClass             PanelToplevelClass;
-struct _PanelToplevel
-{
-       GtkWindow parent;
-};
-struct _PanelToplevelClass
+static void lxpanel_finalize(GObject *object)
 {
-       GtkWindowClass parent_class;
-};
-G_DEFINE_TYPE(PanelToplevel, panel_toplevel, GTK_TYPE_WINDOW);
-static void panel_toplevel_class_init(PanelToplevelClass *klass)
+    LXPanel *self = LXPANEL(object);
+    Panel *p = self->priv;
+
+    if( p->config_changed )
+        lxpanel_config_save( self );
+    config_destroy(p->config);
+
+    g_free(p->workarea);
+    g_free( p->background_file );
+    g_slist_free( p->system_menus );
+
+    g_free( p->name );
+    g_free(p);
+
+    G_OBJECT_CLASS(lxpanel_parent_class)->finalize(object);
+}
+
+static void lxpanel_destroy(GtkObject *object)
 {
+    LXPanel *self = LXPANEL(object);
+    Panel *p = self->priv;
+    Display *xdisplay;
+
+    if (p->autohide)
+        ah_stop(self);
+
+    if (p->pref_dialog != NULL)
+        gtk_widget_destroy(p->pref_dialog);
+    p->pref_dialog = NULL;
+
+    if (p->plugin_pref_dialog != NULL)
+        /* just close the dialog, it will do all required cleanup */
+        gtk_dialog_response(GTK_DIALOG(p->plugin_pref_dialog), GTK_RESPONSE_CLOSE);
+
+    if (p->bg != NULL)
+    {
+        g_signal_handlers_disconnect_by_func(G_OBJECT(p->bg), on_root_bg_changed, self);
+        g_object_unref(p->bg);
+        p->bg = NULL;
+    }
+
+    if (p->initialized)
+    {
+        gtk_window_group_remove_window(win_grp, GTK_WINDOW(self));
+        xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+        gdk_flush();
+        XFlush(xdisplay);
+        XSync(xdisplay, True);
+        p->initialized = FALSE;
+    }
+
+    GTK_OBJECT_CLASS(lxpanel_parent_class)->destroy(object);
 }
-static void panel_toplevel_init(PanelToplevel *self)
+
+static void lxpanel_class_init(PanelToplevelClass *klass)
 {
+    GObjectClass *gobject_class = (GObjectClass *)klass;
+    GtkObjectClass *gtk_object_class = (GtkObjectClass *)klass;
+
+    gobject_class->finalize = lxpanel_finalize;
+    gtk_object_class->destroy = lxpanel_destroy;
 }
 
-/* Allocate and initialize new Panel structure. */
-static Panel* panel_allocate(void)
+static void lxpanel_init(PanelToplevel *self)
 {
-    Panel* p = g_new0(Panel, 1);
+    Panel *p = g_new0(Panel, 1);
+
+    self->priv = p;
+    p->topgwin = self;
     p->allign = ALLIGN_CENTER;
     p->edge = EDGE_NONE;
     p->widthtype = WIDTH_PERCENT;
@@ -114,7 +159,12 @@ static Panel* panel_allocate(void)
     p->icon_size = PANEL_ICON_SIZE;
     p->icon_theme = gtk_icon_theme_get_default();
     p->config = config_new();
-    return p;
+}
+
+/* Allocate and initialize new Panel structure. */
+static LXPanel* panel_allocate(void)
+{
+    return g_object_new(LX_TYPE_PANEL, NULL);
 }
 
 /* Normalize panel configuration after load from file or reconfiguration. */
@@ -144,16 +194,22 @@ static void panel_normalize_configuration(Panel* p)
 
 void panel_set_wm_strut(Panel *p)
 {
+    _panel_set_wm_strut(p->topgwin);
+}
+
+void _panel_set_wm_strut(LXPanel *panel)
+{
     int index;
     Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+    Panel *p = panel->priv;
     gulong strut_size;
     gulong strut_lower;
     gulong strut_upper;
 
 #if GTK_CHECK_VERSION(2, 20, 0)
-    if (!gtk_widget_get_mapped(p->topgwin))
+    if (!gtk_widget_get_mapped(GTK_WIDGET(panel)))
 #else
-    if (!GTK_WIDGET_MAPPED(p->topgwin))
+    if (!GTK_WIDGET_MAPPED(panel))
 #endif
         return;
     /* most wm's tend to ignore struts of unmapped windows, and that's how
@@ -239,13 +295,12 @@ void panel_set_wm_strut(Panel *p)
 }
 
 /* defined in configurator.c */
-void panel_configure(Panel* p, int sel_page );
+void panel_configure(LXPanel* p, int sel_page );
 gboolean panel_edge_available(Panel* p, int edge, gint monitor);
 
 /* built-in commands, defined in configurator.c */
 void restart(void);
 void gtk_run(void);
-void panel_destroy(Panel *p);
 
 static void process_client_msg ( XClientMessageEvent* ev )
 {
@@ -258,10 +313,10 @@ static void process_client_msg ( XClientMessageEvent* ev )
             GSList* l;
             for( l = all_panels; l; l = l->next )
             {
-                Panel* p = (Panel*)l->data;
+                LXPanel* p = (LXPanel*)l->data;
                 GList *plugins, *pl;
 
-                plugins = gtk_container_get_children(GTK_CONTAINER(p->box));
+                plugins = gtk_container_get_children(GTK_CONTAINER(p->priv->box));
                 for (pl = plugins; pl; pl = pl->next)
                 {
                     LXPanelPluginInit *init = PLUGIN_CLASS(pl->data);
@@ -281,7 +336,7 @@ static void process_client_msg ( XClientMessageEvent* ev )
 #endif
         case LXPANEL_CMD_CONFIG:
             {
-            Panel * p = ((all_panels != NULL) ? all_panels->data : NULL);
+            LXPanel * p = ((all_panels != NULL) ? all_panels->data : NULL);
             if (p != NULL)
                 panel_configure(p, 0);
             }
@@ -330,14 +385,14 @@ panel_event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer not_used)
         {
             GSList* l;
             for( l = all_panels; l; l = l->next )
-                ((Panel*)l->data)->curdesk = get_net_current_desktop();
+                ((LXPanel*)l->data)->priv->curdesk = get_net_current_desktop();
             fb_ev_emit(fbev, EV_CURRENT_DESKTOP);
         }
         else if (at == a_NET_NUMBER_OF_DESKTOPS)
         {
             GSList* l;
             for( l = all_panels; l; l = l->next )
-                ((Panel*)l->data)->desknum = get_net_number_of_desktops();
+                ((LXPanel*)l->data)->priv->desknum = get_net_number_of_desktops();
             fb_ev_emit(fbev, EV_NUMBER_OF_DESKTOPS);
         }
         else if (at == a_NET_DESKTOP_NAMES)
@@ -357,9 +412,9 @@ panel_event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer not_used)
             GSList* l;
             for( l = all_panels; l; l = l->next )
             {
-                Panel* p = (Panel*)l->data;
-                if (p->transparent) {
-                    fb_bg_notify_changed_bg(p->bg);
+                LXPanel* p = (LXPanel*)l->data;
+                if (p->priv->transparent) {
+                    fb_bg_notify_changed_bg(p->priv->bg);
                 }
             }
         }
@@ -368,9 +423,9 @@ panel_event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer not_used)
             GSList* l;
             for( l = all_panels; l; l = l->next )
             {
-                Panel* p = (Panel*)l->data;
-                g_free( p->workarea );
-                p->workarea = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_WORKAREA, XA_CARDINAL, &p->wa_len);
+                LXPanel* p = (LXPanel*)l->data;
+                g_free( p->priv->workarea );
+                p->priv->workarea = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_WORKAREA, XA_CARDINAL, &p->priv->wa_len);
                 /* print_wmdata(p); */
             }
         }
@@ -404,19 +459,26 @@ panel_destroy_event(GtkWidget * widget, GdkEvent * event, gpointer data)
 }
 
 static void
-on_root_bg_changed(FbBg *bg, Panel* p)
+on_root_bg_changed(FbBg *bg, LXPanel* p)
 {
-    panel_update_background( p );
+    _panel_update_background( p );
 }
 
-void panel_determine_background_pixmap(Panel * p, GtkWidget * widget, GdkWindow * window)
+void panel_determine_background_pixmap(Panel * panel, GtkWidget * widget, GdkWindow * window)
+{
+    _panel_determine_background_pixmap(panel->topgwin, widget);
+}
+
+void _panel_determine_background_pixmap(LXPanel * panel, GtkWidget * widget)
 {
     GdkPixmap * pixmap = NULL;
+    GdkWindow * window = gtk_widget_get_window(widget);
+    Panel * p = panel->priv;
 
     /* Free p->bg if it is not going to be used. */
     if (( ! p->transparent) && (p->bg != NULL))
     {
-        g_signal_handlers_disconnect_by_func(G_OBJECT(p->bg), on_root_bg_changed, p);
+        g_signal_handlers_disconnect_by_func(G_OBJECT(p->bg), on_root_bg_changed, panel);
         g_object_unref(p->bg);
         p->bg = NULL;
     }
@@ -434,7 +496,7 @@ void panel_determine_background_pixmap(Panel * p, GtkWidget * widget, GdkWindow
         if (p->bg == NULL)
         {
             p->bg = fb_bg_get_for_display();
-            g_signal_connect(G_OBJECT(p->bg), "changed", G_CALLBACK(on_root_bg_changed), p);
+            g_signal_connect(G_OBJECT(p->bg), "changed", G_CALLBACK(on_root_bg_changed), panel);
         }
         pixmap = fb_bg_get_xroot_pix_for_win(p->bg, widget);
         if ((pixmap != NULL) && (pixmap != GDK_NO_BG) && (p->alpha != 0))
@@ -455,30 +517,36 @@ void panel_determine_background_pixmap(Panel * p, GtkWidget * widget, GdkWindow
  * This function should only be called after the panel has been realized. */
 void panel_update_background(Panel * p)
 {
+    _panel_update_background(p->topgwin);
+}
+
+void _panel_update_background(LXPanel * p)
+{
+    GtkWidget *w = GTK_WIDGET(p);
     GList *plugins, *l;
 
     /* Redraw the top level widget. */
-    panel_determine_background_pixmap(p, p->topgwin, gtk_widget_get_window(p->topgwin));
-    gdk_window_clear(gtk_widget_get_window(p->topgwin));
-    gtk_widget_queue_draw(p->topgwin);
+    _panel_determine_background_pixmap(p, w);
+    gdk_window_clear(gtk_widget_get_window(w));
+    gtk_widget_queue_draw(w);
 
     /* Loop over all plugins redrawing each plugin. */
-    plugins = gtk_container_get_children(GTK_CONTAINER(p->box));
+    plugins = gtk_container_get_children(GTK_CONTAINER(p->priv->box));
     for (l = plugins; l != NULL; l = l->next)
         plugin_widget_set_background(l->data, p);
     g_list_free(plugins);
 }
 
-static gboolean delay_update_background( Panel* p )
+static gboolean delay_update_background( GtkWidget* p )
 {
     /* Panel could be destroyed while background update scheduled */
 #if GTK_CHECK_VERSION(2, 20, 0)
-    if (p->topgwin && gtk_widget_get_realized(p->topgwin)) {
+    if (gtk_widget_get_realized(p)) {
 #else
-    if ( p->topgwin && GTK_WIDGET_REALIZED ( p->topgwin ) ) {
+    if (GTK_WIDGET_REALIZED(p)) {
 #endif
-       gdk_display_sync( gtk_widget_get_display(p->topgwin) );
-       panel_update_background( p );
+       gdk_display_sync( gtk_widget_get_display(p) );
+       _panel_update_background( LXPANEL(p) );
     }
 
     return FALSE;
@@ -488,7 +556,7 @@ static void
 panel_realize(GtkWidget *widget, Panel *p)
 {
     g_idle_add_full( G_PRIORITY_LOW,
-            (GSourceFunc)delay_update_background, p, NULL );
+            (GSourceFunc)delay_update_background, widget, NULL );
 }
 
 static void
@@ -501,7 +569,7 @@ panel_style_set(GtkWidget *widget, GtkStyle* prev, Panel *p)
     if( GTK_WIDGET_REALIZED( widget ) )
 #endif
         g_idle_add_full( G_PRIORITY_LOW,
-                (GSourceFunc)delay_update_background, p, NULL );
+                (GSourceFunc)delay_update_background, widget, NULL );
 }
 
 static gint
@@ -536,12 +604,12 @@ panel_size_alloc(GtkWidget *widget, GtkAllocation *a, Panel *p)
         p->height = (p->orientation == GTK_ORIENTATION_HORIZONTAL) ? a->height : a->width;
     calculate_position(p);
 
-    if (a->width == p->aw && a->height == p->ah && a->x == p->ax && a->y == p ->ay) {
+    if (a->width == p->aw && a->height == p->ah && a->x == p->ax && a->y == p->ay) {
         RET(TRUE);
     }
 
-    gtk_window_move(GTK_WINDOW(p->topgwin), p->ax, p->ay);
-    panel_set_wm_strut(p);
+    gtk_window_move(GTK_WINDOW(widget), p->ax, p->ay);
+    _panel_set_wm_strut(LXPANEL(widget));
     RET(TRUE);
 }
 
@@ -594,11 +662,12 @@ typedef enum
     AH_STATE_HIDDEN
 } PanelAHState;
 
-static void ah_state_set(Panel *p, PanelAHState ah_state);
+static void ah_state_set(LXPanel *p, PanelAHState ah_state);
 
 static gboolean
-mouse_watch(Panel *p)
+mouse_watch(LXPanel *panel)
 {
+    Panel *p = panel->priv;
     gint x, y;
 
     if (g_source_is_destroyed(g_main_current_source()))
@@ -641,7 +710,7 @@ mouse_watch(Panel *p)
     }
     p->ah_far = ((x < cx) || (x > cx + cw) || (y < cy) || (y > cy + ch));
 
-    ah_state_set(p, p->ah_state);
+    ah_state_set(panel, p->ah_state);
     RET(TRUE);
 }
 
@@ -650,37 +719,39 @@ static gboolean ah_state_hide_timeout(gpointer p)
     if (!g_source_is_destroyed(g_main_current_source()))
     {
         ah_state_set(p, AH_STATE_HIDDEN);
-        ((Panel *)p)->hide_timeout = 0;
+        ((LXPanel *)p)->priv->hide_timeout = 0;
     }
     return FALSE;
 }
 
-static void ah_state_set(Panel *p, PanelAHState ah_state)
+static void ah_state_set(LXPanel *panel, PanelAHState ah_state)
 {
+    Panel *p = panel->priv;
+
     ENTER;
     if (p->ah_state != ah_state) {
         p->ah_state = ah_state;
         switch (ah_state) {
         case AH_STATE_VISIBLE:
-            gtk_widget_show(p->topgwin);
+            gtk_widget_show(GTK_WIDGET(panel));
             gtk_widget_show(p->box);
-            gtk_window_stick(GTK_WINDOW(p->topgwin));
+            gtk_window_stick(GTK_WINDOW(panel));
             p->visible = TRUE;
             break;
         case AH_STATE_WAITING:
-            p->hide_timeout = g_timeout_add(2 * PERIOD, ah_state_hide_timeout, p);
+            p->hide_timeout = g_timeout_add(2 * PERIOD, ah_state_hide_timeout, panel);
             break;
         case AH_STATE_HIDDEN:
             if (p->height_when_hidden > 0)
                 gtk_widget_hide(p->box);
             else
-                gtk_widget_hide(p->topgwin);
+                gtk_widget_hide(GTK_WIDGET(panel));
             p->visible = FALSE;
         }
     } else if (p->autohide && p->ah_far) {
         switch (ah_state) {
         case AH_STATE_VISIBLE:
-            ah_state_set(p, AH_STATE_WAITING);
+            ah_state_set(panel, AH_STATE_WAITING);
             break;
         case AH_STATE_WAITING:
             break;
@@ -691,13 +762,13 @@ static void ah_state_set(Panel *p, PanelAHState ah_state)
                 if (gtk_widget_get_visible(p->box))
                 {
                     gtk_widget_hide(p->box);
-                    gtk_widget_show(p->topgwin);
+                    gtk_widget_show(GTK_WIDGET(panel));
                 }
             }
             else
-                if (gtk_widget_get_visible(p->topgwin))
+                if (gtk_widget_get_visible(GTK_WIDGET(panel)))
                 {
-                    gtk_widget_hide(p->topgwin);
+                    gtk_widget_hide(GTK_WIDGET(panel));
                     gtk_widget_show(p->box);
                 }
         }
@@ -711,32 +782,32 @@ static void ah_state_set(Panel *p, PanelAHState ah_state)
             p->hide_timeout = 0;
             /* continue with setting visible */
         case AH_STATE_HIDDEN:
-            ah_state_set(p, AH_STATE_VISIBLE);
+            ah_state_set(panel, AH_STATE_VISIBLE);
         }
     }
     RET();
 }
 
 /* starts autohide behaviour */
-static void ah_start(Panel *p)
+static void ah_start(LXPanel *p)
 {
     ENTER;
-    if (!p->mouse_timeout)
-        p->mouse_timeout = g_timeout_add(PERIOD, (GSourceFunc) mouse_watch, p);
+    if (!p->priv->mouse_timeout)
+        p->priv->mouse_timeout = g_timeout_add(PERIOD, (GSourceFunc) mouse_watch, p);
     RET();
 }
 
 /* stops autohide */
-static void ah_stop(Panel *p)
+static void ah_stop(LXPanel *p)
 {
     ENTER;
-    if (p->mouse_timeout) {
-        g_source_remove(p->mouse_timeout);
-        p->mouse_timeout = 0;
+    if (p->priv->mouse_timeout) {
+        g_source_remove(p->priv->mouse_timeout);
+        p->priv->mouse_timeout = 0;
     }
-    if (p->hide_timeout) {
-        g_source_remove(p->hide_timeout);
-        p->hide_timeout = 0;
+    if (p->priv->hide_timeout) {
+        g_source_remove(p->priv->hide_timeout);
+        p->priv->hide_timeout = 0;
     }
     RET();
 }
@@ -746,7 +817,7 @@ panel_map_event(GtkWidget *widget, GdkEvent *event, Panel *p)
 {
     ENTER;
     if (p->autohide)
-        ah_start(p);
+        ah_start(LXPANEL(widget));
     RET(FALSE);
 }
 /* end of the autohide code
@@ -755,12 +826,12 @@ panel_map_event(GtkWidget *widget, GdkEvent *event, Panel *p)
 static gint
 panel_popupmenu_configure(GtkWidget *widget, gpointer user_data)
 {
-    panel_configure( (Panel*)user_data, 0 );
+    panel_configure( (LXPanel*)user_data, 0 );
     return TRUE;
 }
 
 /* Handler for "button_press_event" signal with Panel as parameter. */
-static gboolean panel_button_press_event_with_panel(GtkWidget *widget, GdkEventButton *event, Panel *panel)
+static gboolean panel_button_press_event_with_panel(GtkWidget *widget, GdkEventButton *event, LXPanel *panel)
 {
     if (event->button == 3) /* right button */
     {
@@ -773,7 +844,7 @@ static gboolean panel_button_press_event_with_panel(GtkWidget *widget, GdkEventB
 
 static void panel_popupmenu_config_plugin( GtkMenuItem* item, GtkWidget* plugin )
 {
-    Panel *panel = PLUGIN_PANEL(plugin);
+    Panel *panel = PLUGIN_PANEL(plugin)->priv;
 
     lxpanel_plugin_show_config_dialog(plugin);
 
@@ -781,7 +852,7 @@ static void panel_popupmenu_config_plugin( GtkMenuItem* item, GtkWidget* plugin
     panel->config_changed = TRUE;
 }
 
-static void panel_popupmenu_add_item( GtkMenuItem* item, Panel* panel )
+static void panel_popupmenu_add_item( GtkMenuItem* item, LXPanel* panel )
 {
     /* panel_add_plugin( panel, panel->topgwin ); */
     panel_configure( panel, 2 );
@@ -789,7 +860,7 @@ static void panel_popupmenu_add_item( GtkMenuItem* item, Panel* panel )
 
 static void panel_popupmenu_remove_item( GtkMenuItem* item, GtkWidget* plugin )
 {
-    Panel* panel = PLUGIN_PANEL(plugin);
+    Panel* panel = PLUGIN_PANEL(plugin)->priv;
 
     /* If the configuration dialog is open, there will certainly be a crash if the
      * user manipulates the Configured Plugins list, after we remove this entry.
@@ -803,7 +874,7 @@ static void panel_popupmenu_remove_item( GtkMenuItem* item, GtkWidget* plugin )
     /* reset conf pointer because the widget still may be referenced by configurator */
     g_object_set_qdata(G_OBJECT(plugin), lxpanel_plugin_qconf, NULL);
 
-    panel_config_save(panel);
+    lxpanel_config_save(PLUGIN_PANEL(plugin));
     gtk_widget_destroy(plugin);
 }
 
@@ -840,12 +911,13 @@ static char* gen_panel_name( int edge, gint monitor )
 
 /* FIXME: Potentially we can support multiple panels at the same edge,
  * but currently this cannot be done due to some positioning problems. */
-static void panel_popupmenu_create_panel( GtkMenuItem* item, Panel* panel )
+static void panel_popupmenu_create_panel( GtkMenuItem* item, LXPanel* panel )
 {
     gint m, e, monitors;
     GdkScreen *screen;
     GtkWidget *err;
-    Panel* new_panel = panel_allocate();
+    LXPanel *new_panel = panel_allocate();
+    Panel *p = new_panel->priv;
 
     /* Allocate the edge. */
     screen = gdk_screen_get_default();
@@ -856,15 +928,15 @@ static void panel_popupmenu_create_panel( GtkMenuItem* item, Panel* panel )
         /* try each of the four edges */
         for(e=1; e<5; ++e)
         {
-            if(panel_edge_available(new_panel,e,m)) {
-                new_panel->edge = e;
-                new_panel->monitor = m;
+            if(panel_edge_available(p,e,m)) {
+                p->edge = e;
+                p->monitor = m;
                 goto found_edge;
             }
         }
     }
 
-    panel_destroy(new_panel);
+    gtk_widget_destroy(GTK_WIDGET(new_panel));
     ERR("Error adding panel: There is no room for another panel. All the edges are taken.\n");
     err = gtk_message_dialog_new(NULL,0,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("There is no room for another panel. All the edges are taken."));
     gtk_dialog_run(GTK_DIALOG(err));
@@ -872,24 +944,24 @@ static void panel_popupmenu_create_panel( GtkMenuItem* item, Panel* panel )
     return;
 
 found_edge:
-    new_panel->name = gen_panel_name(new_panel->edge,new_panel->monitor);
+    p->name = gen_panel_name(p->edge, p->monitor);
 
     /* create new config with first group "Global" */
-    config_group_add_subgroup(config_root_setting(new_panel->config), "Global");
+    config_group_add_subgroup(config_root_setting(p->config), "Global");
     panel_configure(new_panel, 0);
-    panel_normalize_configuration(new_panel);
+    panel_normalize_configuration(p);
     panel_start_gui(new_panel);
-    gtk_widget_show_all(new_panel->topgwin);
+    gtk_widget_show_all(GTK_WIDGET(new_panel));
 
-    panel_config_save(new_panel);
+    lxpanel_config_save(new_panel);
     all_panels = g_slist_prepend(all_panels, new_panel);
 }
 
-static void panel_popupmenu_delete_panel( GtkMenuItem* item, Panel* panel )
+static void panel_popupmenu_delete_panel( GtkMenuItem* item, LXPanel* panel )
 {
     GtkWidget* dlg;
     gboolean ok;
-    dlg = gtk_message_dialog_new_with_markup( GTK_WINDOW(panel->topgwin),
+    dlg = gtk_message_dialog_new_with_markup( GTK_WINDOW(panel),
                                                     GTK_DIALOG_MODAL,
                                                     GTK_MESSAGE_QUESTION,
                                                     GTK_BUTTONS_OK_CANCEL,
@@ -904,11 +976,11 @@ static void panel_popupmenu_delete_panel( GtkMenuItem* item, Panel* panel )
         all_panels = g_slist_remove( all_panels, panel );
 
         /* delete the config file of this panel */
-        fname = _user_config_file_name("panels", panel->name);
+        fname = _user_config_file_name("panels", panel->priv->name);
         g_unlink( fname );
         g_free(fname);
-        panel->config_changed = 0;
-        panel_destroy( panel );
+        panel->priv->config_changed = 0;
+        gtk_widget_destroy(GTK_WIDGET(panel));
     }
 }
 
@@ -979,7 +1051,7 @@ void panel_apply_icon( GtkWindow *w )
     gtk_window_set_icon(w, window_icon);
 }
 
-GtkMenu* lxpanel_get_plugin_menu( Panel* panel, GtkWidget* plugin, gboolean use_sub_menu )
+GtkMenu* lxpanel_get_plugin_menu( LXPanel* panel, GtkWidget* plugin, gboolean use_sub_menu )
 {
     GtkWidget  *menu_item, *img;
     GtkMenu *ret,*menu;
@@ -1059,7 +1131,7 @@ GtkMenu* lxpanel_get_plugin_menu( Panel* panel, GtkWidget* plugin, gboolean use_
     menu_item = gtk_image_menu_item_new_with_label(_("About"));
     gtk_image_menu_item_set_image( (GtkImageMenuItem*)menu_item, img );
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
-    g_signal_connect( menu_item, "activate", G_CALLBACK(panel_popupmenu_about), panel );
+    g_signal_connect( menu_item, "activate", G_CALLBACK(panel_popupmenu_about), panel->priv );
 
     if( use_sub_menu )
     {
@@ -1077,7 +1149,7 @@ GtkMenu* lxpanel_get_plugin_menu( Panel* panel, GtkWidget* plugin, gboolean use_
 /* for old plugins compatibility */
 GtkMenu* lxpanel_get_panel_menu( Panel* panel, Plugin* plugin, gboolean use_sub_menu )
 {
-    return lxpanel_get_plugin_menu(panel, plugin->pwid, use_sub_menu);
+    return lxpanel_get_plugin_menu(panel->topgwin, plugin->pwid, use_sub_menu);
 }
 
 /****************************************************
@@ -1108,7 +1180,12 @@ void panel_set_dock_type(Panel *p)
 
 void panel_establish_autohide(Panel *p)
 {
-    if (p->autohide)
+    _panel_establish_autohide(p->topgwin);
+}
+
+void _panel_establish_autohide(LXPanel *p)
+{
+    if (p->priv->autohide)
         ah_start(p);
     else
     {
@@ -1128,6 +1205,11 @@ void panel_image_set_from_file(Panel * p, GtkWidget * image, const char * file)
     }
 }
 
+void lxpanel_image_set_from_file(LXPanel * p, GtkWidget * image, const char * file)
+{
+    panel_image_set_from_file(p->priv, image, file);
+}
+
 /* Set an image from a icon theme with scaling to the panel icon size. */
 gboolean panel_image_set_icon_theme(Panel * p, GtkWidget * image, const gchar * icon)
 {
@@ -1141,13 +1223,20 @@ gboolean panel_image_set_icon_theme(Panel * p, GtkWidget * image, const gchar *
     return FALSE;
 }
 
+gboolean lxpanel_image_set_icon_theme(LXPanel * p, GtkWidget * image, const gchar * icon)
+{
+    return panel_image_set_icon_theme(p->priv, image, icon);
+}
+
 static void
-panel_start_gui(Panel *p)
+panel_start_gui(LXPanel *panel)
 {
     Atom state[3];
     XWMHints wmhints;
     guint32 val;
     Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+    Panel *p = panel->priv;
+    GtkWidget *w = GTK_WIDGET(panel);
 
     ENTER;
 
@@ -1157,53 +1246,51 @@ panel_start_gui(Panel *p)
 
     /* main toplevel window */
     /* p->topgwin =  gtk_window_new(GTK_WINDOW_TOPLEVEL); */
-    p->topgwin = (GtkWidget*)g_object_new(PANEL_TOPLEVEL_TYPE, NULL);
-    gtk_widget_set_name(p->topgwin, "PanelToplevel");
+    gtk_widget_set_name(w, "PanelToplevel");
     p->display = gdk_display_get_default();
-    gtk_container_set_border_width(GTK_CONTAINER(p->topgwin), 0);
-    gtk_window_set_resizable(GTK_WINDOW(p->topgwin), FALSE);
-    gtk_window_set_wmclass(GTK_WINDOW(p->topgwin), "panel", "lxpanel");
-    gtk_window_set_title(GTK_WINDOW(p->topgwin), "panel");
-    gtk_window_set_position(GTK_WINDOW(p->topgwin), GTK_WIN_POS_NONE);
-    gtk_window_set_decorated(GTK_WINDOW(p->topgwin), FALSE);
+    gtk_container_set_border_width(GTK_CONTAINER(panel), 0);
+    gtk_window_set_resizable(GTK_WINDOW(panel), FALSE);
+    gtk_window_set_wmclass(GTK_WINDOW(panel), "panel", "lxpanel");
+    gtk_window_set_title(GTK_WINDOW(panel), "panel");
+    gtk_window_set_position(GTK_WINDOW(panel), GTK_WIN_POS_NONE);
+    gtk_window_set_decorated(GTK_WINDOW(panel), FALSE);
 
-    gtk_window_group_add_window( win_grp, (GtkWindow*)p->topgwin );
+    gtk_window_group_add_window( win_grp, (GtkWindow*)panel );
 
-    g_signal_connect(G_OBJECT(p->topgwin), "delete-event",
+    g_signal_connect(G_OBJECT(panel), "delete-event",
           G_CALLBACK(panel_delete_event), p);
-    g_signal_connect(G_OBJECT(p->topgwin), "destroy-event",
+    g_signal_connect(G_OBJECT(panel), "destroy-event",
           G_CALLBACK(panel_destroy_event), p);
-    g_signal_connect (G_OBJECT (p->topgwin), "size-request",
+    g_signal_connect (G_OBJECT (panel), "size-request",
           (GCallback) panel_size_req, p);
-    g_signal_connect (G_OBJECT (p->topgwin), "size-allocate",
+    g_signal_connect (G_OBJECT (panel), "size-allocate",
           (GCallback) panel_size_alloc, p);
-    g_signal_connect (G_OBJECT (p->topgwin), "configure-event",
+    g_signal_connect (G_OBJECT (panel), "configure-event",
           (GCallback) panel_configure_event, p);
-    g_signal_connect(G_OBJECT(p->topgwin), "map-event",
+    g_signal_connect(G_OBJECT(panel), "map-event",
           G_CALLBACK(panel_map_event), p);
 
-    gtk_widget_add_events( p->topgwin, GDK_BUTTON_PRESS_MASK );
-    g_signal_connect(G_OBJECT (p->topgwin), "button-press-event",
-          (GCallback) panel_button_press_event_with_panel, p);
+    gtk_widget_add_events( w, GDK_BUTTON_PRESS_MASK );
+    g_signal_connect(G_OBJECT (panel), "button-press-event",
+          (GCallback) panel_button_press_event_with_panel, panel);
 
-    g_signal_connect (G_OBJECT (p->topgwin), "realize",
+    g_signal_connect (G_OBJECT (panel), "realize",
           (GCallback) panel_realize, p);
 
-    g_signal_connect (G_OBJECT (p->topgwin), "style-set",
+    g_signal_connect (G_OBJECT (panel), "style-set",
           (GCallback)panel_style_set, p);
-    gtk_widget_realize(p->topgwin);
+    gtk_widget_realize(w);
     //gdk_window_set_decorations(gtk_widget_get_window(p->topgwin), 0);
 
     // main layout manager as a single child of panel
-    p->box = panel_box_new(p, FALSE, 0);
+    p->box = panel_box_new(panel, FALSE, 0);
     gtk_container_set_border_width(GTK_CONTAINER(p->box), 0);
-//    gtk_container_add(GTK_CONTAINER(p->bbox), p->box);
-    gtk_container_add(GTK_CONTAINER(p->topgwin), p->box);
+    gtk_container_add(GTK_CONTAINER(panel), p->box);
     gtk_widget_show(p->box);
     if (p->round_corners)
         make_round_corners(p);
 
-    p->topxwin = GDK_WINDOW_XWINDOW(gtk_widget_get_window(p->topgwin));
+    p->topxwin = GDK_WINDOW_XWINDOW(gtk_widget_get_window(w));
     DBG("topxwin = %x\n", p->topxwin);
 
     /* the settings that should be done before window is mapped */
@@ -1219,10 +1306,10 @@ panel_start_gui(Panel *p)
     panel_set_dock_type(p);
 
     /* window mapping point */
-    gtk_widget_show_all(p->topgwin);
+    gtk_widget_show_all(w);
 
     /* the settings that should be done after window is mapped */
-    panel_establish_autohide(p);
+    _panel_establish_autohide(panel);
 
     /* send it to running wm */
     Xclimsg(p->topxwin, a_NET_WM_DESKTOP, 0xFFFFFFFF, 0, 0, 0, 0);
@@ -1237,9 +1324,9 @@ panel_start_gui(Panel *p)
     XChangeProperty(xdisplay, p->topxwin, a_NET_WM_STATE, XA_ATOM,
           32, PropModeReplace, (unsigned char *) state, 3);
 
-    calculate_position(p);
-    gdk_window_move_resize(gtk_widget_get_window(p->topgwin), p->ax, p->ay, p->aw, p->ah);
-    panel_set_wm_strut(p);
+    _calculate_position(panel);
+    gdk_window_move_resize(gtk_widget_get_window(w), p->ax, p->ay, p->aw, p->ah);
+    _panel_set_wm_strut(panel);
     p->initialized = TRUE;
 
     RET();
@@ -1336,8 +1423,21 @@ void panel_draw_label_text(Panel * p, GtkWidget * label, const char * text,
     g_free(escaped_text);
 }
 
+void lxpanel_draw_label_text(LXPanel * p, GtkWidget * label, const char * text,
+                           gboolean bold, float custom_size_factor,
+                           gboolean custom_color)
+{
+    panel_draw_label_text(p->priv, label, text, bold, custom_size_factor, custom_color);
+}
+
 void panel_set_panel_configuration_changed(Panel *p)
 {
+    _panel_set_panel_configuration_changed(p->topgwin);
+}
+
+void _panel_set_panel_configuration_changed(LXPanel *panel)
+{
+    Panel *p = panel->priv;
     GList *plugins, *l;
 
     GtkOrientation previous_orientation = p->orientation;
@@ -1385,12 +1485,12 @@ void panel_set_panel_configuration_changed(Panel *p)
         GtkWidget *w = (GtkWidget*)l->data;
         LXPanelPluginInit *init = PLUGIN_CLASS(w);
         if (init->reconfigure)
-            init->reconfigure(p, w);
+            init->reconfigure(panel, w);
     }
     g_list_free(plugins);
     /* panel geometry changed? update panel background then */
     g_idle_add_full( G_PRIORITY_LOW,
-                    (GSourceFunc)delay_update_background, p, NULL );
+                    (GSourceFunc)delay_update_background, panel, NULL );
 }
 
 static int
@@ -1473,7 +1573,7 @@ panel_parse_global(Panel *p, config_setting_t *cfg)
 }
 
 static int
-panel_parse_plugin(Panel *p, config_setting_t *cfg)
+panel_parse_plugin(LXPanel *p, config_setting_t *cfg)
 {
     const char *type = NULL;
 
@@ -1491,7 +1591,7 @@ error:
     RET(0);
 }
 
-int panel_start( Panel *p )
+int panel_start( LXPanel *p )
 {
     config_setting_t *list, *s;
     int i;
@@ -1499,8 +1599,8 @@ int panel_start( Panel *p )
     /* parse global section */
     ENTER;
 
-    list = config_setting_get_member(config_root_setting(p->config), "");
-    if (!list || !panel_parse_global(p, config_setting_get_elem(list, 0)))
+    list = config_setting_get_member(config_root_setting(p->priv->config), "");
+    if (!list || !panel_parse_global(p->priv, config_setting_get_elem(list, 0)))
         RET(0);
 
     panel_start_gui(p);
@@ -1513,64 +1613,29 @@ int panel_start( Panel *p )
             config_setting_remove_elem(list, i);
 
     /* update backgrond of panel and all plugins */
-    panel_update_background( p );
+    _panel_update_background(p);
     return 1;
 }
 
 void panel_destroy(Panel *p)
 {
-    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
-    ENTER;
-
-    if (p->autohide)
-        ah_stop(p);
-    if (p->pref_dialog != NULL)
-        gtk_widget_destroy(p->pref_dialog);
-    if (p->plugin_pref_dialog != NULL)
-        /* just close the dialog, it will do all required cleanup */
-        gtk_dialog_response(GTK_DIALOG(p->plugin_pref_dialog), GTK_RESPONSE_CLOSE);
-
-    if (p->bg != NULL)
-    {
-        g_signal_handlers_disconnect_by_func(G_OBJECT(p->bg), on_root_bg_changed, p);
-        g_object_unref(p->bg);
-    }
-
-    if( p->config_changed )
-        panel_config_save( p );
-    config_destroy(p->config);
-
-    if( p->topgwin )
-    {
-        gtk_window_group_remove_window( win_grp, GTK_WINDOW(  p->topgwin ) );
-        gtk_widget_destroy(p->topgwin);
-    }
-    g_free(p->workarea);
-    g_free( p->background_file );
-    g_slist_free( p->system_menus );
-    gdk_flush();
-    XFlush(xdisplay);
-    XSync(xdisplay, True);
-
-    g_free( p->name );
-    g_free(p);
-    RET();
+    gtk_widget_destroy(GTK_WIDGET(p->topgwin));
 }
 
-Panel* panel_new( const char* config_file, const char* config_name )
+static LXPanel* panel_new( const char* config_file, const char* config_name )
 {
-    Panel* panel = NULL;
+    LXPanel* panel = NULL;
 
     if (G_LIKELY(config_file))
     {
         panel = panel_allocate();
-        panel->name = g_strdup(config_name);
+        panel->priv->name = g_strdup(config_name);
         g_debug("starting panel from file %s",config_file);
-        if (!config_read_file(panel->config, config_file) ||
+        if (!config_read_file(panel->priv->config, config_file) ||
             !panel_start(panel))
         {
             ERR( "lxpanel: can't start panel\n");
-            panel_destroy( panel );
+            gtk_widget_destroy(GTK_WIDGET(panel));
             panel = NULL;
         }
     }
@@ -1690,7 +1755,7 @@ static void _start_panels_from_dir(const char *panel_dir)
         char* panel_config = g_build_filename( panel_dir, name, NULL );
         if (strchr(panel_config, '~') == NULL)    /* Skip editor backup files in case user has hand edited in this directory */
         {
-            Panel* panel = panel_new( panel_config, name );
+            LXPanel* panel = panel_new( panel_config, name );
             if( panel )
                 all_panels = g_slist_prepend( all_panels, panel );
         }
@@ -1848,7 +1913,7 @@ restart:
     gdk_window_remove_filter(gdk_get_default_root_window (), (GdkFilterFunc)panel_event_filter, NULL);
 
     /* destroy all panels */
-    g_slist_foreach( all_panels, (GFunc) panel_destroy, NULL );
+    g_slist_foreach( all_panels, (GFunc) gtk_widget_destroy, NULL );
     g_slist_free( all_panels );
     all_panels = NULL;
     g_free( cfgfile );
@@ -1866,64 +1931,68 @@ restart:
     g_object_unref(win_grp);
     g_object_unref(fbev);
 
-    return 0;
-}
+    /* FIXME: do restart more correct way:
+    if (!is_restarting)
+        return 0;
+    if (strchr(argv[0], G_PATH_SEPARATOR))
+        execve(argv[0], argv, env);
+    else
+        execve(g_find_program_in_path(argv[0]), argv, env);
+    return 1; */
 
-GtkOrientation panel_get_orientation(Panel *panel)
-{
-    return panel->orientation;
+    return 0;
 }
 
-gint panel_get_icon_size(Panel *panel)
+GtkOrientation panel_get_orientation(LXPanel *panel)
 {
-    return panel->icon_size;
+    return panel->priv->orientation;
 }
 
-gint panel_get_height(Panel *panel)
+gint panel_get_icon_size(LXPanel *panel)
 {
-    return panel->height;
+    return panel->priv->icon_size;
 }
 
-GtkWindow *panel_get_toplevel_window(Panel *panel)
+gint panel_get_height(LXPanel *panel)
 {
-    return GTK_WINDOW(panel->topgwin);
+    return panel->priv->height;
 }
 
-Window panel_get_xwindow(Panel *panel)
+Window panel_get_xwindow(LXPanel *panel)
 {
-    return panel->topxwin;
+    return panel->priv->topxwin;
 }
 
-gint panel_get_monitor(Panel *panel)
+gint panel_get_monitor(LXPanel *panel)
 {
-    return panel->monitor;
+    return panel->priv->monitor;
 }
 
-GtkStyle *panel_get_defstyle(Panel *panel)
+GtkStyle *panel_get_defstyle(LXPanel *panel)
 {
-    return panel->defstyle;
+    return panel->priv->defstyle;
 }
 
-GtkIconTheme *panel_get_icon_theme(Panel *panel)
+GtkIconTheme *panel_get_icon_theme(LXPanel *panel)
 {
-    return panel->icon_theme;
+    return panel->priv->icon_theme;
 }
 
-gboolean panel_is_at_bottom(Panel *panel)
+gboolean panel_is_at_bottom(LXPanel *panel)
 {
-    return panel->edge == EDGE_BOTTOM;
+    return panel->priv->edge == EDGE_BOTTOM;
 }
 
-GtkWidget *panel_box_new(Panel *panel, gboolean homogeneous, gint spacing)
+GtkWidget *panel_box_new(LXPanel *panel, gboolean homogeneous, gint spacing)
 {
-    if (panel->orientation == GTK_ORIENTATION_HORIZONTAL)
+    if (panel->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
         return gtk_hbox_new(homogeneous, spacing);
     return gtk_vbox_new(homogeneous, spacing);
 }
 
-GtkWidget *panel_separator_new(Panel *panel)
+GtkWidget *panel_separator_new(LXPanel *panel)
 {
-    if (panel->orientation == GTK_ORIENTATION_HORIZONTAL)
+    if (panel->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
         return gtk_vseparator_new();
     return gtk_hseparator_new();
 }
@@ -1934,10 +2003,10 @@ gboolean _class_is_present(LXPanelPluginInit *init)
 
     for (sl = all_panels; sl; sl = sl->next )
     {
-        Panel *panel = (Panel*)sl->data;
+        LXPanel *panel = (LXPanel*)sl->data;
         GList *plugins, *p;
 
-        plugins = gtk_container_get_children(GTK_CONTAINER(panel->box));
+        plugins = gtk_container_get_children(GTK_CONTAINER(panel->priv->box));
         for (p = plugins; p; p = p->next)
             if (PLUGIN_CLASS(p->data) == init)
             {
index 33747fb..2c9d082 100644 (file)
@@ -78,39 +78,57 @@ extern Atom a_MANAGER;
 
 extern Atom a_LXPANEL_CMD; /* for private client message */
 
+#define LX_TYPE_PANEL                  (lxpanel_get_type())
+#define LXPANEL(obj)                   (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+                                        LX_TYPE_PANEL, LXPanel))
+#define LXPANEL_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST((klass), \
+                                        LX_TYPE_PANEL, LXPanelClass))
+#define LX_IS_PANEL(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+                                        LX_TYPE_PANEL))
+
+extern GType lxpanel_get_type          (void) G_GNUC_CONST;
+
+/* A little trick to be compatible with some themes which rely on the
+   PanelToplevel class, so we use LXPanel as alias for PanelToplevel */
+typedef struct _LXPanel LXPanel;
+typedef struct _LXPanel PanelToplevel;
+typedef struct _LXPanelClass PanelToplevelClass;
+
 typedef struct _Panel Panel;
 
+struct _LXPanel
+{
+    GtkWindow window;
+    Panel *priv;
+};
+
+struct _LXPanelClass
+{
+    GtkWindowClass parent_class;
+};
+
 extern void panel_apply_icon(GtkWindow *w);
-extern void panel_destroy(Panel *p);
-extern void panel_adjust_geometry_terminology(Panel *p);
-extern void panel_determine_background_pixmap(Panel * p, GtkWidget * widget, GdkWindow * window);
-extern void panel_draw_label_text(Panel * p, GtkWidget * label, const char * text,
-                                  gboolean bold, float custom_size_factor,
-                                  gboolean custom_color);
-extern void panel_establish_autohide(Panel *p);
-extern void panel_image_set_from_file(Panel * p, GtkWidget * image, const char * file);
-extern gboolean panel_image_set_icon_theme(Panel * p, GtkWidget * image, const gchar * icon);
-extern void panel_set_wm_strut(Panel *p);
-extern void panel_set_dock_type(Panel *p);
-extern void panel_set_panel_configuration_changed(Panel *p);
-extern void panel_update_background( Panel* p );
+extern void lxpanel_draw_label_text(LXPanel * p, GtkWidget * label, const char * text,
+                                    gboolean bold, float custom_size_factor,
+                                    gboolean custom_color);
+extern void lxpanel_image_set_from_file(LXPanel * p, GtkWidget * image, const char * file);
+extern gboolean lxpanel_image_set_icon_theme(LXPanel * p, GtkWidget * image, const gchar * icon);
 
 extern int panel_handle_x_error(Display * d, XErrorEvent * ev);
 extern int panel_handle_x_error_swallow_BadWindow_BadDrawable(Display * d, XErrorEvent * ev);
 
-void panel_config_save(Panel *p); /* defined in configurator.c */
+void lxpanel_config_save(LXPanel *p); /* defined in configurator.c */
 
 /* Accessors APIs for Panel* */
-extern GtkOrientation panel_get_orientation(Panel *panel);
-extern gint panel_get_icon_size(Panel *panel);
-extern gint panel_get_height(Panel *panel);
-extern GtkWindow *panel_get_toplevel_window(Panel *panel);
-extern Window panel_get_xwindow(Panel *panel);
-extern gint panel_get_monitor(Panel *panel);
-extern GtkStyle *panel_get_defstyle(Panel *panel);
-extern GtkIconTheme *panel_get_icon_theme(Panel *panel);
-extern gboolean panel_is_at_bottom(Panel *panel);
-extern GtkWidget *panel_box_new(Panel *panel, gboolean homogeneous, gint spacing);
-extern GtkWidget *panel_separator_new(Panel *panel);
+extern GtkOrientation panel_get_orientation(LXPanel *panel);
+extern gint panel_get_icon_size(LXPanel *panel);
+extern gint panel_get_height(LXPanel *panel);
+extern Window panel_get_xwindow(LXPanel *panel);
+extern gint panel_get_monitor(LXPanel *panel);
+extern GtkStyle *panel_get_defstyle(LXPanel *panel);
+extern GtkIconTheme *panel_get_icon_theme(LXPanel *panel);
+extern gboolean panel_is_at_bottom(LXPanel *panel);
+extern GtkWidget *panel_box_new(LXPanel *panel, gboolean homogeneous, gint spacing);
+extern GtkWidget *panel_separator_new(LXPanel *panel);
 
 #endif
index 42f8a6a..66ee92f 100644 (file)
@@ -61,7 +61,7 @@ static inline LXPanelPluginInit *_find_plugin(const char *name)
     return g_hash_table_lookup(_all_types, name);
 }
 
-static GtkWidget *_old_plugin_config(Panel *panel, GtkWidget *instance, GtkWindow *parent)
+static GtkWidget *_old_plugin_config(LXPanel *panel, GtkWidget *instance, GtkWindow *parent)
 {
     LXPanelPluginInit *init = PLUGIN_CLASS(instance);
     Plugin * plugin;
@@ -73,7 +73,7 @@ static GtkWidget *_old_plugin_config(Panel *panel, GtkWidget *instance, GtkWindo
     return NULL;
 }
 
-static void _old_plugin_reconfigure(Panel *panel, GtkWidget *instance)
+static void _old_plugin_reconfigure(LXPanel *panel, GtkWidget *instance)
 {
     LXPanelPluginInit *init = PLUGIN_CLASS(instance);
     Plugin * plugin;
@@ -223,10 +223,11 @@ static void plugin_get_available_classes(void)
 }
 
 /* Recursively set the background of all widgets on a panel background configuration change. */
-void plugin_widget_set_background(GtkWidget * w, Panel * p)
+void plugin_widget_set_background(GtkWidget * w, LXPanel * panel)
 {
     if (w != NULL)
     {
+        Panel *p = panel->priv;
         if (gtk_widget_get_has_window(w))
         {
             if ((p->background) || (p->transparent))
@@ -237,7 +238,7 @@ void plugin_widget_set_background(GtkWidget * w, Panel * p)
                 if (GTK_WIDGET_REALIZED(w))
 #endif
                 {
-                    panel_determine_background_pixmap(p, w, gtk_widget_get_window(w));
+                    _panel_determine_background_pixmap(panel, w);
                     gdk_window_invalidate_rect(gtk_widget_get_window(w), NULL, TRUE);
                 }
             }
@@ -270,13 +271,13 @@ void plugin_widget_set_background(GtkWidget * w, Panel * p)
 
         /* Recursively process all children of a container. */
         if (GTK_IS_CONTAINER(w))
-            gtk_container_foreach(GTK_CONTAINER(w), (GtkCallback) plugin_widget_set_background, p);
+            gtk_container_foreach(GTK_CONTAINER(w), (GtkCallback) plugin_widget_set_background, panel);
     }
 }
 
 /* Handler for "button_press_event" signal with Plugin as parameter.
  * External so can be used from a plugin. */
-gboolean lxpanel_plugin_button_press_event(GtkWidget *plugin, GdkEventButton *event, Panel *panel)
+gboolean lxpanel_plugin_button_press_event(GtkWidget *plugin, GdkEventButton *event, LXPanel *panel)
 {
     if (event->button == 3) /* right button */
     {
@@ -294,7 +295,7 @@ gboolean plugin_button_press_event(GtkWidget *widget, GdkEventButton *event, Plu
 }
 
 /* Helper for position-calculation callback for popup menus. */
-void lxpanel_plugin_popup_set_position_helper(Panel * p, GtkWidget * near, GtkWidget * popup, gint * px, gint * py)
+void lxpanel_plugin_popup_set_position_helper(LXPanel * p, GtkWidget * near, GtkWidget * popup, gint * px, gint * py)
 {
     gint x, y;
     GtkAllocation allocation;
@@ -319,7 +320,7 @@ void lxpanel_plugin_popup_set_position_helper(Panel * p, GtkWidget * near, GtkWi
 
     /* Dispatch on edge to lay out the popup menu with respect to the button.
      * Also set "push-in" to avoid any case where it might flow off screen. */
-    switch (p->edge)
+    switch (p->priv->edge)
     {
         case EDGE_TOP:          y += allocation.height;         break;
         case EDGE_BOTTOM:       y -= popup_req.height;                break;
@@ -342,7 +343,7 @@ void lxpanel_plugin_popup_set_position_helper(Panel * p, GtkWidget * near, GtkWi
 /* for old plugins compatibility -- popup_req is ignored here */
 void plugin_popup_set_position_helper(Plugin * p, GtkWidget * near, GtkWidget * popup, GtkRequisition * popup_req, gint * px, gint * py)
 {
-    lxpanel_plugin_popup_set_position_helper(p->panel, near, popup, px, py);
+    lxpanel_plugin_popup_set_position_helper(p->panel->topgwin, near, popup, px, py);
 }
 
 /* Adjust the position of a popup window to ensure that it is not hidden by the panel.
@@ -350,7 +351,7 @@ void plugin_popup_set_position_helper(Plugin * p, GtkWidget * near, GtkWidget *
 void lxpanel_plugin_adjust_popup_position(GtkWidget * popup, GtkWidget * parent)
 {
     /* Initialize. */
-    Panel * p = PLUGIN_PANEL(parent);
+    Panel * p = PLUGIN_PANEL(parent)->priv;
     GtkAllocation allocation;
 
     gtk_widget_get_allocation(parent, &allocation);
@@ -419,7 +420,7 @@ static gboolean _open_dir_in_file_manager(GAppLaunchContext* ctx, GList* folder_
     return ret;
 }
 
-gboolean lxpanel_launch_path(Panel *panel, FmPath *path)
+gboolean lxpanel_launch_path(LXPanel *panel, FmPath *path)
 {
     return fm_launch_path_simple(NULL, NULL, path, _open_dir_in_file_manager, NULL);
 }
@@ -427,13 +428,13 @@ gboolean lxpanel_launch_path(Panel *panel, FmPath *path)
 void lxpanel_plugin_show_config_dialog(GtkWidget* plugin)
 {
     LXPanelPluginInit *init = PLUGIN_CLASS(plugin);
-    Panel *panel = PLUGIN_PANEL(plugin);
-    GtkWidget *dlg = panel->plugin_pref_dialog;
+    LXPanel *panel = PLUGIN_PANEL(plugin);
+    GtkWidget *dlg = panel->priv->plugin_pref_dialog;
 
     if (dlg && g_object_get_data(G_OBJECT(dlg), "generic-config-plugin") == plugin)
         return; /* configuration dialog is already shown for this widget */
     g_return_if_fail(panel != NULL);
-    dlg = init->config(panel, plugin, GTK_WINDOW(panel->topgwin));
+    dlg = init->config(panel, plugin, GTK_WINDOW(panel));
     if (dlg)
         _panel_show_config_dialog(panel, plugin, dlg);
 }
@@ -462,7 +463,6 @@ void _prepare_modules(void)
     lxpanel_plugin_qdata = g_quark_from_static_string("LXPanel::plugin-data");
     lxpanel_plugin_qinit = g_quark_from_static_string("LXPanel::plugin-init");
     lxpanel_plugin_qconf = g_quark_from_static_string("LXPanel::plugin-conf");
-    lxpanel_plugin_qpanel = g_quark_from_static_string("LXPanel::plugin-panel");
 #ifndef DISABLE_PLUGINS_LOADING
     fm_modules_add_directory(PACKAGE_LIB_DIR "/lxpanel/plugins");
     fm_module_register_lxpanel_gtk();
@@ -547,12 +547,12 @@ static void _on_old_widget_destroy(GtkWidget *widget, Plugin *pl)
     pl->class->destructor(pl);
 }
 
-//static void on_size_allocate(GtkWidget *widget, GdkRectangle *allocation, Panel *p)
+//static void on_size_allocate(GtkWidget *widget, GdkRectangle *allocation, LXPanel *p)
 //{
 //    _queue_panel_calculate_size(p);
 //}
 
-GtkWidget *lxpanel_add_plugin(Panel *p, const char *name, config_setting_t *cfg, gint at)
+GtkWidget *lxpanel_add_plugin(LXPanel *p, const char *name, config_setting_t *cfg, gint at)
 {
     LXPanelPluginInit *init;
     GtkWidget *widget;
@@ -607,7 +607,7 @@ GtkWidget *lxpanel_add_plugin(Panel *p, const char *name, config_setting_t *cfg,
         char *conf = config_setting_to_string(pconf), *fp;
 
         pl->class = pc;
-        pl->panel = p;
+        pl->panel = p->priv;
         widget = NULL;
         fp = &conf[9]; /* skip "Config {\n" */
         /* g_debug("created conf: %s",conf); */
@@ -629,13 +629,12 @@ GtkWidget *lxpanel_add_plugin(Panel *p, const char *name, config_setting_t *cfg,
         lxpanel_plugin_set_data(widget, pl, _old_plugin_destroy);
     }
     gtk_widget_set_name(widget, name);
-    gtk_box_pack_start(GTK_BOX(p->box), widget, expand, TRUE, padding);
+    gtk_box_pack_start(GTK_BOX(p->priv->box), widget, expand, TRUE, padding);
     gtk_container_set_border_width(GTK_CONTAINER(widget), border);
 //    g_signal_connect(widget, "size-allocate", G_CALLBACK(on_size_allocate), p);
     gtk_widget_show(widget);
     g_object_set_qdata(G_OBJECT(widget), lxpanel_plugin_qconf, cfg);
     g_object_set_qdata(G_OBJECT(widget), lxpanel_plugin_qinit, init);
-    g_object_set_qdata(G_OBJECT(widget), lxpanel_plugin_qpanel, p);
     return widget;
 }
 
index aa7b107..dc97b2b 100644 (file)
@@ -41,6 +41,8 @@ G_BEGIN_DECLS
  * @reconfigure: (allow-none): callback to apply panel configuration change
  * @button_press_event: (allow-none): callback on "button-press-event" signal
  * @show_system_menu: (allow-none): callback to queue show system menu
+ * @update_context_menu: (allow-none): callback to update context menu
+ * @control: (allow-none): callback to pass messages from lxpanelctl
  *
  * Callback @init is called on module loading, only once per application
  * lifetime.
@@ -63,6 +65,14 @@ G_BEGIN_DECLS
  * in the panel configuration dialog so the instance may change layout of
  * own subwidgets appropriately to new geometry.
  *
+ * Callback @button_press_event is a handler for "button-press-event"
+ * signal on the plugin instance. If this callback is not set then
+ * lxpanel_plugin_button_press_event() will be used.
+ *
+ * Callback @show_system_menu is called when lxpanel received a message
+ * by 'lxpanelctl menu' command. It will be sent to each instance if more
+ * than one with this callback available exists.
+ *
  * Callback @update_context_menu is called when panel context menu being
  * composed. The @menu contains only item for plugin instance config. The
  * callback can append or prepend own items to the menu. The callback
@@ -70,6 +80,11 @@ G_BEGIN_DECLS
  * submenu 'Panel' (therefore context menu will contain 'Settings' item,
  * any added ones, and 'Panel') and %FALSE if panel's common menu items
  * should be in this menu after separator.
+ *
+ * Callback @control is called when command was sent via the lxpanelctl.
+ * The message will be sent to only one instance of plugin. Some messages
+ * are handled by lxpanel: "STOP" will remove plugin from panel, "START"
+ * will create new instance if there is no instance yet. (TODO)
  */
 typedef struct {
     /*< public >*/
@@ -77,19 +92,22 @@ typedef struct {
     void (*finalize)(void);     /* optional finalize */
     char *name;                 /* name to represent in lists */
     char *description;          /* tooltip text */
-    GtkWidget *(*new_instance)(Panel *panel, config_setting_t *settings);
-    GtkWidget *(*config)(Panel *panel, GtkWidget *instance, GtkWindow *parent);
-    void (*reconfigure)(Panel *panel, GtkWidget *instance);
-    gboolean (*button_press_event)(GtkWidget *widget, GdkEventButton *event, Panel *panel);
+    GtkWidget *(*new_instance)(LXPanel *panel, config_setting_t *settings);
+    GtkWidget *(*config)(LXPanel *panel, GtkWidget *instance, GtkWindow *parent);
+    void (*reconfigure)(LXPanel *panel, GtkWidget *instance);
+    gboolean (*button_press_event)(GtkWidget *widget, GdkEventButton *event, LXPanel *panel);
     void (*show_system_menu)(GtkWidget *widget);
     gboolean (*update_context_menu)(GtkWidget *plugin, GtkMenu *menu);
+    gboolean (*control)(GtkWidget *plugin, const char *cmd); /* not implemented */
+    /*< private >*/
+    gpointer _reserved1;
+    gpointer _reserved2;
+    gpointer _reserved3;
+    /*< public >*/
     int one_per_system : 1;     /* True to disable more than one instance */
     int expand_available : 1;   /* True if "stretch" option is available */
     int expand_default : 1;     /* True if "stretch" option is default */
     int superseded : 1;         /* True if plugin was superseded by another */
-    /*< private >*/
-    gpointer _reserved1;
-    gpointer _reserved2;
 } LXPanelPluginInit; /* constant data */
 
 extern LXPanelPluginInit fm_module_init_lxpanel_gtk;
@@ -119,16 +137,16 @@ extern GQuark lxpanel_plugin_qdata; /* access to plugin private data */
 extern gboolean lxpanel_register_plugin_type(const char *name, LXPanelPluginInit *init);
 
 /* few helper functions */
-extern GtkMenu* lxpanel_get_plugin_menu(Panel* panel, GtkWidget* plugin, gboolean use_sub_menu);
-extern gboolean lxpanel_plugin_button_press_event(GtkWidget *plugin, GdkEventButton *event, Panel *panel);
+extern GtkMenu* lxpanel_get_plugin_menu(LXPanel* panel, GtkWidget* plugin, gboolean use_sub_menu);
+extern gboolean lxpanel_plugin_button_press_event(GtkWidget *plugin, GdkEventButton *event, LXPanel *panel);
                        /* Handler for "button_press_event" signal with Plugin as parameter */
 extern void lxpanel_plugin_adjust_popup_position(GtkWidget * popup, GtkWidget * plugin);
                        /* Helper to move popup windows away from the panel */
-extern void lxpanel_plugin_popup_set_position_helper(Panel * p, GtkWidget * near, GtkWidget * popup, gint * px, gint * py);
+extern void lxpanel_plugin_popup_set_position_helper(LXPanel * p, GtkWidget * near, GtkWidget * popup, gint * px, gint * py);
                        /* Helper for position-calculation callback for popup menus */
-extern void plugin_widget_set_background(GtkWidget * widget, Panel * p);
+extern void plugin_widget_set_background(GtkWidget * widget, LXPanel * p);
                        /* Recursively set the background of all widgets on a panel background configuration change */
-extern gboolean lxpanel_launch_path(Panel *panel, FmPath *path);
+extern gboolean lxpanel_launch_path(LXPanel *panel, FmPath *path);
 extern void lxpanel_plugin_show_config_dialog(GtkWidget* plugin);
                        /* Calls config() callback and shows configuration window */
 
index c8496be..caecc85 100644 (file)
@@ -87,7 +87,7 @@ typedef struct {
     battery* b;
     gboolean has_ac_adapter;
     gboolean show_extended_information;
-    Panel *panel;
+    LXPanel *panel;
     config_setting_t *settings;
 } lx_battery;
 
@@ -337,7 +337,7 @@ static int update_timout(lx_battery *lx_b) {
 
 /* An update will be performed whenever the user clicks on the charge bar */
 static gboolean buttonPressEvent(GtkWidget *p, GdkEventButton *event,
-                                 Panel *panel)
+                                 LXPanel *panel)
 {
     lx_battery *lx_b = lxpanel_plugin_get_data(p);
 
@@ -402,7 +402,7 @@ static gint exposeEvent(GtkWidget *widget, GdkEventExpose *event, lx_battery *lx
 }
 
 
-static GtkWidget * constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget * constructor(LXPanel *panel, config_setting_t *settings)
 {
     ENTER;
 
@@ -551,7 +551,7 @@ destructor(gpointer data)
 }
 
 
-static void orientation(Panel *panel, GtkWidget *p) {
+static void orientation(LXPanel *panel, GtkWidget *p) {
 
     ENTER;
 
@@ -619,7 +619,7 @@ static gboolean applyConfig(gpointer user_data)
 }
 
 
-static GtkWidget *config(Panel *panel, GtkWidget *p, GtkWindow *parent) {
+static GtkWidget *config(LXPanel *panel, GtkWidget *p, GtkWindow *parent) {
     lx_battery *b = lxpanel_plugin_get_data(p);
     return lxpanel_generic_config_dlg(_("Battery Monitor"),
             panel, applyConfig, p,
index b6b84f4..1cf3fcb 100644 (file)
@@ -228,7 +228,7 @@ static gboolean expose_event(GtkWidget * widget, GdkEventExpose * event, CPUPlug
 }
 
 /* Plugin constructor. */
-static GtkWidget *cpu_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *cpu_constructor(LXPanel *panel, config_setting_t *settings)
 {
     /* Allocate plugin context and set into Plugin private data pointer. */
     CPUPlugin * c = g_new0(CPUPlugin, 1);
index 08747ff..4b99ca0 100644 (file)
@@ -297,7 +297,7 @@ cpufreq_menu(cpufreq *cf){
 
 
 static  gboolean
-clicked(GtkWidget *widget, GdkEventButton *evt, Panel *panel)
+clicked(GtkWidget *widget, GdkEventButton *evt, LXPanel *panel)
 {
     ENTER2;
 
@@ -339,7 +339,7 @@ static gboolean update_tooltip(gpointer user_data)
     return _update_tooltip(user_data);
 }
 
-static GtkWidget *cpufreq_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *cpufreq_constructor(LXPanel *panel, config_setting_t *settings)
 {
     cpufreq *cf;
     //GtkWidget *button;
@@ -384,7 +384,7 @@ static gboolean applyConfig(gpointer user_data)
     return FALSE;
 }
 
-static GtkWidget *config(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *config(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     cpufreq *cf = lxpanel_plugin_get_data(p);
     return lxpanel_generic_config_dlg(_("CPUFreq frontend"), panel, applyConfig, p,
index 0b057e2..8f1c2e9 100644 (file)
@@ -37,7 +37,7 @@
 /* Private context for digital clock plugin. */
 typedef struct {
     GtkWidget * plugin;                                /* Back pointer to plugin */
-    Panel * panel;
+    LXPanel * panel;
     config_setting_t *settings;
     GtkWidget * clock_label;                   /* Label containing clock value */
     GtkWidget * clock_icon;                    /* Icon when icon_only */
@@ -102,7 +102,7 @@ static GtkWidget * dclock_create_calendar(DClockPlugin * dc)
 }
 
 /* Handler for "button-press-event" event from main widget. */
-static gboolean dclock_button_press_event(GtkWidget * widget, GdkEventButton * evt, Panel * panel)
+static gboolean dclock_button_press_event(GtkWidget * widget, GdkEventButton * evt, LXPanel * panel)
 {
     DClockPlugin * dc;
 
@@ -212,7 +212,7 @@ static gboolean dclock_update_display(DClockPlugin * dc)
         gchar * utf8 = g_locale_to_utf8(((newlines_converted != NULL) ? newlines_converted : clock_value), -1, NULL, NULL, NULL);
         if (utf8 != NULL)
         {
-            panel_draw_label_text(dc->panel, dc->clock_label, utf8, dc->bold, 1, TRUE);
+            lxpanel_draw_label_text(dc->panel, dc->clock_label, utf8, dc->bold, 1, TRUE);
             g_free(utf8);
         }
         g_free(newlines_converted);
@@ -281,7 +281,7 @@ static gboolean dclock_update_display(DClockPlugin * dc)
 }
 
 /* Plugin constructor. */
-static GtkWidget *dclock_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *dclock_constructor(LXPanel *panel, config_setting_t *settings)
 {
     /* Allocate and initialize plugin context and set into Plugin private data pointer. */
     DClockPlugin * dc = g_new0(DClockPlugin, 1);
@@ -372,8 +372,8 @@ static gboolean dclock_apply_configuration(gpointer user_data)
     /* Set up the icon or the label as the displayable widget. */
     if (dc->icon_only)
     {
-        if(panel_image_set_icon_theme(dc->panel, dc->clock_icon, "clock") != FALSE) {
-            panel_image_set_from_file(dc->panel, dc->clock_icon, PACKAGE_DATA_DIR "/images/clock.png");
+        if(lxpanel_image_set_icon_theme(dc->panel, dc->clock_icon, "clock") != FALSE) {
+            lxpanel_image_set_from_file(dc->panel, dc->clock_icon, PACKAGE_DATA_DIR "/images/clock.png");
         }
         gtk_widget_show(dc->clock_icon);
         gtk_widget_hide(dc->clock_label);
@@ -420,7 +420,7 @@ static gboolean dclock_apply_configuration(gpointer user_data)
 }
 
 /* Callback when the configuration dialog is to be shown. */
-static GtkWidget *dclock_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *dclock_configure(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     DClockPlugin * dc = lxpanel_plugin_get_data(p);
     return lxpanel_generic_config_dlg(_("Digital Clock"), panel,
@@ -436,7 +436,7 @@ static GtkWidget *dclock_configure(Panel *panel, GtkWidget *p, GtkWindow *parent
 }
 
 /* Callback when panel configuration changes. */
-static void dclock_reconfigure(Panel *panel, GtkWidget *p)
+static void dclock_reconfigure(LXPanel *panel, GtkWidget *p)
 {
     dclock_apply_configuration(p);
 }
index c5c5261..db2de9c 100644 (file)
@@ -33,7 +33,7 @@
 
 /* Private context for desktop number plugin. */
 typedef struct {
-    Panel * panel;                     /* Back pointer to Panel */
+    LXPanel * panel;                   /* Back pointer to Panel */
     config_setting_t *settings;
     GtkWidget * label;                 /* The label */
     int number_of_desktops;            /* Number of desktops */
@@ -50,7 +50,7 @@ static gboolean deskno_name_update(GtkWidget * widget, DesknoPlugin * dc)
     /* Compute and redraw the desktop number. */
     int desktop_number = get_net_current_desktop();
     if (desktop_number < dc->number_of_desktops)
-        panel_draw_label_text(dc->panel, dc->label, dc->desktop_labels[desktop_number], dc->bold, 1, TRUE);
+        lxpanel_draw_label_text(dc->panel, dc->label, dc->desktop_labels[desktop_number], dc->bold, 1, TRUE);
     return TRUE;
 }
 
@@ -87,7 +87,7 @@ static void deskno_redraw(GtkWidget * widget, DesknoPlugin * dc)
 }
 
 /* Handler for button-press-event on top level widget. */
-static gboolean deskno_button_press_event(GtkWidget * widget, GdkEventButton * event, Panel * p)
+static gboolean deskno_button_press_event(GtkWidget * widget, GdkEventButton * event, LXPanel * p)
 {
     /* Standard right-click handling. */
     if (lxpanel_plugin_button_press_event(widget, event, p))
@@ -106,7 +106,7 @@ static gboolean deskno_button_press_event(GtkWidget * widget, GdkEventButton * e
 }
 
 /* Plugin constructor. */
-static GtkWidget *deskno_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *deskno_constructor(LXPanel *panel, config_setting_t *settings)
 {
     /* Allocate plugin context and set into Plugin private data pointer. */
     DesknoPlugin * dc = g_new0(DesknoPlugin, 1);
@@ -172,7 +172,7 @@ static gboolean deskno_apply_configuration(gpointer user_data)
 }
 
 /* Callback when the configuration dialog is to be shown. */
-static GtkWidget *deskno_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *deskno_configure(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     DesknoPlugin * dc = lxpanel_plugin_get_data(p);
     GtkWidget * dlg = lxpanel_generic_config_dlg(_("Desktop Number / Workspace Name"),
@@ -185,7 +185,7 @@ static GtkWidget *deskno_configure(Panel *panel, GtkWidget *p, GtkWindow *parent
 }
 
 /* Callback when panel configuration changes. */
-static void deskno_panel_configuration_changed(Panel *panel, GtkWidget *p)
+static void deskno_panel_configuration_changed(LXPanel *panel, GtkWidget *p)
 {
     DesknoPlugin * dc = lxpanel_plugin_get_data(p);
     deskno_name_update(NULL, dc);
index 1269cf9..331fa60 100644 (file)
@@ -35,7 +35,7 @@ typedef struct _directory_name {
 
 /* Private context for directory menu plugin. */
 typedef struct {
-    Panel * panel; /* The panel and settings are required to apply config */
+    LXPanel * panel; /* The panel and settings are required to apply config */
     config_setting_t * settings;
     char * image;                      /* Icon for top level widget */
     char * path;                       /* Top level path for widget */
@@ -235,7 +235,7 @@ static void dirmenu_show_menu(GtkWidget * widget, DirMenuPlugin * dm, int btn, g
 }
 
 /* Handler for button-press-event on top level widget. */
-static gboolean dirmenu_button_press_event(GtkWidget * widget, GdkEventButton * event, Panel * p)
+static gboolean dirmenu_button_press_event(GtkWidget * widget, GdkEventButton * event, LXPanel * p)
 {
     DirMenuPlugin * dm = lxpanel_plugin_get_data(widget);
 
@@ -255,7 +255,7 @@ static gboolean dirmenu_button_press_event(GtkWidget * widget, GdkEventButton *
 }
 
 /* Plugin constructor. */
-static GtkWidget *dirmenu_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *dirmenu_constructor(LXPanel *panel, config_setting_t *settings)
 {
     /* Allocate and initialize plugin context and set into Plugin private data pointer. */
     DirMenuPlugin * dm = g_new0(DirMenuPlugin, 1);
@@ -318,7 +318,7 @@ static void dirmenu_apply_configuration_to_children(GtkWidget * w, DirMenuPlugin
         if (dm->name == NULL)
             gtk_label_set_text(GTK_LABEL(w), NULL);
         else
-            panel_draw_label_text(dm->panel, w, dm->name, FALSE, 1, TRUE);
+            lxpanel_draw_label_text(dm->panel, w, dm->name, FALSE, 1, TRUE);
     }
 }
 
@@ -352,7 +352,7 @@ static gboolean dirmenu_apply_configuration(gpointer user_data)
 }
 
 /* Callback when the configuration dialog is to be shown. */
-static GtkWidget *dirmenu_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *dirmenu_configure(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     DirMenuPlugin * dm = lxpanel_plugin_get_data(p);
     return lxpanel_generic_config_dlg(_("Directory Menu"),
@@ -364,7 +364,7 @@ static GtkWidget *dirmenu_configure(Panel *panel, GtkWidget *p, GtkWindow *paren
 }
 
 /* Callback when panel configuration changes. */
-static void dirmenu_panel_configuration_changed(Panel *panel, GtkWidget *p)
+static void dirmenu_panel_configuration_changed(LXPanel *panel, GtkWidget *p)
 {
     dirmenu_apply_configuration(p);
 }
index bbc42d4..a4c1169 100644 (file)
@@ -67,7 +67,7 @@ static gchar * indicator_order[][2] = {
 GOutputStream * log_file = NULL;
 
 typedef struct {
-    Panel *panel;
+    LXPanel *panel;
     config_setting_t *settings;
 
     IndicatorObject *io;               /* Indicators applets */
@@ -619,7 +619,7 @@ menubar_on_expose (GtkWidget * widget,
     return FALSE;
 }
 
-static void indicator_load_modules(Panel *panel, GtkWidget *p)
+static void indicator_load_modules(LXPanel *panel, GtkWidget *p)
 {
 
     gint indicators_loaded = 0;
@@ -702,7 +702,7 @@ static void indicator_load_modules(Panel *panel, GtkWidget *p)
 }
 
 /* Plugin constructor. */
-static GtkWidget *indicator_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *indicator_constructor(LXPanel *panel, config_setting_t *settings)
 {
     /* Allocate and initialize plugin context and set into Plugin private data pointer. */
     IndicatorPlugin * indicator = g_new0(IndicatorPlugin, 1);
@@ -808,7 +808,7 @@ static void indicator_destructor(gpointer user_data)
 #endif
 
 /* Callback when panel configuration changes. */
-static void indicator_panel_configuration_changed(Panel *panel, GtkWidget *p)
+static void indicator_panel_configuration_changed(LXPanel *panel, GtkWidget *p)
 {
     /*
     Update when configuration changed
@@ -858,7 +858,7 @@ static gboolean indicator_apply_configuration(gpointer user_data)
 }
 
 /* Callback when the configuration dialog is to be shown. */
-static GtkWidget *indicator_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *indicator_configure(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     IndicatorPlugin * indicator = lxpanel_plugin_get_data(p);
     GtkWidget * dlg = lxpanel_generic_config_dlg(_("Indicator applets"),
index bd60e01..38afd37 100644 (file)
@@ -63,7 +63,7 @@ static int xkb_error_base = 0;
 
 /* Private context for keyboard LED plugin. */
 typedef struct {
-    Panel * panel;                             /* Back pointer to panel */
+    LXPanel * panel;                           /* Back pointer to panel */
     config_setting_t *settings;
     GtkWidget *indicator_image[3];             /* Image for each indicator */
     unsigned int current_state;                        /* Current LED state, bit encoded */
@@ -87,12 +87,12 @@ static void kbled_theme_changed(GtkWidget * widget, KeyboardLEDPlugin * kl)
 /* Update image to correspond to current state. */
 static void kbled_update_image(KeyboardLEDPlugin * kl, int i, unsigned int state)
 {
-    if(panel_image_set_icon_theme(kl->panel, kl->indicator_image[i], (state ? on_icons_theme[i] : off_icons_theme[i])) != TRUE) {
+    if(lxpanel_image_set_icon_theme(kl->panel, kl->indicator_image[i], (state ? on_icons_theme[i] : off_icons_theme[i])) != TRUE) {
         char * file = g_build_filename(
             PACKAGE_DATA_DIR "/images",
             ((state) ? on_icons[i] : off_icons[i]),
             NULL);
-        panel_image_set_from_file(kl->panel, kl->indicator_image[i], file);
+        lxpanel_image_set_from_file(kl->panel, kl->indicator_image[i], file);
         g_free(file);
     }
 }
@@ -129,7 +129,7 @@ static GdkFilterReturn kbled_event_filter(GdkXEvent * gdkxevent, GdkEvent * even
 }
 
 /* Plugin constructor. */
-static GtkWidget *kbled_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *kbled_constructor(LXPanel *panel, config_setting_t *settings)
 {
     /* Allocate and initialize plugin context and set into Plugin private data pointer. */
     KeyboardLEDPlugin * kl = g_new0(KeyboardLEDPlugin, 1);
@@ -223,7 +223,7 @@ static gboolean kbled_apply_configuration(gpointer user_data)
 }
 
 /* Callback when the configuration dialog is to be shown. */
-static GtkWidget *kbled_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *kbled_configure(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     KeyboardLEDPlugin * kl = lxpanel_plugin_get_data(p);
     GtkWidget * dlg = lxpanel_generic_config_dlg(_("Keyboard LED"),
@@ -237,7 +237,7 @@ static GtkWidget *kbled_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
 }
 
 /* Callback when panel configuration changes. */
-static void kbled_panel_configuration_changed(Panel *panel, GtkWidget *p)
+static void kbled_panel_configuration_changed(LXPanel *panel, GtkWidget *p)
 {
     /* Set orientation into the icon grid. */
     KeyboardLEDPlugin * kl = lxpanel_plugin_get_data(p);
index e42841c..963a496 100644 (file)
@@ -175,7 +175,7 @@ struct LaunchTaskBarPlugin {
     GtkWidget       *p_menuitem_separator;
 #endif
     GtkWidget * plugin;                 /* Back pointer to Plugin */
-    Panel * panel;                      /* Back pointer to panel */
+    LXPanel * panel;                    /* Back pointer to panel */
     config_setting_t * settings;
     GdkScreen       *screen;
     GtkWidget       *config_dlg;        /* Configuration dialog */
@@ -640,7 +640,7 @@ static gboolean _launchbutton_create_id(LaunchTaskBarPlugin * lb, config_setting
             if (ret) {
                 config_group_set_string(s, "id", filename);
                 /* FIXME: is it reasonable to remove obsolete keys too? */
-                panel_config_save(lb->panel);
+                lxpanel_config_save(lb->panel);
             } else
                 g_unlink(filename);
             g_string_free(content, TRUE);
@@ -766,7 +766,7 @@ static void launchtaskbar_constructor_task(LaunchTaskBarPlugin *ltbp)
 }
 
 /* Plugin constructor. */
-static GtkWidget *_launchtaskbar_constructor(Panel *panel, config_setting_t *settings,
+static GtkWidget *_launchtaskbar_constructor(LXPanel *panel, config_setting_t *settings,
                                              LtbMode mode)
 {
     GtkWidget *p;
@@ -779,7 +779,7 @@ static GtkWidget *_launchtaskbar_constructor(Panel *panel, config_setting_t *set
     ltbp->panel = panel;
     ltbp->settings = settings;
     ltbp->mode = mode;
-    ltbp->screen = gtk_widget_get_screen((GtkWidget*)panel_get_toplevel_window(panel));
+    ltbp->screen = gtk_widget_get_screen((GtkWidget*)panel);
 
     /* Initialize to defaults. */
     ltbp->icon_size         = panel_get_icon_size(panel);
@@ -844,7 +844,7 @@ static GtkWidget *_launchtaskbar_constructor(Panel *panel, config_setting_t *set
     return p;
 }
 
-static GtkWidget *launchtaskbar_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *launchtaskbar_constructor(LXPanel *panel, config_setting_t *settings)
 {
     return _launchtaskbar_constructor(panel, settings, LAUNCHTASKBAR);
 }
@@ -1323,7 +1323,7 @@ static void on_menu_view_row_activated(GtkTreeView *tree_view, GtkTreePath *path
 }
 
 /* Callback when the configuration dialog is to be shown. */
-static GtkWidget *launchtaskbar_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *launchtaskbar_configure(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     LaunchTaskBarPlugin *ltbp = lxpanel_plugin_get_data(p);
 
@@ -1432,7 +1432,7 @@ static GtkWidget *launchtaskbar_configure(Panel *panel, GtkWidget *p, GtkWindow
 }
 
 /* Callback when panel configuration changes. */
-static void launchtaskbar_panel_configuration_changed(Panel *panel, GtkWidget *p)
+static void launchtaskbar_panel_configuration_changed(LXPanel *panel, GtkWidget *p)
 {
     /* Set orientation into the icon grid. */
     LaunchTaskBarPlugin *ltbp = lxpanel_plugin_get_data(p);
@@ -1605,7 +1605,7 @@ static void task_draw_label(Task * tk)
     if (tk->tb->tooltips)
         gtk_widget_set_tooltip_text(tk->button, label);
 
-    panel_draw_label_text(tk->tb->panel, tk->label, label, bold_style, 1,
+    lxpanel_draw_label_text(tk->tb->panel, tk->label, label, bold_style, 1,
             tk->tb->flat_button);
 
     g_free(label);
@@ -3264,7 +3264,7 @@ static void  on_menuitem_lock_tbp_clicked(GtkWidget * widget, LaunchTaskBarPlugi
         btn->settings = config_group_add_subgroup(tb->settings, "Button");
         config_group_set_string(btn->settings, "id", path);
         g_free(path);
-        panel_config_save(tb->panel);
+        lxpanel_config_save(tb->panel);
     }
 }
 
@@ -3276,7 +3276,7 @@ static void  on_menuitem_unlock_tbp_clicked(GtkWidget * widget, LaunchTaskBarPlu
     if(btn != NULL)
     {
         launchbar_remove_button(ltbp, btn);
-        panel_config_save(tb->panel);
+        lxpanel_config_save(tb->panel);
     }
     if (fi)
         fm_file_info_unref(fi);
@@ -3438,12 +3438,12 @@ static void taskbar_apply_configuration(LaunchTaskBarPlugin *ltbp)
     taskbar_net_client_list(NULL, ltbp);
 }
 
-static GtkWidget *launchbar_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *launchbar_constructor(LXPanel *panel, config_setting_t *settings)
 {
     return _launchtaskbar_constructor(panel, settings, LAUNCHBAR);
 }
 
-static GtkWidget *taskbar_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *taskbar_constructor(LXPanel *panel, config_setting_t *settings)
 {
     return _launchtaskbar_constructor(panel, settings, TASKBAR);
 }
index c7d9b53..bfa3ffe 100644 (file)
@@ -67,7 +67,7 @@ typedef struct {
     int iconsize;
     gboolean has_system_menu;
     guint show_system_menu_idle;
-    Panel *panel;
+    LXPanel *panel;
     config_setting_t *settings;
 
     MenuCache* menu_cache;
@@ -959,7 +959,7 @@ error:
 }
 
 static GtkWidget *
-menu_constructor(Panel *panel, config_setting_t *settings)
+menu_constructor(LXPanel *panel, config_setting_t *settings)
 {
     menup *m;
     config_setting_t *s;
@@ -1017,7 +1017,7 @@ static gboolean apply_config(gpointer user_data)
     return FALSE;
 }
 
-static GtkWidget *menu_config(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *menu_config(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     menup* menu = lxpanel_plugin_get_data(p);
     return lxpanel_generic_config_dlg(_("Menu"), panel, apply_config, p,
@@ -1027,7 +1027,7 @@ static GtkWidget *menu_config(Panel *panel, GtkWidget *p, GtkWindow *parent)
 }
 
 /* Callback when panel configuration changes. */
-static void menu_panel_configuration_changed(Panel *panel, GtkWidget *p)
+static void menu_panel_configuration_changed(LXPanel *panel, GtkWidget *p)
 {
     apply_config(p);
 }
index 7835975..f469ca3 100644 (file)
@@ -122,7 +122,7 @@ typedef void (*tooltip_update_func) (Monitor *);
 
 /* Our plugin */
 typedef struct {
-    Panel *panel;
+    LXPanel *panel;
     config_setting_t *settings;
     Monitor  *monitors[N_MONITORS];          /* Monitors                      */
     int      displayed_monitors[N_MONITORS]; /* Booleans                      */
@@ -489,7 +489,7 @@ expose_event(GtkWidget * widget, GdkEventExpose * event, Monitor *m)
 }
 
 
-static gboolean monitors_button_press_event(GtkWidget* widget, GdkEventButton* evt, Panel *panel)
+static gboolean monitors_button_press_event(GtkWidget* widget, GdkEventButton* evt, LXPanel *panel)
 {
     MonitorsPlugin* mp = lxpanel_plugin_get_data(widget);
 
@@ -611,7 +611,7 @@ monitors_add_monitor (GtkWidget *p, MonitorsPlugin *mp, update_func update,
 }
 
 static GtkWidget *
-monitors_constructor(Panel *panel, config_setting_t *settings)
+monitors_constructor(LXPanel *panel, config_setting_t *settings)
 {
     ENTER;
     int i;
@@ -692,7 +692,7 @@ monitors_destructor(gpointer user_data)
 
 
 static GtkWidget *
-monitors_config (Panel *panel, GtkWidget *p, GtkWindow *parent)
+monitors_config (LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     ENTER;
 
index 34119ba..e51bbc9 100644 (file)
@@ -429,7 +429,7 @@ static void netstat_destructor(gpointer user_data)
     RET();
 }
 
-static GtkWidget *netstat_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *netstat_constructor(LXPanel *panel, config_setting_t *settings)
 {
     netstat *ns;
     const char *tmp;
@@ -470,7 +470,7 @@ static GtkWidget *netstat_constructor(Panel *panel, config_setting_t *settings)
     RET(p);
 }
 
-static void orientation_changed(Panel *panel, GtkWidget *p)
+static void orientation_changed(LXPanel *panel, GtkWidget *p)
 {
     netstat *ns = lxpanel_plugin_get_data(p);
 
index cdcded0..638eebc 100644 (file)
@@ -79,7 +79,7 @@ static void on_response( GtkDialog* dlg, gint response, netstatus *ns )
     }
 }
 
-static gboolean on_button_press( GtkWidget* widget, GdkEventButton* evt, Panel *p )
+static gboolean on_button_press( GtkWidget* widget, GdkEventButton* evt, LXPanel *p )
 {
     NetstatusIface* iface;
     netstatus *ns = lxpanel_plugin_get_data(widget);
@@ -107,7 +107,7 @@ static gboolean on_button_press( GtkWidget* widget, GdkEventButton* evt, Panel *
 }
 
 static GtkWidget *
-netstatus_constructor(Panel *panel, config_setting_t *settings)
+netstatus_constructor(LXPanel *panel, config_setting_t *settings)
 {
     netstatus *ns;
     NetstatusIface* iface;
@@ -150,7 +150,7 @@ static gboolean apply_config(gpointer user_data)
     return FALSE;
 }
 
-static GtkWidget *netstatus_config(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *netstatus_config(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     GtkWidget* dlg;
     netstatus *ns = lxpanel_plugin_get_data(p);
index 69fbc68..043dd07 100644 (file)
@@ -36,7 +36,7 @@
 /* command to configure desktop, it will be set by .config callback */
 static const char *configure_command = NULL;
 
-static void on_realize(GtkWidget *p, Panel *panel)
+static void on_realize(GtkWidget *p, LXPanel *panel)
 {
     WnckPager *pager = WNCK_PAGER(gtk_bin_get_child(GTK_BIN(p)));
     int rows, r, h = panel_get_height(panel);
@@ -52,13 +52,13 @@ static void on_realize(GtkWidget *p, Panel *panel)
     wnck_pager_set_n_rows(pager, rows);
 }
 
-static void on_size_allocate(GtkWidget *p, GdkRectangle *allocation, Panel *panel)
+static void on_size_allocate(GtkWidget *p, GdkRectangle *allocation, LXPanel *panel)
 {
     /* g_debug("pager: on_size_allocate(): %dx%d", allocation->width, allocation->height); */
     on_realize(p, panel);
 }
 
-static GtkWidget *pager_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *pager_constructor(LXPanel *panel, config_setting_t *settings)
 {
     GtkWidget *p, *w;
 
@@ -81,7 +81,7 @@ static GtkWidget *pager_constructor(Panel *panel, config_setting_t *settings)
 }
 
 /* this is a modified version of patch from Lubuntu */
-static GtkWidget *pager_configure(Panel *panel, GtkWidget *instance, GtkWindow *parent)
+static GtkWidget *pager_configure(LXPanel *panel, GtkWidget *instance, GtkWindow *parent)
 {
     if (configure_command)
         fm_launch_command_simple(NULL, NULL, G_APP_INFO_CREATE_NONE,
@@ -130,7 +130,7 @@ static gboolean pager_update_context_menu(GtkWidget *plugin, GtkMenu *menu)
     return FALSE;
 }
 
-static void pager_panel_configuration_changed(Panel *panel, GtkWidget *p)
+static void pager_panel_configuration_changed(LXPanel *panel, GtkWidget *p)
 {
     on_realize(p, panel);
 }
index 132b6ea..b6ce9b3 100644 (file)
@@ -21,7 +21,7 @@
 #include <glib/gi18n.h>
 
 /* Plugin constructor. */
-static GtkWidget *separator_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *separator_constructor(LXPanel *panel, config_setting_t *settings)
 {
     GtkWidget *instance, *sep;
 
@@ -41,7 +41,7 @@ static GtkWidget *separator_constructor(Panel *panel, config_setting_t *settings
 }
 
 /* Callback when panel configuration changes. */
-static void separator_reconfigure(Panel *panel, GtkWidget *instance)
+static void separator_reconfigure(LXPanel *panel, GtkWidget *instance)
 {
     /* Determine if the orientation changed in a way that requires action. */
     GtkWidget * sep = gtk_bin_get_child(GTK_BIN(instance));
index ed3c3ec..7f6afc2 100644 (file)
@@ -25,7 +25,7 @@
 
 /* Private context for space plugin. */
 typedef struct {
-    Panel *panel; /* The panel and settings are required to apply config */
+    LXPanel *panel; /* The panel and settings are required to apply config */
     config_setting_t *settings;
     int size;                          /* Size of spacer */
 } SpacePlugin;
@@ -33,7 +33,7 @@ typedef struct {
 static gboolean space_apply_configuration(gpointer user_data);
 
 /* Plugin constructor. */
-static GtkWidget *space_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *space_constructor(LXPanel *panel, config_setting_t *settings)
 {
     /* Allocate plugin context and set into Plugin private data pointer. */
     SpacePlugin * sp = g_new0(SpacePlugin, 1);
@@ -79,7 +79,7 @@ static gboolean space_apply_configuration(gpointer user_data)
 }
 
 /* Callback when the configuration dialog is to be shown. */
-static GtkWidget *space_configure(Panel *panel, GtkWidget *instance, GtkWindow *parent)
+static GtkWidget *space_configure(LXPanel *panel, GtkWidget *instance, GtkWindow *parent)
 {
     SpacePlugin * sp = lxpanel_plugin_get_data(instance);
     GtkWidget * dlg;
index dbe2b56..a252eaa 100644 (file)
@@ -47,7 +47,7 @@
 typedef gint (*GetTempFunc)(char const *);
 
 typedef struct thermal {
-    Panel *panel;
+    LXPanel *panel;
     config_setting_t *settings;
     GtkWidget *namew;
     GString *tip;
@@ -253,7 +253,7 @@ update_display(thermal *th)
         color = th->cl_normal;
 
     if(temp == -1)
-        panel_draw_label_text(th->panel, th->namew, "NA", TRUE, 1, TRUE);
+        lxpanel_draw_label_text(th->panel, th->namew, "NA", TRUE, 1, TRUE);
     else
     {
         snprintf(buffer, sizeof(buffer), "<span color=\"#%06x\"><b>%02d</b></span>",
@@ -451,7 +451,7 @@ thermal_destructor(gpointer user_data)
 }
 
 static GtkWidget *
-thermal_constructor(Panel *panel, config_setting_t *settings)
+thermal_constructor(LXPanel *panel, config_setting_t *settings)
 {
     thermal *th;
     GtkWidget *p;
@@ -507,7 +507,7 @@ thermal_constructor(Panel *panel, config_setting_t *settings)
     RET(p);
 }
 
-static GtkWidget *config(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *config(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     ENTER;
 
index f6534a7..894d60c 100644 (file)
@@ -73,7 +73,7 @@ typedef struct _tray_client {
 /* Private context for system tray plugin. */
 typedef struct _tray_plugin {
     GtkWidget * plugin;                                /* Back pointer to Plugin */
-    Panel * panel;
+    LXPanel * panel;
     TrayClient * client_list;                  /* List of tray clients */
     BalloonMessage * incomplete_messages;      /* List of balloon messages for which we are awaiting data */
     BalloonMessage * messages;                 /* List of balloon messages actively being displayed or waiting to be displayed */
@@ -551,12 +551,12 @@ static void tray_unmanage_selection(TrayPlugin * tr)
 }
 
 /* Plugin constructor. */
-static GtkWidget *tray_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *tray_constructor(LXPanel *panel, config_setting_t *settings)
 {
     GtkWidget *p;
 
     /* Get the screen and display. */
-    GdkScreen * screen = gtk_widget_get_screen(GTK_WIDGET(panel_get_toplevel_window(panel)));
+    GdkScreen * screen = gtk_widget_get_screen(GTK_WIDGET(panel));
     Screen * xscreen = GDK_SCREEN_XSCREEN(screen);
     GdkDisplay * display = gdk_screen_get_display(screen);
 
@@ -671,7 +671,7 @@ static void tray_destructor(gpointer user_data)
 }
 
 /* Callback when panel configuration changes. */
-static void tray_panel_configuration_changed(Panel *panel, GtkWidget *p)
+static void tray_panel_configuration_changed(LXPanel *panel, GtkWidget *p)
 {
     /* Set orientation into the icon grid. */
     panel_icon_grid_set_geometry(PANEL_ICON_GRID(p), panel_get_orientation(panel),
index c344b19..274e66f 100644 (file)
@@ -42,7 +42,7 @@ static GtkWidget *curr_image;
 static gboolean skip_botton1_event;
 
 typedef struct {
-    Panel *panel;
+    LXPanel *panel;
     GtkWidget *dlg;
 } volume_t;
 
@@ -154,7 +154,7 @@ static void on_mouse_scroll (GtkWidget* widget, GdkEventScroll* evt, volume_t *v
        }
 }
 
-static gboolean on_button_press (GtkWidget* widget, GdkEventButton* evt, Panel* p)
+static gboolean on_button_press (GtkWidget* widget, GdkEventButton* evt, LXPanel* p)
 {
        volume_t *vol = lxpanel_plugin_get_data(widget);
 
@@ -234,7 +234,7 @@ static gboolean on_button_press (GtkWidget* widget, GdkEventButton* evt, Panel*
        return FALSE;
 }
 
-static GtkWidget *volume_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *volume_constructor(LXPanel *panel, config_setting_t *settings)
 {
     volume_t *vol;
     GtkWidget *p;
index 02bc5f7..a75a7dd 100644 (file)
@@ -38,7 +38,7 @@ typedef struct {
 
     /* Graphics. */
     GtkWidget * plugin;                                /* Back pointer to the widget */
-    Panel * panel;                             /* Back pointer to panel */
+    LXPanel * panel;                           /* Back pointer to panel */
     GtkWidget * tray_icon;                     /* Displayed image */
     GtkWidget * popup_window;                  /* Top level window for popup */
     GtkWidget * volume_scale;                  /* Scale for volume */
@@ -329,11 +329,11 @@ static void volumealsa_update_display(VolumeALSAPlugin * vol)
     volumealsa_update_current_icon(vol);
 
     /* Change icon, fallback to default icon if theme doesn't exsit */
-    if ( ! panel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon_panel))
+    if ( ! lxpanel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon_panel))
     {
-        if ( ! panel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon))
+        if ( ! lxpanel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon))
         {
-            panel_image_set_from_file(vol->panel, vol->tray_icon, vol->icon_fallback);
+            lxpanel_image_set_from_file(vol->panel, vol->tray_icon, vol->icon_fallback);
         }
     }
 
@@ -358,7 +358,7 @@ static void volumealsa_update_display(VolumeALSAPlugin * vol)
 
 
 /* Handler for "button-press-event" signal on main widget. */
-static gboolean volumealsa_button_press_event(GtkWidget * widget, GdkEventButton * event, Panel * panel)
+static gboolean volumealsa_button_press_event(GtkWidget * widget, GdkEventButton * event, LXPanel * panel)
 {
     VolumeALSAPlugin * vol;
 
@@ -408,11 +408,11 @@ static void volumealsa_popup_map(GtkWidget * widget, VolumeALSAPlugin * vol)
 
 static void volumealsa_theme_change(GtkWidget * widget, VolumeALSAPlugin * vol)
 {
-    if ( ! panel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon_panel))
+    if ( ! lxpanel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon_panel))
     {
-        if ( ! panel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon))
+        if ( ! lxpanel_image_set_icon_theme(vol->panel, vol->tray_icon, vol->icon))
         {
-            panel_image_set_from_file(vol->panel, vol->tray_icon, vol->icon_fallback);
+            lxpanel_image_set_from_file(vol->panel, vol->tray_icon, vol->icon_fallback);
         }
     }
 }
@@ -523,7 +523,7 @@ static void volumealsa_build_popup_window(GtkWidget *p)
 }
 
 /* Plugin constructor. */
-static GtkWidget *volumealsa_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *volumealsa_constructor(LXPanel *panel, config_setting_t *settings)
 {
     /* Allocate and initialize plugin context and set into Plugin private data pointer. */
     VolumeALSAPlugin * vol = g_new0(VolumeALSAPlugin, 1);
@@ -580,7 +580,7 @@ static void volumealsa_destructor(gpointer user_data)
 
 /* Callback when the configuration dialog is to be shown. */
 
-static GtkWidget *volumealsa_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *volumealsa_configure(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     const gchar *command_line = NULL;
 
@@ -635,7 +635,7 @@ static GtkWidget *volumealsa_configure(Panel *panel, GtkWidget *p, GtkWindow *pa
 }
 
 /* Callback when panel configuration changes. */
-static void volumealsa_panel_configuration_changed(Panel *panel, GtkWidget *p)
+static void volumealsa_panel_configuration_changed(LXPanel *panel, GtkWidget *p)
 {
     /* Do a full redraw. */
     volumealsa_update_display(lxpanel_plugin_get_data(p));
index ecc0259..d404151 100644 (file)
@@ -109,7 +109,7 @@ static void wincmd_execute(WinCmdPlugin * wc, WindowCommand command)
 }
 
 /* Handler for "clicked" signal on main widget. */
-static gboolean wincmd_button_clicked(GtkWidget * widget, GdkEventButton * event, Panel * panel)
+static gboolean wincmd_button_clicked(GtkWidget * widget, GdkEventButton * event, LXPanel * panel)
 {
     WinCmdPlugin * wc;
 
@@ -148,7 +148,7 @@ static gboolean wincmd_button_clicked(GtkWidget * widget, GdkEventButton * event
 }
 
 /* Plugin constructor. */
-static GtkWidget *wincmd_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *wincmd_constructor(LXPanel *panel, config_setting_t *settings)
 {
     /* Allocate plugin context and set into Plugin private data pointer. */
     WinCmdPlugin * wc = g_new0(WinCmdPlugin, 1);
@@ -223,7 +223,7 @@ static gboolean wincmd_apply_configuration(gpointer user_data)
 }
 
 /* Callback when the configuration dialog is to be shown. */
-static GtkWidget *wincmd_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *wincmd_configure(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     WinCmdPlugin * wc = lxpanel_plugin_get_data(p);
     return lxpanel_generic_config_dlg(_("Minimize All Windows"),
@@ -235,7 +235,7 @@ static GtkWidget *wincmd_configure(Panel *panel, GtkWidget *p, GtkWindow *parent
 
 
 /* Callback when panel configuration changes. */
-static void wincmd_panel_reconfigure(Panel *panel, GtkWidget *p)
+static void wincmd_panel_reconfigure(LXPanel *panel, GtkWidget *p)
 {
     WinCmdPlugin * wc = lxpanel_plugin_get_data(p);
 
index cf3a7b9..9d95388 100644 (file)
@@ -158,7 +158,7 @@ void xkb_redraw(XkbPlugin *p_xkb)
         char *group_name = (char *)xkb_get_current_symbol_name(p_xkb);
         if (group_name != NULL)
         {
-            panel_draw_label_text(p_xkb->panel, p_xkb->p_label, group_name,
+            lxpanel_draw_label_text(p_xkb->panel, p_xkb->p_label, group_name,
                     TRUE, size*4/(5*10.0), TRUE);
             gtk_widget_hide(p_xkb->p_image);
             gtk_widget_show(p_xkb->p_label);
@@ -194,7 +194,7 @@ static gboolean on_xkb_button_scroll_event(GtkWidget * widget, GdkEventScroll *
 }
 
 /* Handler for button-press-event on top level widget. */
-static gboolean on_xkb_button_press_event(GtkWidget * widget,  GdkEventButton * event, Panel * panel)
+static gboolean on_xkb_button_press_event(GtkWidget * widget,  GdkEventButton * event, LXPanel * panel)
 {
     /* Standard right-click handling. */
     if (lxpanel_plugin_button_press_event(widget, event, panel))
@@ -218,7 +218,7 @@ static void on_xkb_entry_advanced_opt_icon_press(GtkEntry             *p_entry,
 }
 
 /* Plugin constructor. */
-static GtkWidget *xkb_constructor(Panel *panel, config_setting_t *settings)
+static GtkWidget *xkb_constructor(LXPanel *panel, config_setting_t *settings)
 {
     /* Allocate plugin context and set into Plugin private data pointer. */
     XkbPlugin * p_xkb = g_new0(XkbPlugin, 1);
@@ -1196,7 +1196,7 @@ static void xkb_settings_fill_layout_tree_model_with_config(XkbPlugin *p_xkb)
 }
 
 /* Callback when the configuration dialog is to be shown. */
-static GtkWidget *xkb_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
+static GtkWidget *xkb_configure(LXPanel *panel, GtkWidget *p, GtkWindow *parent)
 {
     XkbPlugin * p_xkb = lxpanel_plugin_get_data(p);
     gchar       markup_str[MAX_MARKUP_LEN];
@@ -1527,7 +1527,7 @@ static GtkWidget *xkb_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
 }
 
 /* Callback when panel configuration changes. */
-static void xkb_panel_configuration_changed(Panel *panel, GtkWidget *p)
+static void xkb_panel_configuration_changed(LXPanel *panel, GtkWidget *p)
 {
     /* Do a full redraw. */
     xkb_redraw(lxpanel_plugin_get_data(p));
index b909ef6..e6ca4f7 100644 (file)
@@ -36,7 +36,7 @@ typedef enum {
 typedef struct {
 
     /* Plugin interface. */
-    Panel        *panel;                       /* Back pointer to Panel */
+    LXPanel      *panel;                       /* Back pointer to Panel */
     config_setting_t *settings;                /* Plugin settings */
     GtkWidget    *p_plugin;                    /* Back pointer to Plugin */
     GtkWidget    *p_label;                     /* Label containing country name */
index 00f5cb9..3a2b900 100644 (file)
@@ -56,7 +56,7 @@ extern gboolean is_in_lxde;
 /* Context of a panel on a given edge. */
 struct _Panel {
     char* name;
-    GtkWidget * topgwin;               /* Main panel window */
+    LXPanel * topgwin;                 /* Main panel window */
     Window topxwin;                    /* Main panel's X window   */
     GdkDisplay * display;              /* Main panel's GdkDisplay */
     GtkStyle * defstyle;
@@ -196,7 +196,7 @@ static inline char *_user_config_file_name(const char *name1, const char *name2)
 void _prepare_modules(void);
 void _unload_modules(void);
 
-GtkWidget *lxpanel_add_plugin(Panel *p, const char *name, config_setting_t *cfg, gint at);
+GtkWidget *lxpanel_add_plugin(LXPanel *p, const char *name, config_setting_t *cfg, gint at);
 GHashTable *lxpanel_get_all_types(void); /* transfer none */
 
 GQuark lxpanel_plugin_qinit; /* access to LXPanelPluginInit data */
@@ -204,12 +204,19 @@ GQuark lxpanel_plugin_qinit; /* access to LXPanelPluginInit data */
 
 GQuark lxpanel_plugin_qconf; /* access to congig_setting_t data */
 
-GQuark lxpanel_plugin_qpanel; /* access to Panel */
-#define PLUGIN_PANEL(_i) ((Panel*)g_object_get_qdata(G_OBJECT(_i),lxpanel_plugin_qpanel))
+#define PLUGIN_PANEL(_i) ((LXPanel*)gtk_widget_get_toplevel(_i))
 
 gboolean _class_is_present(LXPanelPluginInit *init);
 
-void _panel_show_config_dialog(Panel *panel, GtkWidget *p, GtkWidget *dlg);
+void _panel_show_config_dialog(LXPanel *panel, GtkWidget *p, GtkWidget *dlg);
+
+void _calculate_position(LXPanel *panel);
+
+void _panel_determine_background_pixmap(LXPanel * p, GtkWidget * widget);
+void _panel_establish_autohide(LXPanel *p);
+void _panel_set_wm_strut(LXPanel *p);
+void _panel_set_panel_configuration_changed(LXPanel *p);
+void _panel_update_background(LXPanel *p);
 
 /* -----------------------------------------------------------------------------
  *   Deprecated declarations. Kept for compatibility with old code plugins.
@@ -218,6 +225,20 @@ void _panel_show_config_dialog(Panel *panel, GtkWidget *p, GtkWidget *dlg);
 /* Extracted from panel.h */
 extern int verbose;
 
+extern void panel_destroy(Panel *p);
+extern void panel_adjust_geometry_terminology(Panel *p);
+extern void panel_determine_background_pixmap(Panel * p, GtkWidget * widget, GdkWindow * window);
+extern void panel_draw_label_text(Panel * p, GtkWidget * label, const char * text,
+                                  gboolean bold, float custom_size_factor,
+                                  gboolean custom_color);
+extern void panel_establish_autohide(Panel *p);
+extern void panel_image_set_from_file(Panel * p, GtkWidget * image, const char * file);
+extern gboolean panel_image_set_icon_theme(Panel * p, GtkWidget * image, const gchar * icon);
+extern void panel_set_wm_strut(Panel *p);
+extern void panel_set_dock_type(Panel *p);
+extern void panel_set_panel_configuration_changed(Panel *p);
+extern void panel_update_background( Panel* p );
+
 /* if current window manager is EWMH conforming. */
 extern gboolean is_ewmh_supported;
 
@@ -245,6 +266,7 @@ typedef struct {
     gchar *t[3];
 } line;
 
+void calculate_position(Panel *np);
 
 extern int lxpanel_get_line(char **fp, line *s);
 extern int lxpanel_put_line(FILE* fp, const char* format, ...);