[maemo-commits] [maemo-commits] r15922 - projects/haf/branches/hildon-fm/fremantle/hildon-fm
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Sep 1 09:44:54 EEST 2008
- Previous message: [maemo-commits] r15921 - in projects/haf/trunk/sapwood: . src
- Next message: [maemo-commits] r15923 - projects/connectivity/bluez-debian/trunk
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: yangli Date: 2008-09-01 09:44:53 +0300 (Mon, 01 Sep 2008) New Revision: 15922 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: modifications regarding requirement of using both scrolled window for FM and pannable area widget for other new applications 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-09-01 05:53:35 UTC (rev 15921) +++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c 2008-09-01 06:44:53 UTC (rev 15922) @@ -93,6 +93,8 @@ #endif static void sync_extensions_combo (HildonFileChooserDialogPrivate *priv); +static void hildon_file_chooser_dialog_reset_files_visibility(HildonFileChooserDialogPrivate *priv, + gint dialog_type); #define HILDON_FILE_CHOOSER_DIALOG_TYPE_SELECTION_MODE (hildon_file_chooser_dialog_selection_mode_get_type()) static GType @@ -128,6 +130,7 @@ PROP_MAX_FULL_PATH_LENGTH, PROP_SELECTION_MODE, PROP_INVISIBLE_FILES, + PROP_PANNABLE }; struct _HildonFileChooserDialogPrivate { @@ -175,7 +178,7 @@ gboolean should_show_folder_button; gboolean should_show_location; gboolean show_upnp; - gboolean invisible_files; + gboolean pannable_flag; }; static void hildon_response_up_button_clicked(GtkWidget *widget, @@ -1113,9 +1116,8 @@ gtk_widget_set_size_request(GTK_WIDGET(priv->filetree), FILE_SELECTION_WIDTH_TOTAL, FILE_SELECTION_HEIGHT); - hildon_file_selection_set_invisible_files(priv->filetree, - priv->invisible_files); - hildon_file_selection_set_filter(priv->filetree, NULL); + hildon_file_chooser_dialog_reset_files_visibility(priv, + GTK_FILE_CHOOSER_ACTION_OPEN); gtk_widget_show(GTK_WIDGET(priv->filetree)); hildon_file_selection_show_content_pane(priv->filetree); hildon_file_selection_hide_navigation_pane(priv->filetree); @@ -1193,6 +1195,8 @@ gtk_widget_show_all(priv->hbox_address); gtk_widget_hide(priv->path_label); + hildon_file_chooser_dialog_reset_files_visibility(priv, + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); gtk_widget_show(GTK_WIDGET(priv->filetree)); hildon_file_selection_show_content_pane(priv->filetree); hildon_file_selection_hide_navigation_pane(priv->filetree); @@ -1301,18 +1305,21 @@ gboolean local_only = FALSE; gboolean show_hidden = FALSE; gboolean show_upnp = TRUE; + gboolean dialog_pannable = 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 */ + + g_object_get (self, "use-pannable-widget", &dialog_pannable, NULL); + g_object_set (self->priv->filetree, "use-pannable-widget", + &dialog_pannable, NULL); + 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, @@ -1322,9 +1329,8 @@ priv = HILDON_FILE_CHOOSER_DIALOG(dialog)->priv; 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); + hildon_file_chooser_dialog_reset_files_visibility(priv, + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + 4); sync_current_folders(self, HILDON_FILE_CHOOSER_DIALOG(dialog)); return dialog; @@ -1715,8 +1721,8 @@ 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); + case PROP_PANNABLE: + priv->pannable_flag = g_value_get_boolean(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -1784,9 +1790,9 @@ 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_PANNABLE: + g_value_set_boolean(value, priv->pannable_flag); + break; default: /* Backend is not readable */ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -1953,11 +1959,6 @@ "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); - 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", @@ -1986,6 +1987,11 @@ G_PARAM_READWRITE); g_object_class_install_property(gobject_class, PROP_SELECTION_MODE, pspec); + g_object_class_install_property(gobject_class, PROP_PANNABLE, + g_param_spec_boolean("use-pannable-area-widget", "use the pannable area widget", + "use the pannable area widget instead of scrolled window as " + "a container if this property is TRUE (TRUE by default)", + TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); hildon_gtk_file_chooser_install_properties(gobject_class); } @@ -2369,6 +2375,7 @@ { GObject *obj; HildonFileChooserDialogPrivate *priv; + gboolean dialog_pannable = TRUE; obj = G_OBJECT_CLASS(hildon_file_chooser_dialog_parent_class)-> @@ -2376,6 +2383,8 @@ /* Now we know if specific backend is requested */ priv = HILDON_FILE_CHOOSER_DIALOG(obj)->priv; + g_object_get (HILDON_FILE_CHOOSER_DIALOG(obj), + "use-pannable-widget", &dialog_pannable, NULL); g_assert(priv->model); priv->filetree = g_object_new (HILDON_TYPE_FILE_SELECTION, @@ -2383,11 +2392,8 @@ "visible-columns", (HILDON_FILE_SELECTION_SHOW_NAME | HILDON_FILE_SELECTION_SHOW_MODIFIED), "pane-position", get_global_pane_position (), - NULL); - - hildon_file_selection_set_invisible_files(priv->filetree, - priv->invisible_files); - + "use-pannable-area-widget", dialog_pannable, + NULL); 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), @@ -2510,7 +2516,7 @@ static void sync_extensions_combo (HildonFileChooserDialogPrivate *priv) { - if (priv->ext_name && priv->extensions_combo) + if (priv->ext_name && priv->extensions_combo) { GtkTreeModel *model; GtkTreeIter iter; @@ -2565,6 +2571,27 @@ hildon_file_chooser_dialog_do_autonaming (priv); } +static void hildon_file_chooser_dialog_reset_files_visibility(HildonFileChooserDialogPrivate *priv, + gint dialog_type) +{ + switch (dialog_type){ + case GTK_FILE_CHOOSER_ACTION_OPEN: + g_object_set(priv->filetree, "show-files", TRUE, NULL); + hildon_file_selection_set_filter(priv->filetree, NULL); + break; + case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER: + g_object_set(priv->filetree, "show-files", TRUE, NULL); + hildon_file_selection_set_filter(priv->filetree, NULL); + break; + case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + 4: + g_object_set(priv->filetree, "show-files", FALSE, NULL); + hildon_file_selection_set_filter(priv->filetree, NULL); + break; + default: + break; + } +} + /** * hildon_file_chooser_dialog_add_extensions_combo: * @self: dialog widget 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-09-01 05:53:35 UTC (rev 15921) +++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.c 2008-09-01 06:44:53 UTC (rev 15922) @@ -128,7 +128,9 @@ PROP_ACTIVE_PANE, PROP_SHOW_UPNP, PROP_PANE_POSITION, - PROP_DRAGGING + PROP_DRAGGING, + PROP_SHOW_FILES, /* show or not show the files in the content pane */ + PROP_PANNABLE /* use the pannable area widget as a container */ }; struct _HildonFileSelectionPrivate { @@ -190,12 +192,10 @@ gchar *cursor_goal_uri; - /* 1: use pannable area widget - 0: use scrolled wnidow widget */ gboolean pannable_flag; - /* set this flag to true, files will be filtered out, used + /* set this flag to FALSE, files will be filtered out in content pane, used in for example, folder chooser dialog and some other similar dialogs */ - gboolean invisible_files; + gboolean show_files; }; #if 0 @@ -678,7 +678,7 @@ HILDON_FILE_SYSTEM_MODEL_COLUMN_IS_FOLDER, &is_folder, -1); - if ((is_folder == FALSE) && priv->invisible_files) { + if ((is_folder == FALSE) && !priv->show_files) { /* Files are NOT displayed in for example, folder chooser dialog..., maybe more etc */ return FALSE; @@ -950,6 +950,12 @@ case PROP_DRAGGING: ULOG_ERR_F("PROP_DRAGGING is a read-only property"); break; + case PROP_SHOW_FILES: + priv->show_files = g_value_get_boolean(value); + break; + case PROP_PANNABLE: + priv->pannable_flag = g_value_get_boolean(value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); break; @@ -999,6 +1005,12 @@ case PROP_DRAGGING: g_value_set_boolean(value, priv->currently_dragging); break; + case PROP_SHOW_FILES: + g_value_set_boolean(value, priv->show_files); + break; + case PROP_PANNABLE: + g_value_set_boolean(value, priv->pannable_flag); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); break; @@ -1239,6 +1251,18 @@ g_param_spec_boolean("currently-dragging", "Currently dragging", "Whether or not dragging is ongoing", FALSE, G_PARAM_READABLE)); + + g_object_class_install_property(object, PROP_SHOW_FILES, + g_param_spec_boolean("show-files", "show the files in the content pane", + "show the files in the content pane " + "if this property is TRUE (TRUE by default)", + TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + + g_object_class_install_property(object, PROP_PANNABLE, + g_param_spec_boolean("use-pannable-area-widget", "use the pannable area widget", + "use the pannable area widget instead of scrolled window as " + "a container if this property is TRUE (TRUE by default)", + TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); } static gboolean @@ -3033,9 +3057,52 @@ self->priv->mode = HILDON_FILE_SELECTION_MODE_THUMBNAILS; GTK_WIDGET_SET_FLAGS(GTK_WIDGET(self), GTK_NO_WINDOW); - //to be fixed - self->priv->pannable_flag = TRUE; - if(self->priv->pannable_flag){ +} + +static GObject *hildon_file_selection_constructor(GType type, + guint + n_construct_properties, + GObjectConstructParam * + construct_properties) +{ + GObject *obj; + HildonFileSelection *self; + HildonFileSelectionPrivate *priv; + GtkTreePath *temp_path; + gboolean fs_pannable = TRUE; + + obj = + G_OBJECT_CLASS(hildon_file_selection_parent_class)-> + constructor(type, n_construct_properties, construct_properties); + + /* Now construction parameters (=backend) are applied. Let's finalize + construction */ + self = HILDON_FILE_SELECTION(obj); + priv = self->priv; + /*priv->sort_model = <SNIP> */ + + /* we need to create view models here, even if dummy ones */ + + temp_path = gtk_tree_path_new_from_string("0"); + priv->view_filter = gtk_tree_model_filter_new(priv->main_model, temp_path); + gtk_tree_path_free (temp_path); + + gtk_tree_model_filter_set_visible_func + (GTK_TREE_MODEL_FILTER (priv->view_filter), filter_func, priv, NULL); + + priv->sort_model = hildon_file_selection_create_sort_model + (self, content_pane_sort_function, priv->view_filter); + hildon_file_selection_enable_cursor_magic (self, priv->sort_model); + + /* the following code were moved here from hildon_file_selection_init, + because, file_selection widget needs to know which one to use between + pannable area widget and scrolled window widget. the property + "use-pannable-are-widget" indicates to use the pannable area widget + */ + g_object_get (HILDON_FILE_SELECTION(self), "use-pannable-area-widget", + &fs_pannable, NULL); + + if(fs_pannable){ self->priv->scroll_dir = hildon_pannable_area_new(); self->priv->scroll_list = hildon_pannable_area_new(); self->priv->scroll_thumb = hildon_pannable_area_new(); @@ -3129,57 +3196,16 @@ g_signal_connect(self, "grab-notify", G_CALLBACK(hildon_file_selection_check_scroll), NULL); -} + /* above code were moved from hildon_file_selection_init */ + g_object_set(self,"pane-position", 250, NULL); // to be fixed -static GObject *hildon_file_selection_constructor(GType type, - guint - n_construct_properties, - GObjectConstructParam * - construct_properties) -{ - GObject *obj; - HildonFileSelection *self; - HildonFileSelectionPrivate *priv; - GtkTreePath *temp_path; - - obj = - G_OBJECT_CLASS(hildon_file_selection_parent_class)-> - constructor(type, n_construct_properties, construct_properties); - - /* Now construction parameters (=backend) are applied. Let's finalize - construction */ - self = HILDON_FILE_SELECTION(obj); - priv = self->priv; - - /*priv->sort_model = <SNIP> */ - - /* we need to create view models here, even if dummy ones */ - - temp_path = gtk_tree_path_new_from_string("0"); - priv->view_filter = gtk_tree_model_filter_new(priv->main_model, temp_path); - gtk_tree_path_free (temp_path); - - gtk_tree_model_filter_set_visible_func - (GTK_TREE_MODEL_FILTER (priv->view_filter), filter_func, priv, NULL); - - priv->sort_model = hildon_file_selection_create_sort_model - (self, content_pane_sort_function, priv->view_filter); - hildon_file_selection_enable_cursor_magic (self, priv->sort_model); - hildon_file_selection_create_dir_view(self); hildon_file_selection_create_list_view(self); hildon_file_selection_create_thumbnail_view(self); - if(self->priv->pannable_flag){ - gtk_container_add(GTK_CONTAINER(priv->scroll_dir), priv->dir_tree); - gtk_container_add(GTK_CONTAINER(priv->scroll_list), priv->view[0]); - gtk_container_add(GTK_CONTAINER(priv->scroll_thumb), priv->view[1]); - } - else{ - gtk_container_add(GTK_CONTAINER(priv->scroll_dir), priv->dir_tree); - gtk_container_add(GTK_CONTAINER(priv->scroll_list), priv->view[0]); - gtk_container_add(GTK_CONTAINER(priv->scroll_thumb), priv->view[1]); - } + gtk_container_add(GTK_CONTAINER(priv->scroll_dir), priv->dir_tree); + gtk_container_add(GTK_CONTAINER(priv->scroll_list), priv->view[0]); + gtk_container_add(GTK_CONTAINER(priv->scroll_thumb), priv->view[1]); gtk_box_pack_start (GTK_BOX (self->priv->view_selector), self->priv->scroll_list, TRUE, TRUE, 0); @@ -3260,7 +3286,6 @@ gtk_widget_hide (priv->view[3]); hildon_file_selection_inspect_view (priv); - return obj; } @@ -4738,11 +4763,4 @@ return ret; } -void hildon_file_selection_set_invisible_files(HildonFileSelection *self, - gboolean invisible) -{ - HildonFileSelectionPrivate *priv = self->priv; - priv->invisible_files = invisible; -} - 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-09-01 05:53:35 UTC (rev 15921) +++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.h 2008-09-01 06:44:53 UTC (rev 15922) @@ -170,8 +170,6 @@ void hildon_file_selection_set_current_folder_iter(HildonFileSelection * self, GtkTreeIter * main_iter); -void hildon_file_selection_set_invisible_files(HildonFileSelection *self, - gboolean invisible); #ifndef HILDON_DISABLE_DEPRECATED gboolean hildon_file_selection_get_active_content_iter(HildonFileSelection
- Previous message: [maemo-commits] r15921 - in projects/haf/trunk/sapwood: . src
- Next message: [maemo-commits] r15923 - projects/connectivity/bluez-debian/trunk
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]