/* Object initialization * Create private structure and set up default values */ static void xfdashboard_live_workspace_init(XfdashboardLiveWorkspace *self) { XfdashboardLiveWorkspacePrivate *priv; ClutterAction *action; priv=self->priv=XFDASHBOARD_LIVE_WORKSPACE_GET_PRIVATE(self); /* Set default values */ priv->windowTracker=xfdashboard_window_tracker_get_default(); priv->workspace=NULL; /* Set up this actor */ clutter_actor_set_reactive(CLUTTER_ACTOR(self), TRUE); /* Connect signals */ action=xfdashboard_click_action_new(); clutter_actor_add_action(CLUTTER_ACTOR(self), action); g_signal_connect_swapped(action, "clicked", G_CALLBACK(_xfdashboard_live_workspace_on_clicked), self); g_signal_connect_swapped(priv->windowTracker, "window-opened", G_CALLBACK(_xfdashboard_live_workspace_on_window_opened), self); g_signal_connect_swapped(priv->windowTracker, "window-closed", G_CALLBACK(_xfdashboard_live_workspace_on_window_closed), self); g_signal_connect_swapped(priv->windowTracker, "window-geometry-changed", G_CALLBACK(_xfdashboard_live_workspace_on_window_geometry_changed), self); g_signal_connect_swapped(priv->windowTracker, "window-state-changed", G_CALLBACK(_xfdashboard_live_workspace_on_window_state_changed), self); g_signal_connect_swapped(priv->windowTracker, "window-workspace-changed", G_CALLBACK(_xfdashboard_live_workspace_on_window_workspace_changed), self); g_signal_connect_swapped(priv->windowTracker, "window-stacking-changed", G_CALLBACK(_xfdashboard_live_workspace_on_window_stacking_changed), self); }
/* Object initialization * Create private structure and set up default values */ static void xfdashboard_button_init(XfdashboardButton *self) { XfdashboardButtonPrivate *priv; priv=self->priv=XFDASHBOARD_BUTTON_GET_PRIVATE(self); /* This actor reacts on events */ clutter_actor_set_reactive(CLUTTER_ACTOR(self), TRUE); /* Connect signals */ priv->clickAction=xfdashboard_click_action_new(); clutter_actor_add_action(CLUTTER_ACTOR(self), priv->clickAction); g_signal_connect(priv->clickAction, "clicked", G_CALLBACK(_xfdashboard_button_clicked), NULL); }
/* Set menu item actor */ static void _xfdashboard_popup_menu_item_meta_set_menu_item(XfdashboardPopupMenuItemMeta *self, ClutterActor *inMenuItem) { XfdashboardPopupMenuItemMetaPrivate *priv; g_return_if_fail(XFDASHBOARD_IS_POPUP_MENU_ITEM_META(self)); g_return_if_fail(CLUTTER_IS_ACTOR(inMenuItem)); priv=self->priv; /* This function can only be called once so no menu item must be set yet */ if(priv->menuItem || priv->clickAction) { g_critical(_("Attempting to set menu item %s at %s but it is already set."), G_OBJECT_TYPE_NAME(inMenuItem), G_OBJECT_TYPE_NAME(self)); return; } /* Set value if changed */ if(priv->menuItem!=inMenuItem) { /* Set value */ priv->menuItem=inMenuItem; g_object_add_weak_pointer(G_OBJECT(priv->menuItem), (gpointer*)&priv->menuItem); /* Apply style for menu item if possible */ if(XFDASHBOARD_IS_STYLABLE(priv->menuItem)) { xfdashboard_stylable_add_class(XFDASHBOARD_STYLABLE(priv->menuItem), "popup-menu-item"); } /* Create click action and add it to menu item actor */ priv->clickAction=xfdashboard_click_action_new(); g_signal_connect_swapped(priv->clickAction, "clicked", G_CALLBACK(_xfdashboard_popup_menu_item_meta_clicked), self); clutter_actor_add_action(priv->menuItem, priv->clickAction); /* Notify about property change */ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardPopupMenuItemMetaProperties[PROP_MENU_ITEM]); } }