[Xfce4-commits] r23302 - in xarchiver/branches/xarchiver-psybsd: libxarchiver src
Stephan Arts
stephan at xfce.org
Fri Oct 6 14:27:58 UTC 2006
Author: stephan
Date: 2006-10-06 14:27:58 +0000 (Fri, 06 Oct 2006)
New Revision: 23302
Modified:
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h
xarchiver/branches/xarchiver-psybsd/src/archive_store.c
xarchiver/branches/xarchiver-psybsd/src/main_window.c
Log:
mime-type stuff.
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-10-06 13:50:47 UTC (rev 23301)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-10-06 14:27:58 UTC (rev 23302)
@@ -188,20 +188,6 @@
gchar **path_items;
LXAEntry *tmp_entry = NULL, *parent = NULL;
path_items = g_strsplit_set(path, "/\n", -1);
-/*
- tmp_entry = lxa_entry_get_child(&archive->root_entry, path_items[0]);
- if(!tmp_entry)
- {
- tmp_entry= g_new0(LXAEntry, 1);
- tmp_entry->filename = g_strdup(path_items[0]);
- if(path[strlen(path)-1] == '/')
- tmp_entry->is_folder = TRUE;
- else
- tmp_entry->is_folder = FALSE;
- lxa_entry_add_child(&archive->root_entry, tmp_entry);
-// lxa_entry_flush_buffer(&archive->root_entry);
- }
-*/
parent = &archive->root_entry;
for(i = 0; path_items[i]?strlen(path_items[i]):0;i++)
{
@@ -213,11 +199,10 @@
lxa_entry_add_child(parent, tmp_entry);
if(path[strlen(path)-1] == '/')
{
- tmp_entry->is_folder = TRUE;
-// lxa_entry_flush_buffer(parent);
+ tmp_entry->mime_type = "folder";
}
else
- tmp_entry->is_folder = FALSE;
+ tmp_entry->mime_type = "unknown";
}
parent = tmp_entry;
}
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h 2006-10-06 13:50:47 UTC (rev 23301)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h 2006-10-06 14:27:58 UTC (rev 23302)
@@ -38,8 +38,8 @@
struct _LXAEntry {
gchar *filename;
- gboolean is_folder;
gpointer props;
+ gchar *mime_type;
/* */
LXAEntry **children;
guint n_children;
Modified: xarchiver/branches/xarchiver-psybsd/src/archive_store.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/archive_store.c 2006-10-06 13:50:47 UTC (rev 23301)
+++ xarchiver/branches/xarchiver-psybsd/src/archive_store.c 2006-10-06 14:27:58 UTC (rev 23302)
@@ -374,7 +374,7 @@
if(column == -1)
{
g_value_init(value, G_TYPE_STRING);
- g_value_set_string(value, (strcmp(entry->filename, ".."))?entry->is_folder?"folder":"unknown":"go-up");
+ g_value_set_string(value, (strcmp(entry->filename, ".."))?entry->mime_type:"go-up");
}
else if(column == 0)
{
@@ -749,7 +749,9 @@
entry = lxa_entry_children_nth_data(entry, index);
g_return_if_fail(entry);
- g_return_if_fail(entry->is_folder);
+ /* TODO Signal file-activated */
+ if(strcmp(entry->mime_type, "folder"))
+ return;
store->current_entry = g_slist_prepend(store->current_entry, entry);
}
Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-10-06 13:50:47 UTC (rev 23301)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-10-06 14:27:58 UTC (rev 23302)
@@ -56,8 +56,6 @@
void
xa_main_window_reset_columns(XAMainWindow *window);
-void
-cb_xa_main_item_activated(GtkTreeView *treeview, GtkTreePath *treepath, GtkTreeViewColumn *column, gpointer userdata);
void
xa_main_window_archive_destroyed(LXAArchive *archive, XAMainWindow *window);
@@ -264,7 +262,6 @@
gtk_widget_show(window->scrollwindow);
gtk_widget_show(window->treeview);
-// g_signal_connect(G_OBJECT(window->treeview), "row-activated", G_CALLBACK(cb_xa_main_item_activated), window);
/* Statusbar */
window->statusbar = gtk_statusbar_new();
@@ -280,7 +277,6 @@
gtk_widget_show_all(window->statusbar);
gtk_container_add(GTK_CONTAINER(window), main_vbox);
- g_signal_connect(G_OBJECT(window), "style-set", G_CALLBACK(cb_xa_main_window_style_set), NULL);
}
GtkWidget *
@@ -325,25 +321,6 @@
}
}
-static void
-cb_xa_main_window_style_set(XAMainWindow *window, gpointer userdata)
-{
- if(!(gtk_icon_theme_has_icon(window->icon_theme, "folder") && gtk_icon_theme_has_icon(window->icon_theme, "unknown") && gtk_icon_theme_has_icon(window->icon_theme, "go-up")))
- window->props._show_icons = FALSE;
- else
- window->props._show_icons = TRUE;
-
- if(window->working_node)
- {
- if(((LXAEntry *)window->working_node->data)->children)
- {
- xa_main_window_reset_columns(window);
- xa_main_window_set_contents(window, window->lp_xa_archive);
- }
- }
-
-}
-
GtkWidget *
xa_main_window_find_image(gchar *filename, GtkIconSize size)
{
@@ -820,10 +797,7 @@
{
tmp_value = g_new0(GValue, 1);
tmp_value = g_value_init(tmp_value, G_TYPE_STRING);
- if(entry->is_folder)
- g_value_set_string(tmp_value, "folder");
- else
- g_value_set_string(tmp_value, "unknown");
+ g_value_set_string(tmp_value, entry->mime_type);
gtk_list_store_set_value(GTK_LIST_STORE(liststore), &iter, i, tmp_value);
g_value_unset(tmp_value);
g_free(tmp_value);
@@ -873,50 +847,6 @@
-void
-cb_xa_main_item_activated(GtkTreeView *treeview, GtkTreePath *treepath, GtkTreeViewColumn *column, gpointer userdata)
-{
- GtkTreeIter iter;
- GValue *value = g_new0(GValue, 1);
- XAMainWindow *main_window = userdata;
-
- GtkTreeModel *tree_model = gtk_tree_view_get_model(treeview);
-
- gtk_tree_model_get_iter(tree_model, &iter, treepath);
- if(main_window->props._show_icons)
- gtk_tree_model_get_value(tree_model, &iter, 1, value);
- else
- gtk_tree_model_get_value(tree_model, &iter, 0, value);
-
- const gchar *item_filename = (gchar *)g_value_get_string(value);
- if(!strcmp(item_filename, ".."))
- {
- main_window->working_node = g_slist_delete_link(main_window->working_node, main_window->working_node);
- xa_main_window_set_contents(main_window, main_window->lp_xa_archive);
- }
- else
- {
- if(item_filename)
- {
- LXAEntry *entry = lxa_entry_get_child(((LXAEntry *)main_window->working_node->data), item_filename);
- if(entry->is_folder)
- {
- main_window->working_node = g_slist_prepend(main_window->working_node, entry);
- xa_main_window_set_contents(main_window, main_window->lp_xa_archive);
- }
- else
- {
- GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(main_window), 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK, "What do you want to do today?");
- gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
- }
- }
- }
-
- g_value_unset(value);
- g_free(value);
-}
-
gchar *
xa_main_window_get_working_dir(XAMainWindow *window)
{
More information about the Xfce4-commits
mailing list