[maemo-commits] [maemo-commits] r15879 - projects/haf/branches/hildon-fm/fremantle/hildon-fm
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Aug 18 11:30:33 EEST 2008
- Previous message: [maemo-commits] r15878 - projects/haf/branches/hildon-fm/fremantle/hildon-fm
- Next message: [maemo-commits] r15880 - in projects/haf/trunk/osso-gnome-vfs2: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: yangli Date: 2008-08-18 11:30:03 +0300 (Mon, 18 Aug 2008) New Revision: 15879 Modified: projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.c projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.h projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-model.c Log: done the feature for up button and path button, UI will be refined, backup the code for folder change dialog Modified: projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c =================================================================== --- projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c 2008-08-14 13:45:59 UTC (rev 15878) +++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c 2008-08-18 08:30:03 UTC (rev 15879) @@ -114,6 +114,9 @@ void hildon_gtk_file_chooser_install_properties(GObjectClass * klass); +static void hildon_file_chooser_dialog_update_path(GtkWidget *fs_widget, gpointer data); +static void hildon_file_chooser_update_path_button(HildonFileChooserDialog *self); + enum { PROP_EMPTY_TEXT = 0x2000, PROP_FILE_SYSTEM_MODEL, @@ -375,7 +378,8 @@ static void file_activated_handler(GtkWidget * widget, gpointer user_data) { - gtk_dialog_response(GTK_DIALOG(user_data), GTK_RESPONSE_OK); + hildon_file_chooser_update_path_button(HILDON_FILE_CHOOSER_DIALOG(user_data)); + //gtk_dialog_response(GTK_DIALOG(user_data), GTK_RESPONSE_OK); } static void @@ -2031,9 +2035,80 @@ strlen(gtk_entry_get_text(GTK_ENTRY(widget))) > 0); } +static void hildon_file_chooser_update_path_button(HildonFileChooserDialog *self) +{ + g_return_if_fail(HILDON_IS_FILE_CHOOSER_DIALOG(self)); + HildonFileChooserDialogPrivate *priv = HILDON_FILE_CHOOSER_DIALOG(self)->priv; + GtkTreeIter iter; + GtkTreeIter cur_iter; + //gchar *gtk_tree_path_str; + gchar *title; + gchar *path_string; + GList *list = NULL; + + + if (hildon_file_selection_get_current_folder_iter(priv->filetree, &iter)){ + gtk_tree_model_get(GTK_TREE_MODEL(priv->model), &iter, + HILDON_FILE_SYSTEM_MODEL_COLUMN_DISPLAY_NAME, + &title, -1); + if(strlen(title) == 0) + list = g_list_append(list, "Nokia"); + else + list = g_list_append(list, title); + printf("yang : before the loop, the title is %s\n", title); + + /*gtk_tree_path_str = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(priv->model), + &iter);*/ + } else + ULOG_INFO("Failed to get current folder iter"); + + while(g_strcasecmp(title, "/")/*!g_strcasecmp(gtk_tree_path_str, "0")*/){ + //free(title); + //free(gtk_tree_path_str); + cur_iter = iter; + gtk_tree_model_iter_parent(GTK_TREE_MODEL(priv->model), &iter, &cur_iter); + gtk_tree_model_get(GTK_TREE_MODEL(priv->model), &iter, + HILDON_FILE_SYSTEM_MODEL_COLUMN_DISPLAY_NAME, + &title, -1); + printf("yang : in the loop, the title is %s\n", title); + if(strlen(title) == 0) + list = g_list_append(list, "Nokia"); + else + list = g_list_append(list, title); + /*gtk_tree_path_str = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(priv->model), + &iter);*/ + } + //free(title); + path_string = g_malloc(100); + memset(path_string, 0, 100); + for (list = g_list_last(list); list; list = list->prev) { + printf("yang : content is %s", list->data); + if(strlen(path_string) == 0) + strcpy(path_string, list->data); + else + strcat(path_string, list->data); + strcat(path_string, "/"); + } + gtk_button_set_label(GTK_BUTTON(priv->path_button), path_string); + g_free(path_string); + g_list_free(list); + free(title); +} + static void hildon_response_up_button_clicked( GtkWidget *widget, gpointer data ) { + GtkTreeIter iter; + GtkTreeIter cur_iter; + + g_return_if_fail(HILDON_IS_FILE_CHOOSER_DIALOG(data)); + HildonFileChooserDialogPrivate *priv = HILDON_FILE_CHOOSER_DIALOG(data)->priv; + if (hildon_file_selection_get_current_folder_iter(priv->filetree, &iter)){ + cur_iter = iter; + gtk_tree_model_iter_parent(GTK_TREE_MODEL(priv->model), &iter, &cur_iter); + hildon_file_selection_set_current_folder_iter(priv->filetree, &iter); + } + //hildon_file_chooser_update_path_button(HILDON_FILE_CHOOSER_DIALOG(data)); g_print ("up button is clicked\n"); } @@ -2086,7 +2161,7 @@ priv->up_button = g_object_new(GTK_TYPE_BUTTON, "gtk-button-images", TRUE ); gtk_button_set_image(priv->up_button, image); g_signal_connect (G_OBJECT (priv->up_button), "clicked", - G_CALLBACK (hildon_response_up_button_clicked), NULL); + G_CALLBACK (hildon_response_up_button_clicked), self); gtk_widget_show(priv->up_button); priv->path_button = g_object_new(GTK_TYPE_BUTTON, "label", "Nokia Nxxx/", NULL); @@ -2317,7 +2392,7 @@ gtk_dialog_set_has_separator(GTK_DIALOG(obj), FALSE); hildon_file_chooser_dialog_set_limit(HILDON_FILE_CHOOSER_DIALOG(obj)); - + //hildon_file_chooser_update_path_button(HILDON_FILE_CHOOSER_DIALOG(obj)); return obj; } @@ -2743,3 +2818,37 @@ g_object_get (priv->filetree, "show-upnp", &show_upnp, NULL); return show_upnp; } + +static void hildon_file_chooser_dialog_update_path(GtkWidget *fs_widget, gpointer data) +{ + GtkFilePath *path = NULL; + gboolean showthumbnails = FALSE; + HildonFileSystemModel *fsmodel = NULL; + GtkTreeIter iter; // = NULL; + + gchar *title = NULL; + + if (fs_widget == NULL) { + return; + } + + path = hildon_file_selection_get_current_folder((HildonFileSelection *) fs_widget); + if (path == NULL) { + return; + } + + if (hildon_file_selection_get_current_folder_iter((HildonFileSelection *) fs_widget, + &iter)) { + g_object_get(G_OBJECT(fs_widget), "model", &fsmodel, NULL); + if (fsmodel == NULL) { + gtk_file_path_free(path); + return; + } + gtk_tree_model_get((GtkTreeModel *) fsmodel, &iter, + HILDON_FILE_SYSTEM_MODEL_COLUMN_DISPLAY_NAME, &title, -1); + } + printf("yang: title is %s", title); + exit(0); + g_free(title); + gtk_file_path_free(path); +} Modified: projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.c =================================================================== --- projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.c 2008-08-14 13:45:59 UTC (rev 15878) +++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.c 2008-08-18 08:30:03 UTC (rev 15879) @@ -76,9 +76,6 @@ GObjectConstructParam * construct_properties); static void -hildon_file_selection_set_current_folder_iter(HildonFileSelection * self, - GtkTreeIter * main_iter); -static void hildon_file_selection_check_close_load_banner(GtkTreeModel *model, GtkTreeIter *iter, gpointer data); static void hildon_file_selection_close_load_banner(HildonFileSelection * @@ -139,6 +136,9 @@ GtkWidget *scroll_thumb; GtkWidget *dir_tree; GtkWidget *view[4]; /* List, thumbnail, empty, repair */ + /* the pointer to the file_chooser_dialog to + notify to change the text in the path button */ + GtkWidget *chooser_dialog; int cur_view; GtkWidget *hpaned; @@ -1437,7 +1437,7 @@ GtkTreePath *sort_path = NULL; gboolean found = FALSE; - //GDK_THREADS_ENTER(); + GDK_THREADS_ENTER(); self = HILDON_FILE_SELECTION(data); priv = self->priv; @@ -1490,7 +1490,7 @@ /* We have to return TRUE, because cancel removes the handler now */ hildon_file_selection_cancel_delayed_select(priv); - //GDK_THREADS_LEAVE(); + GDK_THREADS_LEAVE(); return TRUE; } @@ -1649,6 +1649,7 @@ rebind_models(priv); hildon_file_selection_inspect_view(priv); + g_signal_emit(self, signal_file_activated, 0); /* These DON'T affect colums that have AUTOSIZE as sizing type ;) */ @@ -1713,7 +1714,6 @@ g_error_free(error); } #endif - gtk_tree_path_free(sort_path); } } @@ -1734,23 +1734,18 @@ => wrong row might be activated */ while (gtk_events_pending()) gtk_main_iteration(); - model = gtk_tree_view_get_model(view); /* Content pane filter model */ - if (gtk_tree_model_get_iter(model, &iter, path)) { gtk_tree_model_get(model, &iter, HILDON_FILE_SYSTEM_MODEL_COLUMN_IS_FOLDER, &is_folder, HILDON_FILE_SYSTEM_MODEL_COLUMN_IS_AVAILABLE, &is_available, -1); - if (is_available) { if (is_folder) { filter_path = gtk_tree_model_sort_convert_path_to_child_path( GTK_TREE_MODEL_SORT(model), path); - - base_path = gtk_tree_model_filter_convert_path_to_child_path( GTK_TREE_MODEL_FILTER( HILDON_FILE_SELECTION(data)->priv->view_filter), @@ -1788,8 +1783,7 @@ HILDON_FILE_SYSTEM_MODEL(self->priv->main_model), &iter, FALSE); } - - g_signal_emit(data, signal_file_activated, 0); + g_signal_emit(data, signal_file_activated, 0); } } } @@ -3356,7 +3350,7 @@ (gint *) key, order); } -static void +void hildon_file_selection_set_current_folder_iter(HildonFileSelection * self, GtkTreeIter * main_iter) { @@ -4440,14 +4434,14 @@ { struct idle_cursor_data *c = (struct idle_cursor_data *)data; - //GDK_THREADS_ENTER (); + GDK_THREADS_ENTER (); if (c->stubbornly) hildon_file_selection_set_cursor_stubbornly (c->self, c->view, c->path); else gtk_tree_view_set_cursor (c->view, c->path, NULL, FALSE); gtk_tree_path_free (c->path); - //GDK_THREADS_LEAVE (); + GDK_THREADS_LEAVE (); g_free (c); return FALSE; @@ -4718,6 +4712,13 @@ return ret; } +/*void hildon_file_selection_associate_file_chooser_dialog(HildonFileSelection *self, + HildonFileChooserDialog *chooser_dialog) +{ + HildonFileSelectionPrivate *priv = self->priv; + priv->chooser_dialog = chooser_dialog; + }*/ + void get_current_tree_path(HildonFileSelection *self, char* uri) { HildonFileSelectionPrivate *priv = self->priv; @@ -4735,3 +4736,4 @@ } } + Modified: projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.h =================================================================== --- projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.h 2008-08-14 13:45:59 UTC (rev 15878) +++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.h 2008-08-18 08:30:03 UTC (rev 15879) @@ -30,6 +30,7 @@ #include <gtk/gtkcontainer.h> #include <gtk/gtkfilefilter.h> #include "hildon-file-system-model.h" +//#include "hildon-file-chooser-dialog.h" G_BEGIN_DECLS #define HILDON_TYPE_FILE_SELECTION (hildon_file_selection_get_type()) @@ -167,6 +168,10 @@ gboolean hildon_file_selection_get_current_folder_iter(HildonFileSelection * self, GtkTreeIter * iter); +void +hildon_file_selection_set_current_folder_iter(HildonFileSelection * self, + GtkTreeIter * main_iter); + #ifndef HILDON_DISABLE_DEPRECATED gboolean hildon_file_selection_get_active_content_iter(HildonFileSelection *self, GtkTreeIter *iter); @@ -224,5 +229,8 @@ void get_current_tree_path(HildonFileSelection *self, char* uri); +/*void hildon_file_selection_associate_file_chooser_dialog(HildonFileSelection *self, + HildonFileChooserDialog *chooser_dialog); +*/ G_END_DECLS #endif Modified: projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-model.c =================================================================== --- projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-model.c 2008-08-14 13:45:59 UTC (rev 15878) +++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-model.c 2008-08-18 08:30:03 UTC (rev 15879) @@ -1166,7 +1166,7 @@ dfa_clos *c = (dfa_clos *)data; - //GDK_THREADS_ENTER (); + GDK_THREADS_ENTER (); node = hildon_file_system_model_search_folder (c->monitor); if (node) @@ -1177,7 +1177,7 @@ hildon_file_system_model_files_added (c->monitor, c->paths, c->data); } - //GDK_THREADS_LEAVE (); + GDK_THREADS_LEAVE (); g_object_unref (c->monitor); gtk_file_paths_free (c->paths);
- Previous message: [maemo-commits] r15878 - projects/haf/branches/hildon-fm/fremantle/hildon-fm
- Next message: [maemo-commits] r15880 - in projects/haf/trunk/osso-gnome-vfs2: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]