static void on_proxy_signal (GDBusProxy *proxy, gchar *sender, gchar *signal_name, GVariant *params, gpointer *user_data) { if (g_strcmp0 (signal_name, "RunStateChanged") == 0) { on_run_state_changed (NEMO_DESKTOP_MANAGER (user_data)); } else if (g_strcmp0 (signal_name, "MonitorsChanged") == 0) { on_monitors_changed (NEMO_DESKTOP_MANAGER (user_data)); } }
static void nemo_desktop_manager_finalize (GObject *object) { g_object_unref (NEMO_DESKTOP_MANAGER (object)->action_manager); G_OBJECT_CLASS (nemo_desktop_manager_parent_class)->finalize (object); }
static void nemo_desktop_manager_dispose (GObject *object) { NemoDesktopManager *manager = NEMO_DESKTOP_MANAGER (object); close_all_windows (manager); g_signal_handler_disconnect (nemo_desktop_preferences, manager->show_desktop_changed_id); g_signal_handler_disconnect (nemo_desktop_preferences, manager->desktop_layout_changed_id); g_signal_handler_disconnect (nemo_desktop_preferences, manager->use_grid_changed_id); g_signal_handler_disconnect (manager->screen, manager->size_changed_id); g_signal_handler_disconnect (nemo_preferences, manager->home_dir_changed_id); g_signal_handler_disconnect (nemo_preferences, manager->orphaned_icon_handling_id); G_OBJECT_CLASS (nemo_desktop_manager_parent_class)->dispose (object); }
static void nemo_desktop_manager_constructed (GObject *object) { G_OBJECT_CLASS (nemo_desktop_manager_parent_class)->constructed (object); NemoDesktopManager *manager = NEMO_DESKTOP_MANAGER (object); manager->screen = gdk_screen_get_default (); manager->update_layout_idle_id = 0; manager->show_desktop_changed_id = g_signal_connect_swapped (nemo_desktop_preferences, "changed::" NEMO_PREFERENCES_SHOW_DESKTOP, G_CALLBACK (queue_update_layout), manager); manager->desktop_layout_changed_id = g_signal_connect_swapped (nemo_desktop_preferences, "changed::" NEMO_PREFERENCES_DESKTOP_LAYOUT, G_CALLBACK (queue_update_layout), manager); manager->size_changed_id = g_signal_connect_swapped (manager->screen, "size_changed", G_CALLBACK (queue_update_layout), manager); manager->use_grid_changed_id = g_signal_connect_swapped (nemo_desktop_preferences, "changed::" NEMO_PREFERENCES_USE_DESKTOP_GRID, G_CALLBACK (queue_update_layout), manager); /* Monitor the preference to have the desktop */ /* point to the Unix home folder */ manager->home_dir_changed_id = g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_DESKTOP_IS_HOME_DIR, G_CALLBACK (queue_update_layout), manager); manager->orphaned_icon_handling_id = g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_ORPHANED_DESKTOP_ICONS, G_CALLBACK (queue_update_layout), manager); layout_changed (manager); }
static void nemo_desktop_manager_dispose (GObject *object) { NemoDesktopManager *manager = NEMO_DESKTOP_MANAGER (object); FETCH_PRIV (manager); DEBUG ("Disposing NemoDesktopManager"); close_all_windows (manager); g_signal_handlers_disconnect_by_func (nemo_desktop_preferences, queue_update_layout, manager); g_signal_handlers_disconnect_by_func (nemo_preferences, queue_update_layout, manager); if (priv->fallback_size_changed_id > 0) { g_signal_handler_disconnect (priv->fallback_screen, priv->fallback_size_changed_id); priv->fallback_size_changed_id = 0; } G_OBJECT_CLASS (nemo_desktop_manager_parent_class)->dispose (object); }
static GdkFilterReturn gdk_filter_func (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data) { XEvent *xevent = gdk_xevent; NemoDesktopManager *manager; manager = NEMO_DESKTOP_MANAGER (data); switch (xevent->type) { case PropertyNotify: if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name ("_NET_WORKAREA")) layout_changed (manager); break; default: break; } return GDK_FILTER_CONTINUE; }
static void on_proxy_created (GObject *source, GAsyncResult *res, gpointer user_data) { NemoDesktopManager *manager = NEMO_DESKTOP_MANAGER (user_data); FETCH_PRIV (manager); priv->proxy = nemo_cinnamon_proxy_new_for_bus_finish (res, NULL); if (priv->proxy == NULL) { g_warning ("Cinnamon proxy unsuccessful, applying default behavior"); /* We should always end up with a proxy, as long as dbus itself is working.. */ priv->other_desktop = TRUE; return; } DEBUG ("Cinnamon proxy established, getting owner and state"); priv->name_owner_changed_id = g_signal_connect_swapped (priv->proxy, "notify::g-name-owner", G_CALLBACK (on_bus_name_owner_changed), manager); priv->proxy_signals_id = g_signal_connect (priv->proxy, "g-signal", G_CALLBACK (on_proxy_signal), manager); on_bus_name_owner_changed (manager); if (!priv->proxy_owned) { priv->failsafe_timeout_id = g_timeout_add_seconds (5, (GSourceFunc) on_failsafe_timeout, manager); } on_run_state_changed (manager); }