Fix memory leaks and compiler warnings.
authorHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Sat, 19 Dec 2009 09:14:36 +0000 (09:14 +0000)
committerHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Sat, 19 Dec 2009 09:14:36 +0000 (09:14 +0000)
src/Makefile.am
src/demo.c
src/main-dlg.c
src/main.c

index 3fce50e..4296a6c 100644 (file)
@@ -14,7 +14,9 @@ lxappearance_SOURCES = \
        demo.c demo.h \
        $(NULL)
 
-lxappearance_CFLAGS = -Wl,--export-dynamic
+lxappearance_CFLAGS = \
+       -Wl,--export-dynamic \
+       -Werror-implicit-function-declaration \
+       $(NULL)
 
 lxappearance_LDADD = $(PACKAGE_LIBS) $(INTLLIBS)
-
index 86b3789..8f838a5 100644 (file)
@@ -80,13 +80,13 @@ void show_demo( GdkNativeWindow wid )
     GtkWidget* tree_view;
 
     gtk_builder_add_from_file(builder, PACKAGE_DATA_DIR "/lxappearance/demo.ui", NULL);
-    demo = gtk_builder_get_object(builder, "demo");
+    demo = (GtkWidget*)gtk_builder_get_object(builder, "demo");
 
     g_object_get( gtk_settings_get_default(), "gtk-toolbar-style", &tb_style, NULL );
     gtk_toolbar_set_style (GTK_TOOLBAR (gtk_builder_get_object(builder, "toolbar")), tb_style );
 
     icon_view = GTK_ICON_VIEW( gtk_builder_get_object(builder, "icon_view" ) );
-    tree_view = gtk_builder_get_object(builder, "demo_treeview" );
+    tree_view = (GtkWidget*)gtk_builder_get_object(builder, "demo_treeview" );
 
     gtk_icon_view_set_pixbuf_column( icon_view, 0 );
     gtk_icon_view_set_text_column( icon_view, 1 );
@@ -114,4 +114,5 @@ void show_demo( GdkNativeWindow wid )
                gtk_container_add( (GtkContainer*)plug, demo );
                gtk_widget_show( plug );        
     }
+    g_object_unref(builder);
 }
index 4828ac7..157490f 100644 (file)
@@ -17,6 +17,7 @@
 #include <sys/wait.h>
 
 #include "main-dlg.h"
+#include "demo.h"
 
 enum {
     COL_DISP_NAME,
@@ -571,6 +572,8 @@ GtkWidget* main_dlg_new()
        }
 
     disable_apply();
+
+    g_object_unref(builder);
     return dlg;
 }
 
index f900663..066f4d4 100644 (file)
@@ -7,15 +7,19 @@
 #  include <config.h>
 #endif
 
+#include <libintl.h>
+
 #include <gtk/gtk.h>
 #include <string.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 #include <X11/X.h>
 #include <X11/Xatom.h>
 #include <X11/Xlib.h>
 #include <gdk/gdkx.h>
 
+#include "main-dlg.h"
 #include "demo.h"
 
 char tmp_rc_file[] = "/tmp/gtkrc-2.0-XXXXXX";