Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a listener for monitor configuration changes #16

Merged
merged 1 commit into from
Sep 17, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/nemo-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ static void
desktop_changed_callback (gpointer user_data)
{
NemoApplication *application;

application = NEMO_APPLICATION (user_data);
if (g_settings_get_boolean (gnome_background_preferences, NEMO_PREFERENCES_SHOW_DESKTOP)) {
nemo_application_open_desktop (application);
Expand All @@ -571,6 +570,17 @@ desktop_changed_callback (gpointer user_data)
}
}

static void
monitors_changed_callback (GdkScreen *screen, NemoApplication *application)
{
if (g_settings_get_boolean (gnome_background_preferences, NEMO_PREFERENCES_SHOW_DESKTOP)) {
nemo_application_close_desktop ();
nemo_application_open_desktop (application);
} else {
nemo_application_close_desktop ();
}
}

static gboolean
window_can_be_closed (NemoWindow *window)
{
Expand Down Expand Up @@ -1046,6 +1056,8 @@ init_icons_and_styles (void)
static void
init_desktop (NemoApplication *self)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gdk_display_get_default (), 0);
/* Initialize the desktop link monitor singleton */
nemo_desktop_link_monitor_get ();

Expand All @@ -1063,6 +1075,10 @@ init_desktop (NemoApplication *self)
g_signal_connect_swapped (gnome_background_preferences, "changed::" NEMO_PREFERENCES_SHOW_DESKTOP,
G_CALLBACK (desktop_changed_callback),
self);

g_signal_connect (screen, "monitors-changed",
G_CALLBACK (monitors_changed_callback),
self);
}

static gboolean
Expand Down