grim/guifications1

Parents b265f29f5b68
Children 072615cf933a
man do i hate windows... i'm making progress though...
--- a/Makefile.mingw Sat Jan 03 07:30:04 2004 +0000
+++ b/Makefile.mingw Sat Jan 03 11:00:13 2004 +0000
@@ -26,7 +26,9 @@
DEFINES =
-LDFLAGS = -mwindows
+LDFLAGS =
+
+#-mwindows
##
## INCLUDE MAKEFILES
--- a/gf_theme_editor.c Sat Jan 03 07:30:04 2004 +0000
+++ b/gf_theme_editor.c Sat Jan 03 11:00:13 2004 +0000
@@ -119,9 +119,9 @@
file_name = NULL;
- window = make_window();
clear_theme();
update_controls();
+ window = make_window();
gtk_main();
return 0;
@@ -420,7 +420,7 @@
static void
make_advanced_page(GtkWidget *notebook) {
GtkWidget *vbox, *scrolled_window, *dir_tree_view;
-
+
vbox = add_page(GTK_NOTEBOOK(notebook), "Advanced Theme", -1);
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
@@ -431,6 +431,7 @@
dir_tree_view = grim_dir_tree_view_new();
g_signal_connect(G_OBJECT(dir_tree_view), "row-activated", G_CALLBACK(moved_cursor), NULL);
gtk_container_add(GTK_CONTAINER(scrolled_window), dir_tree_view);
+
grim_dir_tree_view_set_path(GRIM_DIR_TREE_VIEW(dir_tree_view), g_get_home_dir());
}
/**********************************************************************/
--- a/grimdirtreeview.c Sat Jan 03 07:30:04 2004 +0000
+++ b/grimdirtreeview.c Sat Jan 03 11:00:13 2004 +0000
@@ -1,6 +1,6 @@
/*
Guifications - The notification plugin to end all notification plugins!
- Copyright (C) 2003 Gary Kramlich
+ Copyright (C) 2003-2004 Gary Kramlich
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
+#include <ctype.h>
#include <string.h>
#include <math.h>
@@ -313,6 +314,8 @@
GtkTreeIter current, child;
gchar *new_path;
+ printf("add dir; parent: %s child: %s\n", parent_path, child_path);
+
/* tweak when show hidden property is added */
if (child_path[0] == '.')
return;
@@ -336,9 +339,27 @@
gtk_tree_store_set(store, &child, DIR_COL_TEXT, "", DIR_COL_PATH, NULL, -1);
}
}
+ #ifdef _WIN32
+ else {
+ printf("length: %d\n", strlen(child_path));
+ if (strlen(child_path) == 3 ) {
+ if (isalpha(child_path[0]) && child_path[1] == ':' && child_path[2] == G_DIR_SEPARATOR) {
+ gtk_tree_store_append(store, &current, parent);
+ gtk_tree_store_set(store, &current, DIR_COL_ICON, pixbuf, DIR_COL_TEXT, child_path, DIR_COL_PATH, new_path, -1);
+
+ if (has_subdir(child_path)) {
+ gtk_tree_store_append(store, &child, &current);
+ gtk_tree_store_set(store, &child, DIR_COL_TEXT, "", DIR_COL_PATH, NULL, -1);
+ }
+ }
+ }
+ }
+ #endif
g_object_unref(pixbuf);
g_free(new_path);
+
+ printf("add dir exit\n");
}
static void
@@ -351,6 +372,8 @@
gchar *dir_path, *child_path = NULL;
gchar *name;
+ printf("expand callback\n");
+
gtk_tree_model_get(GTK_TREE_MODEL(dir_tree_view->store), iter, DIR_COL_PATH, &dir_path, -1);
pixbuf = gdk_pixbuf_new_from_xpm_data(folder_open_xpm);
@@ -380,6 +403,8 @@
gtk_tree_sortable_set_sort_column_id(sortable, DIR_COL_TEXT, GTK_SORT_ASCENDING);
}
}
+
+ printf("expand callback exit\n");
}
static void
@@ -388,6 +413,8 @@
GtkTreeIter holder, child;
gint count, i;
+ printf("collapse callback\n");
+
pixbuf = gdk_pixbuf_new_from_xpm_data(folder_xpm);
gtk_tree_store_set(dir_tree_view->store, iter, DIR_COL_ICON, pixbuf, -1);
g_object_unref(pixbuf);
@@ -401,6 +428,8 @@
gtk_tree_model_iter_children(GTK_TREE_MODEL(dir_tree_view->store), &child, iter);
gtk_tree_store_remove(dir_tree_view->store, &child);
}
+
+ printf("collapse callback exit\n");
}
GtkWidget *
@@ -414,6 +443,8 @@
GtkTreeIter selected;
gchar *path = NULL, *ret_path;
+ printf("get path\n");
+
selection = gtk_tree_view_get_selection(&dir_tree_view->tree_view);
if (gtk_tree_selection_get_selected(selection, NULL, &selected)) {
gtk_tree_model_get(GTK_TREE_MODEL(dir_tree_view->store), &selected, DIR_COL_PATH, &path, -1);
@@ -423,7 +454,9 @@
}
ret_path = g_strdup(path);
-
+
+ printf("get path exit\n");
+
return ret_path;
}
@@ -432,24 +465,39 @@
GtkTreeSelection *selection;
GtkTreePath *tree_path;
GtkTreeIter parent, child;
- gchar **directories;
+ gchar **directories = NULL;
gchar *search_path = NULL, *new_path = NULL, *child_path = NULL;
- gint dir = 0;
+ gint dir = 0, drives = 0;
+ printf("set path: %s\n", path);
+
+ if (path == NULL)
+ path = g_strdup("c:\\windows\\");
+
+ if (!g_path_is_absolute(path))
+ return FALSE;
+
directories = g_strsplit(path, G_DIR_SEPARATOR_S, 0);
while (directories[dir] != NULL) {
- if (dir == 0) {
- search_path = g_strdup(G_DIR_SEPARATOR_S);
-
- gtk_tree_model_get_iter_first(GTK_TREE_MODEL(dir_tree_view->store), &parent);
+ printf("dir: %s\n", directories[dir]);
+
+ #ifdef _WIN32
+ drives = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(dir_tree_view->store), NULL);
+ printf("drives: %d", drives);
+ #else
+ if (dir == 0) {
+ search_path = g_strdup(G_DIR_SEPARATOR_S);
- tree_path = gtk_tree_model_get_path(GTK_TREE_MODEL(dir_tree_view->store), &parent);
- gtk_tree_view_expand_row(GTK_TREE_VIEW(dir_tree_view), tree_path, TRUE);
- gtk_tree_path_free(tree_path);
+ gtk_tree_model_get_iter_first(GTK_TREE_MODEL(dir_tree_view->store), &parent);
- dir++;
- }
+ tree_path = gtk_tree_model_get_path(GTK_TREE_MODEL(dir_tree_view->store), &parent);
+ gtk_tree_view_expand_row(GTK_TREE_VIEW(dir_tree_view), tree_path, TRUE);
+ gtk_tree_path_free(tree_path);
+
+ dir++;
+ }
+ #endif
new_path = g_strdup_printf("%s%s%s", search_path, directories[dir], G_DIR_SEPARATOR_S);
@@ -495,7 +543,9 @@
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dir_tree_view));
gtk_tree_selection_unselect_all(selection);
gtk_tree_selection_select_iter(selection, &child);
-
+
+ printf("set path exit");
+
return FALSE;
}