summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct2
-rw-r--r--browse_model.c10
-rw-r--r--db.c15
-rw-r--r--thumbnails.c8
-rw-r--r--wallpapers.c4
-rw-r--r--window_main.c9
-rw-r--r--window_tag.c2
7 files changed, 20 insertions, 30 deletions
diff --git a/SConstruct b/SConstruct
index f41d190..c16e2a9 100644
--- a/SConstruct
+++ b/SConstruct
@@ -11,7 +11,7 @@ for lib, h in (('glib-2.0', None), ('sqlite3', 'sqlite3.h'), ('gtk-x11-2.0', Non
Exit(1)
env = conf.Finish()
-env.Append(CCFLAGS = ['-std=gnu99', '-g'])
+env.Append(CCFLAGS = ['-std=gnu99', '-g', '-Wall'])
env.Append(LINKFLAGS = ['-Wl,--export-dynamic'])
env.ParseConfig('pkg-config --cflags --libs glib-2.0')
env.ParseConfig('pkg-config --cflags --libs sqlite3')
diff --git a/browse_model.c b/browse_model.c
index 72aac8a..769d768 100644
--- a/browse_model.c
+++ b/browse_model.c
@@ -339,8 +339,6 @@ static gboolean browse_model_iter_has_child(GtkTreeModel *tree_model, GtkTreeIte
static gint browse_model_iter_n_children(GtkTreeModel *tree_model, GtkTreeIter *iter) {
BrowseModel *browse_model;
BrowseModelRecord *record;
- GArray *array;
- int n;
g_return_val_if_fail(MODEL_IS_BROWSE(tree_model), -1);
g_return_val_if_fail(iter == NULL || iter->user_data != NULL, 0);
@@ -353,15 +351,9 @@ static gint browse_model_iter_n_children(GtkTreeModel *tree_model, GtkTreeIter *
record = (BrowseModelRecord*)iter->user_data;
- //array = NULL;
- //g_return_val_if_fail(db_get_wallpapers(record->dir.dirid, &array), -1);
- //for(n = 0; (&g_array_index(array, struct wallpaper_t, n))->filepath; n++);
-
BROWSE_MODEL_ENSURE_CHILDREN(record);
return record->children->len;
-
- return n;
}
static gboolean browse_model_iter_nth_child(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n) {
@@ -405,7 +397,7 @@ static gboolean browse_model_iter_nth_child(GtkTreeModel *tree_model, GtkTreeIte
}
static gboolean browse_model_iter_parent(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *child) {
- BrowseModelRecord *record, *childrecord;
+ BrowseModelRecord *childrecord;
BrowseModel *browse_model;
g_return_val_if_fail(MODEL_IS_BROWSE(tree_model), FALSE);
diff --git a/db.c b/db.c
index 0688d75..29ce639 100644
--- a/db.c
+++ b/db.c
@@ -161,7 +161,7 @@ int db_get_top_level_directories(GArray **array) {
*array = g_array_new(TRUE, FALSE, sizeof(struct directory_t));
while((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
- temp.name = g_strdup(sqlite3_column_text(stmt, 1));
+ temp.name = g_strdup((const gchar*)sqlite3_column_text(stmt, 1));
temp.dirid = sqlite3_column_int64(stmt, 0);
g_array_append_val(*array, temp);
}
@@ -198,7 +198,7 @@ int db_get_directories(sqlite_uint64 parent, GArray **array) {
*array = g_array_new(TRUE, FALSE, sizeof(struct directory_t));
while((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
- temp.name = g_strdup(sqlite3_column_text(stmt, 1));
+ temp.name = g_strdup((const gchar*)sqlite3_column_text(stmt, 1));
temp.dirid = sqlite3_column_int64(stmt, 0);
g_array_append_val(*array, temp);
}
@@ -297,7 +297,6 @@ sqlite_uint64 db_get_wallpaper(const char *path) {
int db_get_wallpaper_data(sqlite_uint64 id, struct wallpaper_t *wall) {
sqlite3_stmt *stmt;
int rc;
- sqlite_uint64 dirid;
rc = sqlite3_prepare_v2(db, "SELECT id, filepath, size, width, height FROM wallpaper WHERE id = ? LIMIT 1", -1, &stmt, NULL);
if(rc != SQLITE_OK) {
@@ -312,7 +311,7 @@ int db_get_wallpaper_data(sqlite_uint64 id, struct wallpaper_t *wall) {
rc = sqlite3_step(stmt);
if(rc == SQLITE_ROW) {
- wall->filepath = g_strdup(sqlite3_column_text(stmt, 1));
+ wall->filepath = g_strdup((const gchar*)sqlite3_column_text(stmt, 1));
wall->id = sqlite3_column_int64(stmt, 0);
wall->size = sqlite3_column_int(stmt, 2);
wall->width = sqlite3_column_int(stmt, 3);
@@ -343,7 +342,7 @@ int db_get_wall_tags(sqlite_uint64 wallid, GArray **array) {
*array = g_array_new(FALSE, FALSE, sizeof(struct tag_t));
while((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
temp.id = sqlite3_column_int64(stmt, 0);
- temp.name = g_strdup(sqlite3_column_text(stmt, 1));
+ temp.name = g_strdup((const gchar*)sqlite3_column_text(stmt, 1));
g_array_append_val(*array, temp);
}
@@ -380,7 +379,7 @@ int db_get_wallpapers(sqlite_uint64 dirid, GArray **array) {
*array = g_array_new(TRUE, FALSE, sizeof(struct wallpaper_t));
while((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
- temp.filepath = g_strdup(sqlite3_column_text(stmt, 1));
+ temp.filepath = g_strdup((const gchar*)sqlite3_column_text(stmt, 1));
temp.id = sqlite3_column_int64(stmt, 0);
temp.size = sqlite3_column_int(stmt, 2);
temp.width = sqlite3_column_int(stmt, 3);
@@ -457,7 +456,7 @@ int db_get_walls_by_tags(GArray *tags, GArray **array) {
*array = g_array_new(FALSE, FALSE, sizeof(struct wallpaper_t));
while((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
- temp.filepath = g_strdup(sqlite3_column_text(stmt, 1));
+ temp.filepath = g_strdup((const gchar*)sqlite3_column_text(stmt, 1));
temp.id = sqlite3_column_int64(stmt, 0);
temp.size = sqlite3_column_int(stmt, 2);
temp.width = sqlite3_column_int(stmt, 3);
@@ -565,7 +564,7 @@ int db_get_tags_all(GArray **array) {
*array = g_array_new(FALSE, FALSE, sizeof(struct tag_t));
while((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
- temp.name = g_strdup(sqlite3_column_text(stmt, 1));
+ temp.name = g_strdup((const gchar*)sqlite3_column_text(stmt, 1));
temp.id = sqlite3_column_int64(stmt, 0);
g_array_append_val(*array, temp);
}
diff --git a/thumbnails.c b/thumbnails.c
index 0359308..ab0d8f1 100644
--- a/thumbnails.c
+++ b/thumbnails.c
@@ -16,7 +16,7 @@ inline static gchar *get_wall_thumb_name(const gchar *filepath) {
ck = g_checksum_new(G_CHECKSUM_MD5);
s = g_strdup_printf("file://%s", filepath);
- g_checksum_update(ck, s, -1);
+ g_checksum_update(ck, (const guchar*)s, -1);
g_free(s);
cksum = g_strdup_printf("%s/.thumbnails/normal/%s.png", g_get_home_dir(), g_checksum_get_string(ck));
g_checksum_free(ck);
@@ -56,7 +56,7 @@ inline static gboolean is_thumb_modified(GdkPixbuf *pb, const gchar *filename, c
GdkPixbuf *get_thumbnail(const gchar *filepath) {
GdkPixbuf *pb, *pb2;
gint win_width, win_height, img_width, img_height, width, height;
- gdouble scalex, scaley, width_ratio, height_ratio, max_ratio;
+ gdouble scalex, scaley, width_ratio, height_ratio;
GError *error = NULL;
gchar *thumbname, *mtime, *width_s, *height_s;
@@ -102,7 +102,7 @@ GdkPixbuf *get_thumbnail(const gchar *filepath) {
g_object_unref(pb);
error = NULL;
- mtime = g_strdup_printf("%d", get_mtime(filepath));
+ mtime = g_strdup_printf("%lu", (unsigned long)get_mtime(filepath));
width_s = g_strdup_printf("%d", img_width);
height_s = g_strdup_printf("%d", img_height);
if(!gdk_pixbuf_save(pb2, thumbname, "png", &error,
@@ -165,4 +165,6 @@ gpointer add_thumbs_thread(gpointer data) {
}
thumb_thread = NULL;
+
+ return NULL;
}
diff --git a/wallpapers.c b/wallpapers.c
index e39ef21..56a72c6 100644
--- a/wallpapers.c
+++ b/wallpapers.c
@@ -16,10 +16,8 @@
static guint context_id = 0;
void add_dir_recursive(const gchar *path, sqlite_uint64 parent, GtkStatusbar *statusbar) {
- int pathlen = strlen(path);
GDir *dir;
const gchar *filename;
- sqlite_uint64 dir_temp;
sqlite_uint64 dirid;
gchar *filepath;
gchar *msg;
@@ -59,7 +57,7 @@ void add_dir_recursive(const gchar *path, sqlite_uint64 parent, GtkStatusbar *st
}
if(g_access(filepath, R_OK) == -1) {
- g_warning("Can't read %s: \n", filepath, strerror(errno));
+ g_warning("Can't read %s: %s\n", filepath, strerror(errno));
g_free(filepath);
continue;
}
diff --git a/window_main.c b/window_main.c
index 8a72ed5..bbfa922 100644
--- a/window_main.c
+++ b/window_main.c
@@ -85,7 +85,6 @@ inline static void tagview_create_model(GtkTreeView *tagview) {
inline static void tagview_init(GtkTreeView *tagview) {
GtkTreeViewColumn *col1, *col2;
GtkCellRenderer *renderer;
- GtkTreeSelection *selection;
col1 = gtk_tree_view_column_new();
gtk_tree_view_column_set_title(col1, "Show");
@@ -120,7 +119,7 @@ static void resize_pixbuf() {
GdkPixbuf *pb;
GdkWindow *window;
gint win_width, win_height, img_width, img_height, width, height;
- gdouble scalex, scaley, width_ratio, height_ratio, max_ratio;
+ gdouble scalex, scaley, width_ratio, height_ratio;
/* Skip if no pixbuf is loaded yet. */
if(!orig_pixbuf) return;
@@ -208,9 +207,7 @@ static void walls_set_window_title() {
}
static void load_pixbuf(const gchar *filepath) {
- GdkPixbuf *pb;
GError *error = NULL;
- GdkWindow *window;
sqlite_uint64 wallid;
struct wallpaper_t *wall;
gchar *base;
@@ -580,6 +577,8 @@ static void do_thumbview_popup(GtkWidget *widget, GdkEventButton *event) {
gboolean on_thumbview_popup_menu(GtkWidget *widget, gpointer user_data) {
do_thumbview_popup(widget, NULL);
+
+ return TRUE;
}
gboolean on_thumbview_button_press_event(GtkWidget *widget, GdkEventButton *event) {
@@ -599,6 +598,8 @@ gboolean on_left_pages_switch_page(GtkNotebook *notebook, GtkNotebookTab page, g
display_from_tagview();
break;
}
+
+ return TRUE;
}
static void save_window() {
diff --git a/window_tag.c b/window_tag.c
index d714f8a..e6ea986 100644
--- a/window_tag.c
+++ b/window_tag.c
@@ -32,7 +32,6 @@ void on_tagview_cell_toggled(GtkCellRendererToggle *cell_renderer, gchar *path_s
/* TODO: Find a better way to do this. */
inline static gboolean is_tag_inconsistent(struct tag_t *tag, GArray *walltags, gboolean *exists) {
- gboolean res;
gint n_y, n_n;
GArray *walltag_single;
gboolean found;
@@ -219,7 +218,6 @@ struct tagdialog_data_t *window_tagview_new(GtkWidget *parent, GArray* array) {
GtkBuilder *builder;
GtkDialog *dialog;
GtkTreeView *tagview;
- GtkWidget *content;
GtkButton *selnonebtn;
GtkImage *image;
GError *error = NULL;