diff options
-rw-r--r-- | plugins/background/msd-background-manager.c | 885 |
1 files changed, 441 insertions, 444 deletions
diff --git a/plugins/background/msd-background-manager.c b/plugins/background/msd-background-manager.c index 5353c94..ed778c4 100644 --- a/plugins/background/msd-background-manager.c +++ b/plugins/background/msd-background-manager.c @@ -52,563 +52,560 @@ #define MSD_BACKGROUND_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MSD_TYPE_BACKGROUND_MANAGER, MsdBackgroundManagerPrivate)) -//class MsdBackgroundManager -//{ - struct MsdBackgroundManagerPrivate { - GSettings* bg_settings; - GSettings* caja_settings; - MateBG* bg; - guint timeout_id; +struct MsdBackgroundManagerPrivate { + GSettings* bg_settings; + GSettings* caja_settings; + MateBG* bg; + guint timeout_id; - DBusConnection* dbus_connection; - }; + DBusConnection* dbus_connection; +}; - static void - msd_background_manager_class_init (MsdBackgroundManagerClass* klass); +static void +msd_background_manager_class_init (MsdBackgroundManagerClass* klass); - static void +static void - msd_background_manager_init (MsdBackgroundManager* background_manager); +msd_background_manager_init (MsdBackgroundManager* background_manager); - static void - msd_background_manager_finalize (GObject* object); +static void +msd_background_manager_finalize (GObject* object); - G_DEFINE_TYPE(MsdBackgroundManager, msd_background_manager, G_TYPE_OBJECT) +G_DEFINE_TYPE(MsdBackgroundManager, msd_background_manager, G_TYPE_OBJECT) - static gpointer manager_object = NULL; +static gpointer manager_object = NULL; - static gboolean - caja_is_running (void) - { - Atom window_id_atom; - Window caja_xid; - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - unsigned char* data; - int retval; - Atom wmclass_atom; - gboolean running; - gint error; - - window_id_atom = XInternAtom(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), - "CAJA_DESKTOP_WINDOW_ID", True); - - if (window_id_atom == None) - { - return FALSE; - } +static gboolean +caja_is_running (void) +{ + Atom window_id_atom; + Window caja_xid; + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long bytes_after; + unsigned char* data; + int retval; + Atom wmclass_atom; + gboolean running; + gint error; - retval = XGetWindowProperty(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), - GDK_ROOT_WINDOW(), - window_id_atom, - 0, - 1, - False, - XA_WINDOW, - &actual_type, - &actual_format, - &nitems, - &bytes_after, - &data); - - if (data != NULL) - { - caja_xid = *(Window*) data; - XFree(data); - } - else - { - return FALSE; - } + window_id_atom = XInternAtom(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), + "CAJA_DESKTOP_WINDOW_ID", True); - if (actual_type != XA_WINDOW) - { - return FALSE; - } - - if (actual_format != 32) - { - return FALSE; - } - - wmclass_atom = XInternAtom(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "WM_CLASS", False); - - gdk_error_trap_push(); - - retval = XGetWindowProperty(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), - caja_xid, - wmclass_atom, - 0, - 24, - False, - XA_STRING, - &actual_type, - &actual_format, - &nitems, - &bytes_after, - &data); - - error = gdk_error_trap_pop(); - - if (error == BadWindow) - { - return FALSE; - } - - if (actual_type == XA_STRING && - nitems == 24 && - bytes_after == 0 && - actual_format == 8 && - data != NULL && - !strcmp((char*) data, "desktop_window") && - !strcmp((char*) data + strlen((char*) data) + 1, "Caja")) - { - running = TRUE; - } - else - { - running = FALSE; - } - - if (data != NULL) - { - XFree(data); - } + if (window_id_atom == None) + { + return FALSE; + } - return running; + retval = XGetWindowProperty(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), + GDK_ROOT_WINDOW(), + window_id_atom, + 0, + 1, + False, + XA_WINDOW, + &actual_type, + &actual_format, + &nitems, + &bytes_after, + &data); + + if (data != NULL) + { + caja_xid = *(Window*) data; + XFree(data); + } + else + { + return FALSE; } - static void - draw_background (MsdBackgroundManager* manager, - gboolean use_crossfade) + if (actual_type != XA_WINDOW) { - GdkDisplay* display; - int n_screens; - int i; + return FALSE; + } - if (caja_is_running()) - { - return; - } + if (actual_format != 32) + { + return FALSE; + } - mate_settings_profile_start(NULL); + wmclass_atom = XInternAtom(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "WM_CLASS", False); - display = gdk_display_get_default(); - n_screens = gdk_display_get_n_screens(display); + gdk_error_trap_push(); - for (i = 0; i < n_screens; ++i) - { - GdkScreen* screen; - GdkWindow* root_window; - GdkPixmap* pixmap; - - screen = gdk_display_get_screen(display, i); - - root_window = gdk_screen_get_root_window(screen); - - pixmap = mate_bg_create_pixmap(manager->priv->bg, - root_window, - gdk_screen_get_width(screen), - gdk_screen_get_height(screen), - TRUE); - - if (use_crossfade) - { - MateBGCrossfade* fade; - - fade = mate_bg_set_pixmap_as_root_with_crossfade(screen, pixmap); - g_signal_connect(fade, - "finished", - G_CALLBACK (g_object_unref), NULL); - } - else - { - mate_bg_set_pixmap_as_root(screen, pixmap); - } - - g_object_unref(pixmap); - } + retval = XGetWindowProperty(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), + caja_xid, + wmclass_atom, + 0, + 24, + False, + XA_STRING, + &actual_type, + &actual_format, + &nitems, + &bytes_after, + &data); - mate_settings_profile_end(NULL); - } + error = gdk_error_trap_pop(); - static void - on_bg_changed (MateBG* bg, - MsdBackgroundManager* manager) + if (error == BadWindow) { - draw_background(manager, TRUE); + return FALSE; } - static void - on_bg_transitioned (MateBG* bg, - MsdBackgroundManager* manager) + if (actual_type == XA_STRING && + nitems == 24 && + bytes_after == 0 && + actual_format == 8 && + data != NULL && + !strcmp((char*) data, "desktop_window") && + !strcmp((char*) data + strlen((char*) data) + 1, "Caja")) { - draw_background(manager, FALSE); + running = TRUE; } - - static void - settings_changed_callback (GSettings* settings, - gchar* key, - MsdBackgroundManager* manager) + else { - mate_bg_load_from_preferences(manager->priv->bg); + running = FALSE; } - static void - watch_bg_preferences (MsdBackgroundManager* manager) + if (data != NULL) { - g_signal_connect (manager->priv->bg_settings, - "changed", - G_CALLBACK (settings_changed_callback), - manager); + XFree(data); } - static void - setup_bg (MsdBackgroundManager* manager) - { - g_return_if_fail(manager->priv->bg == NULL); + return running; +} - manager->priv->bg = mate_bg_new(); +static void +draw_background (MsdBackgroundManager* manager, + gboolean use_crossfade) +{ + GdkDisplay* display; + int n_screens; + int i; - /*g_signal_connect(manager->priv->bg, - "changed", - G_CALLBACK(on_bg_changed), - manager);*/ + if (caja_is_running()) + { + return; + } - /*g_signal_connect(manager->priv->bg, - "transitioned", - G_CALLBACK(on_bg_transitioned), - manager);*/ + mate_settings_profile_start(NULL); - watch_bg_preferences(manager); - mate_bg_load_from_preferences(manager->priv->bg); - } + display = gdk_display_get_default(); + n_screens = gdk_display_get_n_screens(display); - static gboolean - queue_draw_background (MsdBackgroundManager* manager) + for (i = 0; i < n_screens; ++i) { - manager->priv->timeout_id = 0; + GdkScreen* screen; + GdkWindow* root_window; + GdkPixmap* pixmap; - if (caja_is_running()) - { - return FALSE; - } + screen = gdk_display_get_screen(display, i); - setup_bg(manager); - draw_background(manager, FALSE); + root_window = gdk_screen_get_root_window(screen); - return FALSE; - } + pixmap = mate_bg_create_pixmap(manager->priv->bg, + root_window, + gdk_screen_get_width(screen), + gdk_screen_get_height(screen), + TRUE); - static DBusHandlerResult - on_bus_message (DBusConnection* connection, - DBusMessage* message, - void* user_data) - { - MsdBackgroundManager* manager = user_data; + if (use_crossfade) + { + MateBGCrossfade* fade; - if (dbus_message_is_signal(message, "org.mate.SessionManager", "SessionRunning")) + fade = mate_bg_set_pixmap_as_root_with_crossfade(screen, pixmap); + g_signal_connect(fade, + "finished", + G_CALLBACK (g_object_unref), NULL); + } + else { - /* If the session finishes then check if caja is - * running and if not, set the background. - * - * We wait a few seconds after the session is up - * because caja tells the session manager that its - * ready before it sets the background. - */ - manager->priv->timeout_id = g_timeout_add_seconds(8, - (GSourceFunc) queue_draw_background, - manager); - dbus_connection_remove_filter(connection, - on_bus_message, - manager); - - manager->priv->dbus_connection = NULL; + mate_bg_set_pixmap_as_root(screen, pixmap); } - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + g_object_unref(pixmap); } - static void - draw_background_after_session_loads (MsdBackgroundManager* manager) + mate_settings_profile_end(NULL); +} + +static void +on_bg_changed (MateBG* bg, + MsdBackgroundManager* manager) +{ + draw_background(manager, TRUE); +} + +static void +on_bg_transitioned (MateBG* bg, + MsdBackgroundManager* manager) +{ + draw_background(manager, FALSE); +} + +static void +settings_changed_callback (GSettings* settings, + gchar* key, + MsdBackgroundManager* manager) +{ + mate_bg_load_from_preferences(manager->priv->bg); +} + +static void +watch_bg_preferences (MsdBackgroundManager* manager) +{ + g_signal_connect (manager->priv->bg_settings, + "changed", + G_CALLBACK (settings_changed_callback), + manager); +} + +static void +setup_bg (MsdBackgroundManager* manager) +{ + g_return_if_fail(manager->priv->bg == NULL); + + manager->priv->bg = mate_bg_new(); + + /*g_signal_connect(manager->priv->bg, + "changed", + G_CALLBACK(on_bg_changed), + manager);*/ + + /*g_signal_connect(manager->priv->bg, + "transitioned", + G_CALLBACK(on_bg_transitioned), + manager);*/ + + watch_bg_preferences(manager); + mate_bg_load_from_preferences(manager->priv->bg); +} + +static gboolean +queue_draw_background (MsdBackgroundManager* manager) +{ + manager->priv->timeout_id = 0; + + if (caja_is_running()) { - DBusConnection* connection; + return FALSE; + } - connection = dbus_bus_get(DBUS_BUS_SESSION, NULL); + setup_bg(manager); + draw_background(manager, FALSE); - if (connection == NULL) - { - return; - } + return FALSE; +} - if (!dbus_connection_add_filter(connection, on_bus_message, manager, NULL)) - { - return; - } +static DBusHandlerResult +on_bus_message (DBusConnection* connection, + DBusMessage* message, + void* user_data) +{ + MsdBackgroundManager* manager = user_data; - manager->priv->dbus_connection = connection; + if (dbus_message_is_signal(message, "org.mate.SessionManager", "SessionRunning")) + { + /* If the session finishes then check if caja is + * running and if not, set the background. + * + * We wait a few seconds after the session is up + * because caja tells the session manager that its + * ready before it sets the background. + */ + manager->priv->timeout_id = g_timeout_add_seconds(8, + (GSourceFunc) queue_draw_background, + manager); + dbus_connection_remove_filter(connection, + on_bus_message, + manager); + + manager->priv->dbus_connection = NULL; } - static void - on_screen_size_changed (GdkScreen* screen, - MsdBackgroundManager* manager) - { - gboolean caja_show_desktop; + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} - caja_show_desktop = g_settings_get_boolean (manager->priv->caja_settings, - CAJA_SHOW_DESKTOP_KEY); +static void +draw_background_after_session_loads (MsdBackgroundManager* manager) +{ + DBusConnection* connection; - if (!caja_is_running() || !caja_show_desktop) - { - if (manager->priv->bg == NULL) - { - setup_bg(manager); - } + connection = dbus_bus_get(DBUS_BUS_SESSION, NULL); - draw_background(manager, FALSE); - } + if (connection == NULL) + { + return; } - static void - disconnect_screen_signals (MsdBackgroundManager* manager) + if (!dbus_connection_add_filter(connection, on_bus_message, manager, NULL)) { - GdkDisplay* display; - int i; - int n_screens; - - display = gdk_display_get_default(); - n_screens = gdk_display_get_n_screens(display); + return; + } - for (i = 0; i < n_screens; ++i) - { - GdkScreen *screen; + manager->priv->dbus_connection = connection; +} - screen = gdk_display_get_screen(display, i); +static void +on_screen_size_changed (GdkScreen* screen, + MsdBackgroundManager* manager) +{ + gboolean caja_show_desktop; - g_signal_handlers_disconnect_by_func(screen, - G_CALLBACK(on_screen_size_changed), - manager); - } - } + caja_show_desktop = g_settings_get_boolean (manager->priv->caja_settings, + CAJA_SHOW_DESKTOP_KEY); - static void - connect_screen_signals (MsdBackgroundManager* manager) + if (!caja_is_running() || !caja_show_desktop) { - GdkDisplay* display; - int i; - int n_screens; - - display = gdk_display_get_default(); - n_screens = gdk_display_get_n_screens(display); - - for (i = 0; i < n_screens; ++i) + if (manager->priv->bg == NULL) { - GdkScreen* screen; - screen = gdk_display_get_screen(display, i); - g_signal_connect(screen, - "monitors-changed", - G_CALLBACK(on_screen_size_changed), - manager); - - g_signal_connect(screen, - "size-changed", - G_CALLBACK(on_screen_size_changed), - manager); + setup_bg(manager); } + + draw_background(manager, FALSE); } +} - gboolean - msd_background_manager_start (MsdBackgroundManager* manager, - GError** error) - { - gboolean caja_show_desktop; +static void +disconnect_screen_signals (MsdBackgroundManager* manager) +{ + GdkDisplay* display; + int i; + int n_screens; - g_debug("Starting background manager"); - mate_settings_profile_start(NULL); + display = gdk_display_get_default(); + n_screens = gdk_display_get_n_screens(display); - manager->priv->bg_settings = g_settings_new (MATE_BG_SCHEMA); - manager->priv->caja_settings = g_settings_new (CAJA_SCHEMA); + for (i = 0; i < n_screens; ++i) + { + GdkScreen *screen; - /* If this is set, caja will draw the background and is - * almost definitely in our session. however, it may not be - * running yet (so is_caja_running() will fail). so, on - * startup, just don't do anything if this key is set so we - * don't waste time setting the background only to have - * caja overwrite it. - */ - caja_show_desktop = g_settings_get_boolean (manager->priv->caja_settings, - CAJA_SHOW_DESKTOP_KEY); + screen = gdk_display_get_screen(display, i); - if (!caja_show_desktop) - { - setup_bg(manager); - } - else - { - draw_background_after_session_loads(manager); - } + g_signal_handlers_disconnect_by_func(screen, + G_CALLBACK(on_screen_size_changed), + manager); + } +} - connect_screen_signals(manager); +static void +connect_screen_signals (MsdBackgroundManager* manager) +{ + GdkDisplay* display; + int i; + int n_screens; - mate_settings_profile_end(NULL); + display = gdk_display_get_default(); + n_screens = gdk_display_get_n_screens(display); - return TRUE; + for (i = 0; i < n_screens; ++i) + { + GdkScreen* screen; + screen = gdk_display_get_screen(display, i); + g_signal_connect(screen, + "monitors-changed", + G_CALLBACK(on_screen_size_changed), + manager); + + g_signal_connect(screen, + "size-changed", + G_CALLBACK(on_screen_size_changed), + manager); } - - void - msd_background_manager_stop (MsdBackgroundManager* manager) +} + +gboolean +msd_background_manager_start (MsdBackgroundManager* manager, + GError** error) +{ + gboolean caja_show_desktop; + + g_debug("Starting background manager"); + mate_settings_profile_start(NULL); + + manager->priv->bg_settings = g_settings_new (MATE_BG_SCHEMA); + manager->priv->caja_settings = g_settings_new (CAJA_SCHEMA); + + /* If this is set, caja will draw the background and is + * almost definitely in our session. however, it may not be + * running yet (so is_caja_running() will fail). so, on + * startup, just don't do anything if this key is set so we + * don't waste time setting the background only to have + * caja overwrite it. + */ + caja_show_desktop = g_settings_get_boolean (manager->priv->caja_settings, + CAJA_SHOW_DESKTOP_KEY); + + if (!caja_show_desktop) + { + setup_bg(manager); + } + else { - MsdBackgroundManagerPrivate* p = manager->priv; + draw_background_after_session_loads(manager); + } - g_debug("Stopping background manager"); + connect_screen_signals(manager); - disconnect_screen_signals(manager); + mate_settings_profile_end(NULL); - if (manager->priv->dbus_connection != NULL) - { - dbus_connection_remove_filter(manager->priv->dbus_connection, - on_bus_message, - manager); - } + return TRUE; +} - if (p->bg_settings != NULL) - { - g_object_unref(p->bg_settings); - p->bg_settings = NULL; - } +void +msd_background_manager_stop (MsdBackgroundManager* manager) +{ + MsdBackgroundManagerPrivate* p = manager->priv; - if (p->caja_settings != NULL) - { - g_object_unref(p->caja_settings); - p->caja_settings = NULL; - } + g_debug("Stopping background manager"); - if (p->timeout_id != 0) - { - g_source_remove(p->timeout_id); - p->timeout_id = 0; - } + disconnect_screen_signals(manager); - if (p->bg != NULL) - { - g_object_unref(p->bg); - p->bg = NULL; - } + if (manager->priv->dbus_connection != NULL) + { + dbus_connection_remove_filter(manager->priv->dbus_connection, + on_bus_message, + manager); } - static void - msd_background_manager_set_property (GObject* object, - guint prop_id, - const GValue* value, - GParamSpec* pspec) + if (p->bg_settings != NULL) { - MsdBackgroundManager* self; + g_object_unref(p->bg_settings); + p->bg_settings = NULL; + } - self = MSD_BACKGROUND_MANAGER(object); + if (p->caja_settings != NULL) + { + g_object_unref(p->caja_settings); + p->caja_settings = NULL; + } - switch (prop_id) - { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - break; - } + if (p->timeout_id != 0) + { + g_source_remove(p->timeout_id); + p->timeout_id = 0; } - static void - msd_background_manager_get_property (GObject* object, - guint prop_id, - GValue* value, - GParamSpec* pspec) + if (p->bg != NULL) { - MsdBackgroundManager* self; + g_object_unref(p->bg); + p->bg = NULL; + } +} - self = MSD_BACKGROUND_MANAGER(object); +static void +msd_background_manager_set_property (GObject* object, + guint prop_id, + const GValue* value, + GParamSpec* pspec) +{ + MsdBackgroundManager* self; - switch (prop_id) - { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - break; - } - } + self = MSD_BACKGROUND_MANAGER(object); - static GObject* - msd_background_manager_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam* construct_properties) + switch (prop_id) { - MsdBackgroundManager* background_manager; - MsdBackgroundManagerClass* klass; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} - klass = MSD_BACKGROUND_MANAGER_CLASS(g_type_class_peek(MSD_TYPE_BACKGROUND_MANAGER)); +static void +msd_background_manager_get_property (GObject* object, + guint prop_id, + GValue* value, + GParamSpec* pspec) +{ + MsdBackgroundManager* self; - background_manager = MSD_BACKGROUND_MANAGER(G_OBJECT_CLASS(msd_background_manager_parent_class)->constructor(type, - n_construct_properties, - construct_properties)); - return G_OBJECT(background_manager); - } + self = MSD_BACKGROUND_MANAGER(object); - static void - msd_background_manager_dispose (GObject* object) + switch (prop_id) { - MsdBackgroundManager* background_manager; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} - background_manager = MSD_BACKGROUND_MANAGER(object); +static GObject* +msd_background_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam* construct_properties) +{ + MsdBackgroundManager* background_manager; + MsdBackgroundManagerClass* klass; - G_OBJECT_CLASS(msd_background_manager_parent_class)->dispose(object); - } + klass = MSD_BACKGROUND_MANAGER_CLASS(g_type_class_peek(MSD_TYPE_BACKGROUND_MANAGER)); - static void - msd_background_manager_class_init (MsdBackgroundManagerClass* klass) - { - GObjectClass* object_class = G_OBJECT_CLASS(klass); + background_manager = MSD_BACKGROUND_MANAGER(G_OBJECT_CLASS(msd_background_manager_parent_class)->constructor(type, + n_construct_properties, + construct_properties)); + return G_OBJECT(background_manager); +} - object_class->get_property = msd_background_manager_get_property; - object_class->set_property = msd_background_manager_set_property; - object_class->constructor = msd_background_manager_constructor; - object_class->dispose = msd_background_manager_dispose; - object_class->finalize = msd_background_manager_finalize; +static void +msd_background_manager_dispose (GObject* object) +{ + MsdBackgroundManager* background_manager; - g_type_class_add_private(klass, sizeof(MsdBackgroundManagerPrivate)); - } + background_manager = MSD_BACKGROUND_MANAGER(object); - static void - msd_background_manager_init (MsdBackgroundManager* manager) - { - manager->priv = MSD_BACKGROUND_MANAGER_GET_PRIVATE(manager); - } + G_OBJECT_CLASS(msd_background_manager_parent_class)->dispose(object); +} - static void - msd_background_manager_finalize (GObject* object) - { - MsdBackgroundManager* background_manager; +static void +msd_background_manager_class_init (MsdBackgroundManagerClass* klass) +{ + GObjectClass* object_class = G_OBJECT_CLASS(klass); - g_return_if_fail(object != NULL); - g_return_if_fail(MSD_IS_BACKGROUND_MANAGER(object)); + object_class->get_property = msd_background_manager_get_property; + object_class->set_property = msd_background_manager_set_property; + object_class->constructor = msd_background_manager_constructor; + object_class->dispose = msd_background_manager_dispose; + object_class->finalize = msd_background_manager_finalize; - background_manager = MSD_BACKGROUND_MANAGER(object); + g_type_class_add_private(klass, sizeof(MsdBackgroundManagerPrivate)); +} - g_return_if_fail(background_manager->priv != NULL); +static void +msd_background_manager_init (MsdBackgroundManager* manager) +{ + manager->priv = MSD_BACKGROUND_MANAGER_GET_PRIVATE(manager); +} - G_OBJECT_CLASS(msd_background_manager_parent_class)->finalize(object); - } +static void +msd_background_manager_finalize (GObject* object) +{ + MsdBackgroundManager* background_manager; - MsdBackgroundManager* - msd_background_manager_new (void) - { - if (manager_object != NULL) - { - g_object_ref(manager_object); - } - else - { - manager_object = g_object_new(MSD_TYPE_BACKGROUND_MANAGER, NULL); + g_return_if_fail(object != NULL); + g_return_if_fail(MSD_IS_BACKGROUND_MANAGER(object)); - g_object_add_weak_pointer(manager_object, (gpointer*) &manager_object); - } + background_manager = MSD_BACKGROUND_MANAGER(object); + + g_return_if_fail(background_manager->priv != NULL); - return MSD_BACKGROUND_MANAGER(manager_object); + G_OBJECT_CLASS(msd_background_manager_parent_class)->finalize(object); +} + +MsdBackgroundManager* +msd_background_manager_new (void) +{ + if (manager_object != NULL) + { + g_object_ref(manager_object); } -//} + else + { + manager_object = g_object_new(MSD_TYPE_BACKGROUND_MANAGER, NULL); + + g_object_add_weak_pointer(manager_object, (gpointer*) &manager_object); + } + + return MSD_BACKGROUND_MANAGER(manager_object); +} |