--- xfpm-common.c 2014-01-07 19:50:34.344525914 +0200 +++ xfpm-common-new.c 2014-01-07 21:31:06.128943854 +0200 @@ -34,7 +34,7 @@ { if ( !g_strcmp0 (string, "TRUE") ) return TRUE; else if ( !g_strcmp0 (string, "FALSE") ) return FALSE; - + return FALSE; } @@ -43,12 +43,12 @@ GtkBuilder *builder; builder = gtk_builder_new (); - + gtk_builder_add_from_string (GTK_BUILDER (builder), ui, -1, error); - + return builder; } @@ -56,9 +56,9 @@ xfpm_link_browser (GtkAboutDialog *about, const gchar *linkto, gpointer data) { gchar *cmd; - + cmd = g_strdup_printf ("%s %s","xdg-open", linkto); - + if ( !g_spawn_command_line_async (cmd, NULL) ) { g_free (cmd); @@ -66,7 +66,7 @@ g_spawn_command_line_async (cmd, NULL); } g_free (cmd); - + } static void @@ -75,44 +75,40 @@ gchar *cmd = g_strdup_printf( "%s %s", "xdg-email", linkto); g_spawn_command_line_async (cmd, NULL); - + g_free (cmd); } - -void + +void xfpm_lock_screen (void) { gboolean ret = g_spawn_command_line_async ("xflock4", NULL); - + if ( !ret ) { - g_spawn_command_line_async ("gnome-screensaver-command -l", NULL); + ret = g_spawn_command_line_async ("xscreensaver-command -lock", NULL); } - + if ( !ret ) { - /* this should be the default*/ + /* This could be the default, if it worked well. */ + /* This supports gnome-screensaver. */ ret = g_spawn_command_line_async ("xdg-screensaver lock", NULL); } - - if ( !ret ) - { - ret = g_spawn_command_line_async ("xscreensaver-command -lock", NULL); - } - + if ( !ret ) { g_critical ("Connot lock screen\n"); } } -void -xfpm_preferences (void) +void +xfpm_preferences (void) { g_spawn_command_line_async ("xfce4-power-manager-settings", NULL); } -void +void xfpm_help (void) { g_spawn_command_line_async ("xfhelp4 xfce4-power-manager.html", NULL); @@ -124,27 +120,27 @@ g_spawn_command_line_async ("xfce4-power-manager -q", NULL); } -void +void xfpm_about (GtkWidget *widget, gpointer data) { gchar *package = (gchar *)data; - - const gchar* authors[3] = + + const gchar* authors[3] = { - "Ali Abdallah ", + "Ali Abdallah ", NULL }; - + static const gchar *documenters[] = { "Ali Abdallah ", NULL, }; - + gtk_about_dialog_set_url_hook (xfpm_link_browser, NULL, NULL); gtk_about_dialog_set_email_hook (xfpm_link_mailto, NULL, NULL); - + gtk_show_about_dialog (NULL, "authors", authors, "copyright", "Copyright \302\251 2008-2011 Ali Abdallah", @@ -156,7 +152,7 @@ "version", PACKAGE_VERSION, "website", "http://goodies.xfce.org", NULL); - + } gboolean xfpm_is_multihead_connected (void) @@ -165,11 +161,11 @@ GdkScreen *screen; gint nscreen; gint nmonitor; - + dpy = gdk_display_get_default (); - + nscreen = gdk_display_get_n_screens (dpy); - + if ( nscreen == 1 ) { screen = gdk_display_get_screen (dpy, 0); @@ -179,7 +175,7 @@ if ( nmonitor > 1 ) { g_debug ("Multiple monitor connected"); - return TRUE; + return TRUE; } else return FALSE; @@ -190,7 +186,7 @@ g_debug ("Multiple screen connected"); return TRUE; } - + return FALSE; } @@ -198,19 +194,19 @@ { GdkPixbuf *pix = NULL; GError *error = NULL; - - pix = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), - icon_name, + + pix = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), + icon_name, size, GTK_ICON_LOOKUP_USE_BUILTIN, &error); - + if ( error ) { g_warning ("Unable to load icon : %s : %s", icon_name, error->message); g_error_free (error); } - + return pix; }