[maemo-commits] [maemo-commits] r15883 - projects/haf/branches/hildon-fm/fremantle/hildon-fm

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Aug 20 17:11:02 EEST 2008
Author: yangli
Date: 2008-08-20 17:11:00 +0300 (Wed, 20 Aug 2008)
New Revision: 15883

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
Log:
improved files filtering in file chooser dialog, button new added besides the fileselection, feature has not yet finished

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-19 08:45:09 UTC (rev 15882)
+++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c	2008-08-20 14:11:00 UTC (rev 15883)
@@ -127,7 +127,9 @@
     PROP_MULTIPLE_TEXT,
     PROP_MAX_NAME_LENGTH,
     PROP_MAX_FULL_PATH_LENGTH,
-    PROP_SELECTION_MODE
+    PROP_SELECTION_MODE,
+    PROP_INVISIBLE_FILES,
+    PROP_SHOW_NEW_BUTTON
 };
 
 struct _HildonFileChooserDialogPrivate {
@@ -148,14 +150,6 @@
     /* horizontal address box containing the up level button 
        and the path button */
     GtkWidget *hbox_address;
-    /* vertical box containing the address and the tree view */ 
-    GtkWidget *hbox_browser;
-    /* vertical box containing the new button and two dummy labels */ 
-    GtkWidget *vbox_new;
-    /* horizontal box containing the vbox_browser and the new button */ 
-    GtkWidget *hbox_whole;
-    /* fixed container for complexy dialog UI, folder change, move */
-    GtkWidget *fixed;
     GtkWidget *extensions_combo;
     GtkFileChooserAction action;
     GtkWidget *popup;
@@ -182,6 +176,8 @@
     gboolean should_show_folder_button;
     gboolean should_show_location;
     gboolean show_upnp;
+    gboolean invisible_files;
+    gboolean should_show_new_button;
 };
 
 static void hildon_response_up_button_clicked(GtkWidget *widget,
@@ -1136,17 +1132,14 @@
     case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER:
         gtk_widget_hide(priv->caption_control_name);
         gtk_widget_hide(priv->hbox_items);
+	priv->should_show_new_button = TRUE;
+	hildon_file_selection_set_show_button(priv->filetree, 
+					      priv->should_show_new_button);
 
 	gtk_widget_set_size_request(GTK_WIDGET(self),
                                     FOLDER_CHANGE_DIALOG_WIDTH,
                                     FOLDER_CHANGE_DIALOG_HEIGHT);
 
-	gtk_widget_set_size_request(GTK_WIDGET(priv->hbox_browser),
-                                    FILE_SELECTION_WIDTH_LIST,
-                                    FILE_SELECTION_HEIGHT + 
-				    FILE_SELECTION_ADDRESS_HEIGHT +
-				    HILDON_MARGIN_DEFAULT);
-
 	gtk_widget_set_size_request(GTK_WIDGET(priv->filetree),
                                     FILE_SELECTION_WIDTH_LIST,
 				    FILE_SELECTION_HEIGHT);
@@ -1163,17 +1156,9 @@
 	
 	gtk_widget_show(priv->hbox_address);
 	gtk_widget_show(GTK_WIDGET(priv->filetree));
-        gtk_widget_show_all(GTK_WIDGET(priv->hbox_browser));
 	hildon_file_selection_show_content_pane(priv->filetree);
 	hildon_file_selection_hide_navigation_pane(priv->filetree);
 
-	/*gchar *uri;
-	uri = g_malloc(100); //to be changed
-	get_current_tree_path(priv->filetree, uri);
-	gtk_button_set_label(GTK_BUTTON(priv->folder_button),
-			       uri);
-			       delete(uri);*/
-
         //hildon_file_selection_hide_content_pane(priv->filetree);
         gtk_window_set_title(GTK_WINDOW(self), _("ckdg_ti_change_folder"));
         gtk_button_set_label(GTK_BUTTON(priv->action_button),
@@ -1272,26 +1257,35 @@
                                                   action)
 {
     GtkWidget *dialog;
+    HildonFileChooserDialogPrivate *priv;
+    g_assert(HILDON_IS_FILE_CHOOSER_DIALOG(dialog));
+    priv = HILDON_FILE_CHOOSER_DIALOG(dialog)->priv;
+
     gboolean local_only = FALSE;
     gboolean show_hidden = FALSE;
     gboolean show_upnp = TRUE;
-    
+
     g_object_get (self->priv->filetree, "local-only", &local_only, NULL);
     g_object_get (self->priv->filetree, "show-hidden", &show_hidden, NULL);
     g_object_get (self->priv->filetree, "show-upnp", &show_upnp, NULL);
 
+    /* new button need to be visible */
     dialog = hildon_file_chooser_dialog_new_with_properties
       (GTK_WINDOW(self),
        "action", action,
        "file-system-model",
        self->priv->model, 
+       "invisible-files", TRUE,
        "local-only", local_only,
        "show-hidden", show_hidden,
        "show-upnp", show_upnp,
        NULL);
     gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
+    g_assert(HILDON_IS_FILE_SELECTION(priv->filetree));
+    hildon_file_selection_set_invisible_files(priv->filetree, 
+					      priv->invisible_files);
+    hildon_file_selection_set_filter(priv->filetree, NULL);
     sync_current_folders(self, HILDON_FILE_CHOOSER_DIALOG(dialog));
-
     return dialog;
 }
 
@@ -1362,7 +1356,6 @@
 
     dialog = hildon_file_chooser_dialog_create_sub_dialog(self,
                GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
-
     while ((response = gtk_dialog_run(GTK_DIALOG(dialog))) == GTK_RESPONSE_OK)
       {
 	uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
@@ -1681,6 +1674,12 @@
     	gtk_check_menu_item_set_active
 	  (GTK_CHECK_MENU_ITEM(priv->mode_thumbnails), TRUE);
       break;
+    case PROP_INVISIBLE_FILES:
+      priv->invisible_files = g_value_get_boolean(value);
+      break;
+    case PROP_SHOW_NEW_BUTTON:
+      priv->should_show_new_button = g_value_get_boolean(value);
+      break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
@@ -1747,6 +1746,12 @@
     case PROP_SELECTION_MODE:
         g_value_set_enum(value, hildon_file_selection_get_mode(priv->filetree));
         break;
+    case PROP_INVISIBLE_FILES:
+      g_value_set_boolean(value, priv->invisible_files);
+      break;
+    case PROP_SHOW_NEW_BUTTON:
+      g_value_set_boolean(value, priv->should_show_new_button);
+      break;
     default:   /* Backend is not readable */
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
@@ -1869,6 +1874,7 @@
     GTK_WIDGET_CLASS(klass)->show_all = gtk_widget_show;
     GTK_OBJECT_CLASS(klass)->destroy = hildon_file_chooser_dialog_destroy;
 
+
     pspec = g_param_spec_string("empty-text", "Empty text",
                                 "String to use when selected "
                                 "folder is empty",
@@ -1913,6 +1919,16 @@
                                 "String to use in leftmost (=open) button",
                                 NULL, G_PARAM_READWRITE));
 
+    pspec = g_param_spec_boolean("invisible-files", "invisible files",
+				 "files should be invisible  (if it's true)",
+				 FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
+    g_object_class_install_property(gobject_class, PROP_INVISIBLE_FILES, pspec);
+
+    pspec = g_param_spec_boolean("should-show-new-button", "should show new button",
+				 "new button should be shown  (if it's true)",
+				 FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
+    g_object_class_install_property(gobject_class, PROP_SHOW_NEW_BUTTON, pspec);
+
     g_object_class_install_property(gobject_class, PROP_MULTIPLE_TEXT,
             g_param_spec_string("save-multiple", "Save multiple files",
                                 "Text to be displayed in items field when saving multiple files",
@@ -1941,7 +1957,6 @@
                               G_PARAM_READWRITE);
     g_object_class_install_property(gobject_class, PROP_SELECTION_MODE, pspec);
 
-
     hildon_gtk_file_chooser_install_properties(gobject_class);
 }
 
@@ -2168,17 +2183,11 @@
 		      G_CALLBACK (hildon_response_path_button_clicked), self);
     gtk_widget_show(priv->path_button);
 
-    priv->folder_button = g_object_new(GTK_TYPE_BUTTON, "label",  _("ckdg_bd_change_folder_new_folder"));
-    g_signal_connect (G_OBJECT (priv->folder_button), "clicked",
-		      G_CALLBACK (hildon_response_folder_button_clicked), self);
-    gtk_widget_show(priv->folder_button);
-
-
     /*priv->action_button =
         gtk_dialog_add_button(GTK_DIALOG(self),
                               _("ckdg_bd_select_object_ok_open"),
-                              GTK_RESPONSE_OK);*/
-    /*priv->folder_button =
+                              GTK_RESPONSE_OK);
+    priv->folder_button =
         gtk_dialog_add_button(GTK_DIALOG(self),
                               _("ckdg_bd_change_folder_new_folder"),
                               HILDON_RESPONSE_FOLDER_BUTTON);*/
@@ -2226,23 +2235,6 @@
                        FALSE, TRUE, 0);
     gtk_box_pack_start(GTK_BOX(priv->hbox_address), priv->path_button,
     FALSE, TRUE, 0);
-    /* organize the new button and centralized it */
-    priv->vbox_new = gtk_vbox_new(FALSE, HILDON_MARGIN_DEFAULT);
-    label_up = gtk_label_new("");
-    label_down = gtk_label_new("");
-    gtk_box_pack_start(GTK_BOX(priv->vbox_new), label_up,
-                       TRUE, TRUE, 0);
-    gtk_box_pack_start(GTK_BOX(priv->vbox_new), priv->folder_button,
-                       FALSE, FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(priv->vbox_new), label_down,
-		       TRUE, TRUE, 0);
-    /* organize the folder browser */
-    priv->hbox_browser = gtk_hbox_new(FALSE, HILDON_MARGIN_DEFAULT);
-    gtk_box_pack_start(GTK_BOX(priv->hbox_browser), GTK_WIDGET(priv->filetree),
-                       TRUE, FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(priv->hbox_browser), priv->vbox_new,
-      FALSE, FALSE, 0);
-    gtk_widget_show(priv->filetree);
 
     priv->caption_control_location =
       hildon_caption_new(size_group, _("sfil_fi_save_objects_items"),
@@ -2357,12 +2349,11 @@
        "pane-position", get_global_pane_position (),
       NULL);
 
-    hildon_file_selection_set_invisible_files(priv->filetree, TRUE);
+    hildon_file_selection_set_invisible_files(priv->filetree, 
+      priv->invisible_files);
 
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(obj)->vbox), 
 			       priv->hbox_address, FALSE, TRUE, 0);
-    /*gtk_box_pack_start(GTK_BOX(GTK_DIALOG(obj)->vbox), 
-      priv->hbox_browser, TRUE, FALSE, 0);*/
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(obj)->vbox),
       GTK_WIDGET(priv->filetree), TRUE, TRUE, 0);
 

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-19 08:45:09 UTC (rev 15882)
+++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.c	2008-08-20 14:11:00 UTC (rev 15883)
@@ -127,7 +127,7 @@
     PROP_ACTIVE_PANE,
     PROP_SHOW_UPNP,
     PROP_PANE_POSITION,
-    PROP_DRAGGING
+    PROP_DRAGGING,
 };
 
 struct _HildonFileSelectionPrivate {
@@ -140,7 +140,10 @@
        notify to change the text in the path button */
     int cur_view;
     GtkWidget *hpaned;
-
+    /* vertical box to contain a dummy label and the button new */
+    GtkWidget *vbox_button;
+    /* button new used in the libhildonfm only */
+    GtkWidget *new_button; 
     GtkTreeModel *main_model;
     GtkTreeModel *sort_model;   /* HildonFileSystemModel doesn't implement */
     GtkTreeModel *dir_sort;     /* GtkTreeSortable */
@@ -185,9 +188,6 @@
     gboolean show_hidden;
     gboolean show_upnp;
     gboolean currently_dragging;
-    /* ignoring listing the folders in the
-       content pane, file_chooser dialog needs this */
-    gboolean folders_ignoring;
     GtkFilePath *safe_folder;
 
     gchar **drag_data_uris;
@@ -200,6 +200,9 @@
     /* set this flag to true, files will be filtered out, used
        in for example, folder chooser dialog and some other similar dialogs */
     gboolean invisible_files;
+    /* TRUE: show the button new 
+       FALSE: hide the button new */
+    gboolean should_show_new_button;
 };
 
 #if 0
@@ -3062,7 +3065,7 @@
 			self->priv->view[2], TRUE, TRUE, 0);
 
     {
-      GtkWidget *vbox, *label, *button_label, *button, *button_box;
+      GtkWidget *vbox, *label, *button_label, *button, *button_box, vbox_button;
 
       label = gtk_label_new (_("hfil_li_memory_card_corrupted"));
 #if 0
@@ -3095,6 +3098,18 @@
       self->priv->view[3] = vbox;
       gtk_box_pack_start (GTK_BOX (self->priv->view_selector),
       self->priv->view[3], TRUE, TRUE, 0);
+
+      self->priv->vbox_button = gtk_vbox_new (FALSE, 0);
+      self->priv->new_button = gtk_button_new_with_label("new");
+      button_label = gtk_label_new ("    ");
+      gtk_box_pack_start(GTK_BOX(self->priv->vbox_button), button_label, 
+			 TRUE, FALSE, 10);
+      gtk_box_pack_end(GTK_BOX(self->priv->vbox_button), self->priv->new_button, 
+		       FALSE, FALSE, 0);
+      gtk_box_pack_end(GTK_BOX (self->priv->view_selector),
+      self->priv->vbox_button, FALSE, TRUE, 0);
+      gtk_widget_show(self->priv->new_button);
+
     }
     self->priv->hpaned = gtk_hpaned_new();
 
@@ -3143,8 +3158,6 @@
     priv->view_filter = gtk_tree_model_filter_new(priv->main_model, temp_path);
     gtk_tree_path_free (temp_path);
 
-    hildon_file_selection_set_invisible_files(self, FALSE);
-
     gtk_tree_model_filter_set_visible_func
       (GTK_TREE_MODEL_FILTER (priv->view_filter), filter_func, priv, NULL);
 
@@ -3246,9 +3259,9 @@
     gtk_widget_hide (priv->scroll_thumb);
     gtk_widget_hide (priv->view[2]);
     gtk_widget_hide (priv->view[3]);
+    hildon_file_selection_set_show_button(self, FALSE);
 
     hildon_file_selection_inspect_view (priv);
-    priv->folders_ignoring = FALSE;
     return obj;
 }
 
@@ -4726,18 +4739,27 @@
   return ret;
 }
 
-/*void hildon_file_selection_associate_file_chooser_dialog(HildonFileSelection *self,
-							 HildonFileChooserDialog *chooser_dialog)
+void hildon_file_selection_set_invisible_files(HildonFileSelection *self,
+					       gboolean invisible)
 {
-   HildonFileSelectionPrivate *priv = self->priv;
-   priv->chooser_dialog = chooser_dialog;
-   }*/
+  HildonFileSelectionPrivate *priv = self->priv;
+  priv->invisible_files = invisible;
+}
 
-void hildon_file_selection_set_invisible_files(HildonFileSelection *self,
-					       gboolean visible)
+void hildon_file_selection_set_show_button(HildonFileSelection *self,
+					   gboolean show)
 {
   HildonFileSelectionPrivate *priv = self->priv;
-  priv->invisible_files = visible;
+  if(show) {
+    priv->should_show_new_button = TRUE;
+    gtk_widget_show(priv->vbox_button);
+  }
+  else {
+    priv->should_show_new_button = FALSE;
+    gtk_widget_hide(priv->vbox_button);
+  }
+
 }
 
 
+

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-19 08:45:09 UTC (rev 15882)
+++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.h	2008-08-20 14:11:00 UTC (rev 15883)
@@ -172,7 +172,9 @@
 hildon_file_selection_set_current_folder_iter(HildonFileSelection * self,
                                               GtkTreeIter * main_iter);
 void hildon_file_selection_set_invisible_files(HildonFileSelection *self,
-					       gboolean visible);
+					       gboolean invisible);
+void hildon_file_selection_set_show_button(HildonFileSelection *self,
+					   gboolean show);
 
 
 #ifndef HILDON_DISABLE_DEPRECATED


More information about the maemo-commits mailing list