Remove new compiler warnings. gilir-fixes
authorJulien Lavergne <julien.lavergne@gmail.com>
Mon, 20 Dec 2010 17:42:03 +0000 (18:42 +0100)
committerJulien Lavergne <julien.lavergne@gmail.com>
Mon, 20 Dec 2010 17:42:03 +0000 (18:42 +0100)
lxsession-logout/dbus-interface.c
lxsession-logout/lxsession-logout.c
lxsession/lxsession.c
lxsession/settings-daemon.c
lxsession/xdg-autostart.c

index 940035b..5e8c0d9 100644 (file)
@@ -34,6 +34,25 @@ static struct {
 
 enum { DBUS_TIMEOUT = 2000 };                  /* Reply timeout */
 
+/* FORWARDS */
+gboolean dbus_ConsoleKit_CanStop(void);
+gboolean dbus_ConsoleKit_CanRestart(void);
+char * dbus_ConsoleKit_Stop(void);
+char * dbus_ConsoleKit_Restart(void);
+gboolean dbus_UPower_CanSuspend(void);
+gboolean dbus_UPower_CanHibernate(void);
+char * dbus_UPower_Suspend(void);
+char * dbus_UPower_Hibernate(void);
+gboolean dbus_HAL_CanShutdown(void);
+gboolean dbus_HAL_CanReboot(void);
+gboolean dbus_HAL_CanSuspend(void);
+gboolean dbus_HAL_CanHibernate(void);
+char * dbus_HAL_Shutdown(void);
+char * dbus_HAL_Reboot(void);
+char * dbus_HAL_Suspend(void);
+char * dbus_HAL_Hibernate(void);
+/* End FORWARDS */
+
 /* Connect to the system bus.  Once a connection is made, it is saved for reuse. */
 static DBusConnection * dbus_connect(void)
 {
index 38f2aa6..545cdce 100644 (file)
@@ -75,7 +75,7 @@ typedef struct {
 } HandlerContext;
 
 static gboolean lock_screen(void);
-static gboolean verify_running(char * display_manager, char * executable);
+static gboolean verify_running(const char * display_manager, const char * executable);
 static void logout_clicked(GtkButton * button, HandlerContext * handler_context);
 static void change_root_property(GtkWidget* w, const char* prop_name, const char* value);
 static void shutdown_clicked(GtkButton * button, HandlerContext * handler_context);
@@ -86,6 +86,7 @@ static void switch_user_clicked(GtkButton * button, HandlerContext * handler_con
 static void cancel_clicked(GtkButton * button, gpointer user_data);
 static GtkPositionType get_banner_position(void);
 static GdkPixbuf * get_background_pixbuf(void);
+gboolean expose_event(GtkWidget * widget, GdkEventExpose * event, GdkPixbuf * pixbuf);
 
 /* Try to lock the screen, return TRUE on success, FALSE if no suitable
  * screensaver was found or the screensaver command exited abnormally.
@@ -96,7 +97,7 @@ static gboolean lock_screen(void)
     gint argcp;
     gchar **argvp;
     gint exit_status;
-    gchar *locking_commands[] = {
+    const gchar *locking_commands[] = {
             "xscreensaver-command -lock",
             "gnome-screensaver-command --lock",
             "xlock -mode blank",
@@ -128,7 +129,7 @@ static gboolean lock_screen(void)
 }
 
 /* Verify that a program is running and that an executable is available. */
-static gboolean verify_running(char * display_manager, char * executable)
+static gboolean verify_running(const char * display_manager, const char * executable)
 {
     /* See if the executable we need to run is in the path. */
     gchar * full_path = g_find_program_in_path(executable);
@@ -196,7 +197,7 @@ static void change_root_property(GtkWidget* w, const char* prop_name, const char
     GdkWindow* root = gtk_widget_get_root_window(w);
     XChangeProperty(GDK_DISPLAY_XDISPLAY(dpy), GDK_WINDOW_XID(root),
                       XInternAtom(GDK_DISPLAY_XDISPLAY(dpy), prop_name, False), XA_STRING, 8,
-                      PropModeReplace, value, strlen(value) + 1);
+                      PropModeReplace, (unsigned char*) value, strlen(value) + 1);
 }
 
 /* Handler for "clicked" signal on Shutdown button. */
@@ -351,37 +352,23 @@ static GdkPixbuf * get_background_pixbuf(void)
 /* Handler for "expose_event" on background. */
 gboolean expose_event(GtkWidget * widget, GdkEventExpose * event, GdkPixbuf * pixbuf)
 {
-
-#if GTK_CHECK_VERSION(2,22,0)
-     GtkAllocation allocation;
-     gtk_widget_get_allocation(widget, &allocation);
-#endif
-
     if (pixbuf != NULL)
     {
         /* Copy the appropriate rectangle of the root window pixmap to the drawing area.
          * All drawing areas are immediate children of the toplevel window, so the allocation yields the source coordinates directly. */
-        gdk_draw_pixbuf(
 #if GTK_CHECK_VERSION(2,14,0)
-            gtk_widget_get_window(widget),                                     /* Drawable to render to */
-#else
-            widget->window,                        /* Drawable to render to */
-#endif
-            NULL,                                              /* GC for clipping */
-            pixbuf,                                            /* Source pixbuf */
-#if GTK_CHECK_VERSION(2,22,0)
-            allocation.x, allocation.y,
-#else
-            widget->allocation.x, widget->allocation.y,                /* Source coordinates */
-#endif
-            0, 0,                                              /* Destination coordinates */
-#if GTK_CHECK_VERSION(2,22,0)
-            allocation.width, allocation.height,
+       cairo_t * cr = gdk_cairo_create (gtk_widget_get_window(widget));
 #else
-            widget->allocation.width, widget->allocation.height,
+       cairo_t * cr = gdk_cairo_create (widget->window);
 #endif
-            GDK_RGB_DITHER_NORMAL,                             /* Dither type */
-            0, 0);                                             /* Dither offsets */
+       gdk_cairo_set_source_pixbuf (
+           cr,
+           pixbuf,
+           0,
+           0);
+
+       cairo_paint (cr);
+       cairo_destroy(cr);
     }
     return FALSE;
 }
index 5be428a..05d61a6 100644 (file)
@@ -50,7 +50,9 @@ static const char *display_name = NULL;
 char* window_manager = NULL; /* will be accessed by settings-daemon.c */
 
 /* name of environment variables */
+/* Disable not used
 static char sm_env[] = "SESSION_MANAGER";
+*/
 static char display_env[] = "DISPLAY";
 static char pid_env[] = "_LXSESSION_PID";
 
@@ -189,10 +191,8 @@ static void load_default_apps( const char* filename )
  */
 void start_session()
 {
-    FILE *file = NULL;
     const gchar* const *dirs = g_get_system_config_dirs();
     const gchar* const *dir;
-    GKeyFile* kf = g_key_file_new();
     char* filename;
 
     /* run window manager first */
index f16a15b..d6f6d8d 100644 (file)
 
 static XSettingsManager **managers = NULL;
 
+/* FORWARDS */
+gboolean start_settings_daemon(GKeyFile* kf);
+void settings_manager_selection_clear( XEvent* evt );
+void settings_deamon_reload();
+/* End FORWARDS */
+
 static void terminate_cb (void *data)
 {
        gboolean *terminated = data;
@@ -56,13 +62,20 @@ static void terminate_cb (void *data)
 
 static void merge_xrdb(const char* content, int len)
 {
-    char* argv[] = { "xrdb", "-merge", "-", NULL };
+    gchar* argv[] = { "xrdb", "-merge", "-", NULL };
     GPid pid;
     int stdi, status, w;
     if( g_spawn_async_with_pipes(NULL, argv, NULL, G_SPAWN_SEARCH_PATH,
                         NULL, NULL, &pid, &stdi, NULL, NULL, NULL ) )
     {
-        w = write( stdi, content, len < 0 ? strlen(content) : len );
+        if (len < 0)
+        {
+            w = write( stdi, content, strlen(content));
+        }
+        else
+        {
+            w = write( stdi, content, len);
+        }
         close(stdi);
         waitpid( pid, &status, 0 );
     }
@@ -122,7 +135,7 @@ static void configure_input(GKeyFile* kf)
     set_left_handed_mouse(left_handed);
 
     /* Keyboard settings */
-    if(XkbGetAutoRepeatRate(dpy, XkbUseCoreKbd, &delay, &interval))
+    if(XkbGetAutoRepeatRate(dpy, XkbUseCoreKbd, (unsigned int*) &delay, (unsigned int*) &interval))
     {
         int val;
         val = g_key_file_get_integer(kf, "Keyboard", "Delay", NULL);
@@ -144,8 +157,6 @@ static void configure_input(GKeyFile* kf)
 
 static void load_settings( GKeyFile* kf )
 {
-       gboolean ret;
-       char* file;
     GString* buf;
     char* str;
     int val;
index 151c625..1f72e13 100644 (file)
@@ -191,7 +191,7 @@ static void launch_autostart_file( const char* desktop_id, const char* desktop_f
         if( only_show_in )
         {
             /* The format of this list is like:  OnlyShowIn=GNOME;XFCE */
-            int i = 0;
+            gsize i = 0;
             for( i = 0; i < n; ++i )
             {
                 /* Only start this program if we are in the "OnlyShowIn" list */
@@ -212,7 +212,7 @@ static void launch_autostart_file( const char* desktop_id, const char* desktop_f
                        if( not_show_in )
                        {
                                /* The format of this list is like:  NotShowIn=KDE;IceWM */
-                               int i = 0;
+                               gsize i = 0;
                                for( i = 0; i < n; ++i )
                                {
                                        /* Only start this program if we are in the "OnlyShowIn" list */
@@ -276,7 +276,7 @@ static void get_autostart_files_in_dir( GHashTable* hash, const char* de_name, c
         char *path;
         const char *name;
 
-        while( name = g_dir_read_name( dir ) )
+        while( name == g_dir_read_name( dir ) )
         {
             if(g_str_has_suffix(name, ".desktop"))
             {