summaryrefslogtreecommitdiff
path: root/libmate-panel-applet
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2017-07-14 13:55:46 -0400
committerlukefromdc <[email protected]>2017-08-13 14:37:24 -0400
commit626c42da935aa98d97e1e0e8adf4efe9b97bf821 (patch)
tree4ef9aa7e0196bda5833639526d5294e23f9f4f83 /libmate-panel-applet
parent109dc78304c309c368b95df17ee9a057fbb72402 (diff)
downloadmate-panel-626c42da935aa98d97e1e0e8adf4efe9b97bf821.tar.bz2
mate-panel-626c42da935aa98d97e1e0e8adf4efe9b97bf821.tar.xz
libpanel-applet: delay GtkPlug creation
We are going to create GtkPlug only for out of process applets and constructor is first place where we will know applet process type Based on https://github.com/GNOME/gnome-panel/commit/3ed0b1b87ecad205bdaed0ca52e8866bc0666863
Diffstat (limited to 'libmate-panel-applet')
-rw-r--r--libmate-panel-applet/mate-panel-applet.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c
index 4f7f430f..c2e0e476 100644
--- a/libmate-panel-applet/mate-panel-applet.c
+++ b/libmate-panel-applet/mate-panel-applet.c
@@ -1864,10 +1864,26 @@ mate_panel_applet_init (MatePanelApplet *applet)
gtk_ui_manager_add_ui_from_string (applet->priv->ui_manager,
panel_menu_ui, -1, NULL);
+ gtk_widget_set_events (GTK_WIDGET (applet),
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK);
+}
+static GObject *
+mate_panel_applet_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
+{
+ GObject *object;
+ MatePanelApplet *applet;
+ object = G_OBJECT_CLASS (mate_panel_applet_parent_class)->constructor (type,
+ n_construct_properties,
+ construct_properties);
+ applet = MATE_PANEL_APPLET (object);
applet->priv->plug = gtk_plug_new (0);
+
GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(applet->priv->plug));
GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
gtk_widget_set_visual(GTK_WIDGET(applet->priv->plug), visual);
@@ -1879,16 +1895,14 @@ mate_panel_applet_init (MatePanelApplet *applet)
_mate_panel_applet_prepare_css(context);
g_signal_connect_swapped (G_OBJECT (applet->priv->plug), "embedded",
- G_CALLBACK (mate_panel_applet_setup),
- applet);
-
- gtk_widget_set_events (GTK_WIDGET (applet),
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK);
+ G_CALLBACK (mate_panel_applet_setup),
+ applet);
+
+ gtk_container_add (GTK_CONTAINER (applet->priv->plug), GTK_WIDGET (applet));
- gtk_container_add (GTK_CONTAINER (applet->priv->plug), GTK_WIDGET (applet));
+ return object;
}
-
+
static void
mate_panel_applet_constructed (GObject* object)
{
@@ -1911,6 +1925,7 @@ mate_panel_applet_class_init (MatePanelAppletClass *klass)
gobject_class->get_property = mate_panel_applet_get_property;
gobject_class->set_property = mate_panel_applet_set_property;
+ gobject_class->constructor = mate_panel_applet_constructor;
gobject_class->constructed = mate_panel_applet_constructed;
klass->move_focus_out_of_applet = mate_panel_applet_move_focus_out_of_applet;
klass->change_background = mate_panel_applet_change_background;