[maemo-commits] [maemo-commits] r16832 - projects/haf/branches/hildon-fm/fremantle/hildon-fm
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Dec 1 17:12:31 EET 2008
- Previous message: [maemo-commits] r16831 - in projects/haf/trunk/gtk+: . gtk gtk/tests tests
- Next message: [maemo-commits] r16833 - projects/haf/branches/hildon-fm/fremantle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: yangli Date: 2008-12-01 17:12:31 +0200 (Mon, 01 Dec 2008) New Revision: 16832 Modified: projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c Log: make the chooser dialogs recognize the virtual node 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-12-01 14:08:51 UTC (rev 16831) +++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c 2008-12-01 15:12:31 UTC (rev 16832) @@ -2116,32 +2116,23 @@ HildonFileChooserDialogPrivate *priv = HILDON_FILE_CHOOSER_DIALOG(self)->priv; GtkTreeIter iter; GtkTreeIter cur_iter; - char *path; gchar *gtk_tree_path_str = NULL; gchar *title; gchar *path_string; GList *list = NULL; - if((path = hildon_file_selection_get_current_folder_uri(priv->filetree)) != NULL){ - hildon_file_system_model_load_uri(priv->model, - (const char*) path, &iter); - free(path); - gtk_tree_model_get(GTK_TREE_MODEL(priv->model), &iter, - HILDON_FILE_SYSTEM_MODEL_COLUMN_DISPLAY_NAME, - &title, -1); - 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"); - if(!g_strcasecmp(gtk_tree_path_str, "0")) { - gtk_widget_set_sensitive(priv->up_button, TRUE); + 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); + gtk_tree_path_str = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(priv->model), + &iter); + if(strlen(gtk_tree_path_str) > 1) { + gtk_widget_set_sensitive(priv->up_button, TRUE); } - else { - gtk_widget_set_sensitive(priv->up_button, TRUE); - } - free(gtk_tree_path_str); - while(g_strcasecmp(title, "/")/*!g_strcasecmp(gtk_tree_path_str, "0")*/){ - //free(title); + while(g_ascii_strncasecmp(gtk_tree_path_str, "0", 1) == 0 && + (strlen(gtk_tree_path_str) > 1)){ + free(gtk_tree_path_str); if(strlen(title) == 0) list = g_list_append(list, " "); else @@ -2151,10 +2142,10 @@ gtk_tree_model_get(GTK_TREE_MODEL(priv->model), &iter, HILDON_FILE_SYSTEM_MODEL_COLUMN_DISPLAY_NAME, &title, -1); - /*gtk_tree_path_str = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(priv->model), - &iter);*/ + gtk_tree_path_str = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(priv->model), + &iter); } - //free(title); + free(gtk_tree_path_str); path_string = g_malloc(MAXPATHLEN); memset(path_string, 0, MAXPATHLEN); for (list = g_list_last(list); list; list = list->prev) { @@ -2192,13 +2183,22 @@ g_return_if_fail(HILDON_IS_FILE_CHOOSER_DIALOG(data)); HildonFileChooserDialogPrivate *priv = HILDON_FILE_CHOOSER_DIALOG(data)->priv; - if((path = hildon_file_selection_get_current_folder_uri(priv->filetree)) != NULL){ + path = hildon_file_selection_get_current_folder_uri(priv->filetree); + hildon_file_system_model_load_uri(priv->model, path, &cur_iter); + + if(gtk_tree_model_iter_parent(GTK_TREE_MODEL(priv->model), &iter, &cur_iter)){ + hildon_file_selection_set_current_folder_iter(priv->filetree, &iter); + path = hildon_file_selection_get_current_folder_uri(priv->filetree); hildon_file_system_model_load_uri(priv->model, path, &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); free(path); } + if (gtk_tree_model_iter_parent(GTK_TREE_MODEL(priv->model), &iter, &cur_iter)) { + gtk_widget_set_sensitive(priv->up_button, TRUE); + } + else { + gtk_widget_set_sensitive(priv->up_button, FALSE); + } } static void hildon_response_path_button_clicked(GtkWidget *widget, @@ -2589,7 +2589,7 @@ model = hildon_touch_selector_get_model(HILDON_TOUCH_SELECTOR(priv->selector), 0); /* if there is a valid extension selected, just leave it */ - if (hildon_touch_selector_get_selected ((HildonTouchSelector *) priv->selector, 0, &iter)) + if (hildon_touch_selector_get_selected (priv->selector, 0, &iter)) //if (hildon_touch_selector_get_active_iter (priv->selector, 0, &iter)) { gboolean matches; @@ -2610,7 +2610,7 @@ gtk_tree_model_get (model, &iter, 0, &ext, -1); if (strcmp (ext, priv->ext_name + 1) == 0) { - hildon_touch_selector_select_iter ((HildonTouchSelector *) priv->selector, 0, &iter, TRUE); + hildon_touch_selector_select_iter (priv->selector, 0, &iter, TRUE); //hildon_touch_selector_set_active_iter (priv->selector, 0, &iter, TRUE); hildon_button_set_value(HILDON_BUTTON(priv->extensions_combo), ext); @@ -2690,7 +2690,7 @@ g_assert(HILDON_IS_FILE_CHOOSER_DIALOG(data)); HildonFileChooserDialogPrivate *priv = HILDON_FILE_CHOOSER_DIALOG(data)->priv; - priv->type_select_dialog = hildon_dialog_new(); + priv->type_select_dialog = hildon_dialog_new(); priv->selector = hildon_touch_selector_new_text(); list = g_list_first(priv->extensions_list);
- Previous message: [maemo-commits] r16831 - in projects/haf/trunk/gtk+: . gtk gtk/tests tests
- Next message: [maemo-commits] r16833 - projects/haf/branches/hildon-fm/fremantle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]