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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Oct 15 16:56:06 EEST 2008
Author: yangli
Date: 2008-10-15 16:56:06 +0300 (Wed, 15 Oct 2008)
New Revision: 16411

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
Log:
remove the compatibility to scrolled window, only pannable area widget in use

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-10-15 13:54:08 UTC (rev 16410)
+++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c	2008-10-15 13:56:06 UTC (rev 16411)
@@ -132,7 +132,6 @@
     PROP_MAX_FULL_PATH_LENGTH,
     PROP_SELECTION_MODE,
     PROP_INVISIBLE_FILES,
-    PROP_PANNABLE
 };
 
 struct _HildonFileChooserDialogPrivate {
@@ -181,7 +180,6 @@
     gboolean should_show_folder_button;
     gboolean should_show_location;
     gboolean show_upnp;
-    gboolean pannable_flag;
 };
 
 static void hildon_response_up_button_clicked(GtkWidget *widget,
@@ -1336,16 +1334,11 @@
     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);
-    
-    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,
@@ -1752,9 +1745,6 @@
     	gtk_check_menu_item_set_active
 	  (GTK_CHECK_MENU_ITEM(priv->mode_thumbnails), TRUE);
       break;
-    case PROP_PANNABLE:
-      priv->pannable_flag = g_value_get_boolean(value);
-      break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
@@ -1821,9 +1811,6 @@
     case PROP_SELECTION_MODE:
         g_value_set_enum(value, hildon_file_selection_get_mode(priv->filetree));
         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;
@@ -2018,12 +2005,6 @@
                               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);
 }
 
@@ -2447,7 +2428,6 @@
 {
     GObject *obj;
     HildonFileChooserDialogPrivate *priv;
-    gboolean dialog_pannable = TRUE;
 
     obj =
         G_OBJECT_CLASS(hildon_file_chooser_dialog_parent_class)->
@@ -2455,8 +2435,6 @@
     /* 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,
@@ -2464,7 +2442,6 @@
        "visible-columns", (HILDON_FILE_SELECTION_SHOW_NAME
 			   | HILDON_FILE_SELECTION_SHOW_MODIFIED),
        "pane-position", get_global_pane_position (),
-       "use-pannable-area-widget", dialog_pannable,
        NULL);
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(obj)->vbox), 
 			       priv->hbox_address, FALSE, TRUE, 0);
@@ -2600,7 +2577,7 @@
 
       /* if there is a valid extension selected, just leave it */
       if (hildon_touch_selector_get_selected (selector, 0, &iter))
-      //if (hildon_touch_selector_get_active_iter (selector, 0, &iter))
+	//if (hildon_touch_selector_get_active_iter (selector, 0, &iter))
         {
 	  gboolean matches;
 	  gchar *ext;
@@ -2620,7 +2597,7 @@
 	  gtk_tree_model_get (model, &iter, 0, &ext, -1);
 	  if (strcmp (ext, priv->ext_name + 1) == 0)
 	    {
-              hildon_touch_selector_select_iter (selector, 0, &iter, TRUE);
+	      hildon_touch_selector_select_iter (selector, 0, &iter, TRUE);
 	      //hildon_touch_selector_set_active_iter (selector, 0, &iter, TRUE);
               hildon_button_set_value(HILDON_BUTTON(priv->extensions_combo), ext);
 

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-10-15 13:54:08 UTC (rev 16410)
+++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.c	2008-10-15 13:56:06 UTC (rev 16411)
@@ -130,7 +130,6 @@
     PROP_PANE_POSITION,
     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 {
@@ -193,7 +192,6 @@
 
     gchar *cursor_goal_uri;
     
-    gboolean pannable_flag;
     /* 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 show_files;
@@ -955,9 +953,6 @@
     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;
@@ -1001,8 +996,8 @@
         g_value_set_boolean(value, priv->show_upnp);
         break;
     case PROP_PANE_POSITION:
-        g_value_set_int (value, priv->pane_pos
-			 /*gtk_paned_get_position (GTK_PANED (priv->hpaned))*/);
+        g_value_set_int (value, 
+			 gtk_paned_get_position (GTK_PANED (priv->hpaned)));
 	break;
     case PROP_DRAGGING:
 	g_value_set_boolean(value, priv->currently_dragging);
@@ -1010,9 +1005,6 @@
     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;
@@ -1259,12 +1251,6 @@
                            "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
@@ -3057,79 +3043,18 @@
         G_TYPE_INSTANCE_GET_PRIVATE(self, HILDON_TYPE_FILE_SELECTION,
                                     HildonFileSelectionPrivate);
     self->priv->mode = HILDON_FILE_SELECTION_MODE_THUMBNAILS;
-
     GTK_WIDGET_SET_FLAGS(GTK_WIDGET(self), GTK_NO_WINDOW);
-}
 
-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;
-    gint pos = 0;
-    gboolean pannable_area_created = FALSE;
-
-    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();
-      if(HILDON_IS_PANNABLE_AREA(self->priv->scroll_dir) && 
+ 
+    self->priv->scroll_dir = hildon_pannable_area_new();
+    self->priv->scroll_list = hildon_pannable_area_new();
+    self->priv->scroll_thumb = hildon_pannable_area_new();
+    if(!(HILDON_IS_PANNABLE_AREA(self->priv->scroll_dir) &&
 	 HILDON_IS_PANNABLE_AREA(self->priv->scroll_dir) &&
-	 HILDON_IS_PANNABLE_AREA(self->priv->scroll_dir)){
-	pannable_area_created = TRUE;
-      }
-      else{
-	pannable_area_created = FALSE;
-      }
-    }
-    else{
+	 HILDON_IS_PANNABLE_AREA(self->priv->scroll_dir))){
       self->priv->scroll_dir = gtk_scrolled_window_new(NULL, NULL);
       self->priv->scroll_list = gtk_scrolled_window_new(NULL, NULL);
       self->priv->scroll_thumb = gtk_scrolled_window_new(NULL, NULL);
-    }
-    if(!pannable_area_created || !fs_pannable){
-      if(!pannable_area_created){
-	self->priv->scroll_dir = gtk_scrolled_window_new(NULL, NULL);
-	self->priv->scroll_list = gtk_scrolled_window_new(NULL, NULL);
-	self->priv->scroll_thumb = gtk_scrolled_window_new(NULL, NULL);
-      }
       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
 				     (self->priv->scroll_dir),
 				     GTK_POLICY_AUTOMATIC,
@@ -3214,10 +3139,41 @@
 
     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_get (HILDON_FILE_SELECTION(self), "pane-position",
-		   &pos, NULL);
-    g_object_set(self,"pane-position", pos, NULL);
+}
+
+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);


More information about the maemo-commits mailing list