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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Dec 2 17:13:37 EET 2008
Author: yangli
Date: 2008-12-02 17:13:37 +0200 (Tue, 02 Dec 2008)
New Revision: 16838

Modified:
   projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-storage-dialog.c
Log:
ported storage details dialog

Modified: projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-storage-dialog.c
===================================================================
--- projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-storage-dialog.c	2008-12-02 15:13:04 UTC (rev 16837)
+++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-storage-dialog.c	2008-12-02 15:13:37 UTC (rev 16838)
@@ -46,6 +46,8 @@
 #define MEGABYTE_FACTOR (1024.0 * 1024.0)
 #define GIGABYTE_FACTOR (1024.0 * 1024.0 * 1024.0)
 
+#define HILDON_FREMANTLE_FM_UI
+
 typedef enum {
 	URI_TYPE_FILE_SYSTEM,
 	URI_TYPE_INTERNAL_MMC,
@@ -84,6 +86,9 @@
         GtkWidget        *viewport_data;
 
         /* Common widgets */
+        /* table moved from local variable to here, the reason is that the file_system_storage_dialog_set_data 
+	   needs to append components to the same table since GtkNotebook is removed  */
+        GtkWidget        *table;
         GtkWidget        *label_name;
         GtkWidget        *image_type;
         GtkWidget        *label_type;
@@ -151,10 +156,13 @@
 {
         HildonFileSystemStorageDialogPriv *priv;
         GtkWidget   *notebook;
-        GtkWidget   *page;
+        #ifndef HILDON_FREMANTLE_FM_UI
+           GtkWidget   *page;
+	#endif
         GtkWidget   *scrolledwindow;
-        GtkWidget   *viewport_common, *viewport_data;
-        GtkWidget   *table;
+        #ifndef HILDON_FREMANTLE_FM_UI
+	   GtkWidget   *viewport_common, *viewport_data;
+	#endif
         GtkWidget   *label_name_stub;
         GtkWidget   *label_name;
         GtkWidget   *label_total_size_stub;
@@ -169,8 +177,10 @@
         GtkWidget   *label_read_only_stub;
         GtkWidget   *checkbutton_readonly;
         GtkWidget   *label_type_stub;
-        GtkWidget   *label_common;
-        GtkWidget   *label_data;
+        #ifndef HILDON_FREMANTLE_FM_UI
+           GtkWidget   *label_common;
+           GtkWidget   *label_data;
+	#endif
 	GdkGeometry  geometry;
 
         priv = GET_PRIV (widget);
@@ -185,10 +195,12 @@
 
 	/* Create a note book with 2 pages */
 	notebook = gtk_notebook_new ();
-	gtk_widget_show (notebook);
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (widget)->vbox), notebook, 
-			    TRUE, TRUE, 
-			    HILDON_MARGIN_DEFAULT);
+        #ifndef HILDON_FREMANTLE_FM_UI
+	   gtk_widget_show (notebook);
+	   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (widget)->vbox), notebook, 
+			       TRUE, TRUE, 
+			       HILDON_MARGIN_DEFAULT);
+	#endif
 
 	/* Setup a good size, copied from the old storage details dialog. */
 	geometry.min_width = 133;
@@ -205,24 +217,39 @@
 				       GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
         
         /* Create first page for "Common" properties */
-        scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+        #ifndef HILDON_FREMANTLE_FM_UI
+            scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+	    gtk_container_add (GTK_CONTAINER (notebook), scrolledwindow);
+	    gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), HILDON_MARGIN_DEFAULT);
+	    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
+					    GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+	    viewport_common = gtk_viewport_new (NULL, NULL);
+	    gtk_widget_show (viewport_common);
+	    gtk_container_add (GTK_CONTAINER (scrolledwindow), viewport_common);
+	#else 
+	    scrolledwindow = hildon_pannable_area_new();
+	#endif
+
         gtk_widget_show (scrolledwindow);
-        gtk_container_add (GTK_CONTAINER (notebook), scrolledwindow);
-        gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), HILDON_MARGIN_DEFAULT);
-        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
-                                        GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);        
-        viewport_common = gtk_viewport_new (NULL, NULL);
-        gtk_widget_show (viewport_common);
-        gtk_container_add (GTK_CONTAINER (scrolledwindow), viewport_common);
 
-        table = gtk_table_new (6, 2, FALSE);
-        gtk_widget_show (table);
-        gtk_container_add (GTK_CONTAINER (viewport_common), table);
-        gtk_table_set_col_spacings (GTK_TABLE (table), HILDON_MARGIN_DOUBLE);
+        priv->table = gtk_table_new (1, 2, FALSE);
+        gtk_widget_show (priv->table);
+	#ifndef HILDON_FREMANTLE_FM_UI
+           gtk_container_add (GTK_CONTAINER (viewport_common), table);
+	#else
+	   hildon_pannable_area_add_with_viewport (HILDON_PANNABLE_AREA (scrolledwindow), 
+						   GTK_WIDGET (GTK_TABLE(priv->table)));
+	   gtk_container_add (GTK_CONTAINER (scrolledwindow), priv->table);
+	   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (widget)->vbox), scrolledwindow, 
+			       TRUE, TRUE, 
+			       HILDON_MARGIN_DEFAULT);
+	#endif
+        gtk_table_set_col_spacings (GTK_TABLE (priv->table), HILDON_MARGIN_DOUBLE);
 
+        /* Name : Nokia X */
         label_name_stub = gtk_label_new (_("sfil_fi_storage_details_name"));
         gtk_widget_show (label_name_stub);
-        gtk_table_attach (GTK_TABLE (table), label_name_stub, 0, 1, 0, 1,
+        gtk_table_attach (GTK_TABLE (priv->table), label_name_stub, 0, 1, 0, 1,
                           (GtkAttachOptions) (GTK_FILL),
                           (GtkAttachOptions) (0), 0, 0);
         gtk_label_set_justify (GTK_LABEL (label_name_stub), GTK_JUSTIFY_RIGHT);
@@ -230,33 +257,26 @@
 
         label_name = gtk_label_new ("");
         gtk_widget_show (label_name);
-        gtk_table_attach (GTK_TABLE (table), label_name, 1, 2, 0, 1,
+        gtk_table_attach (GTK_TABLE (priv->table), label_name, 1, 2, 0, 1,
                           (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
                           (GtkAttachOptions) (0), 0, 0);
         gtk_misc_set_alignment (GTK_MISC (label_name), 0.0, 0.5);
 
-        label_total_size_stub = gtk_label_new (_("sfil_fi_storage_details_size"));
-        gtk_widget_show (label_total_size_stub);
-        gtk_table_attach (GTK_TABLE (table), label_total_size_stub, 0, 1, 2, 3,
+        /* Type : Device X */
+        label_type_stub = gtk_label_new (_("sfil_fi_storage_details_type"));
+        gtk_widget_show (label_type_stub);
+        gtk_table_attach (GTK_TABLE (priv->table), label_type_stub, 0, 1, 1, 2,
                           (GtkAttachOptions) (GTK_FILL),
                           (GtkAttachOptions) (0), 0, 0);
-        gtk_label_set_justify (GTK_LABEL (label_total_size_stub), GTK_JUSTIFY_RIGHT);
-        gtk_misc_set_alignment (GTK_MISC (label_total_size_stub), 1.0, 0.5);
+        gtk_label_set_justify (GTK_LABEL (label_type_stub), GTK_JUSTIFY_RIGHT);
+        gtk_misc_set_alignment (GTK_MISC (label_type_stub), 1.0, 0.5);
 
         hbox = gtk_hbox_new (FALSE, HILDON_MARGIN_DEFAULT);
         gtk_widget_show (hbox);
-        gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 1, 2,
+        gtk_table_attach (GTK_TABLE (priv->table), hbox, 1, 2, 1, 2,
                           (GtkAttachOptions) (GTK_FILL),
                           (GtkAttachOptions) (GTK_FILL), 0, 0);
 
-        label_type_stub = gtk_label_new (_("sfil_fi_storage_details_type"));
-        gtk_widget_show (label_type_stub);
-        gtk_table_attach (GTK_TABLE (table), label_type_stub, 0, 1, 1, 2,
-                          (GtkAttachOptions) (GTK_FILL),
-                          (GtkAttachOptions) (0), 0, 0);
-        gtk_label_set_justify (GTK_LABEL (label_type_stub), GTK_JUSTIFY_RIGHT);
-        gtk_misc_set_alignment (GTK_MISC (label_type_stub), 1.0, 0.5);
-
 	image_type = gtk_image_new_from_icon_name ("qgn_list_filesys_removable_storage",
                                                    HILDON_ICON_SIZE_SMALL);
         gtk_widget_show (image_type);
@@ -267,16 +287,26 @@
         gtk_box_pack_start (GTK_BOX (hbox), label_type, TRUE, TRUE, 0);
         gtk_misc_set_alignment (GTK_MISC (label_type), 0.0, 0.5);
 
+        /* Total size : X MB       */
+        label_total_size_stub = gtk_label_new (_("sfil_fi_storage_details_size"));
+        gtk_widget_show (label_total_size_stub);
+        gtk_table_attach (GTK_TABLE (priv->table), label_total_size_stub, 0, 1, 2, 3,
+                          (GtkAttachOptions) (GTK_FILL),
+                          (GtkAttachOptions) (0), 0, 0);
+        gtk_label_set_justify (GTK_LABEL (label_total_size_stub), GTK_JUSTIFY_RIGHT);
+        gtk_misc_set_alignment (GTK_MISC (label_total_size_stub), 1.0, 0.5);
+
         label_total_size = gtk_label_new ("");
         gtk_widget_show (label_total_size);
-        gtk_table_attach (GTK_TABLE (table), label_total_size, 1, 2, 2, 3,
+        gtk_table_attach (GTK_TABLE (priv->table), label_total_size, 1, 2, 2, 3,
                           (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
                           (GtkAttachOptions) (0), 0, 0);
         gtk_misc_set_alignment (GTK_MISC (label_total_size), 0.0, 0.5);
 
+        /* In use: X MB*/
         label_in_use_stub = gtk_label_new (_("sfil_fi_storage_details_in_use"));
         gtk_widget_show (label_in_use_stub);
-        gtk_table_attach (GTK_TABLE (table), label_in_use_stub, 0, 1, 3, 4,
+        gtk_table_attach (GTK_TABLE (priv->table), label_in_use_stub, 0, 1, 3, 4,
                           (GtkAttachOptions) (GTK_FILL),
                           (GtkAttachOptions) (0), 0, 0);
         gtk_label_set_justify (GTK_LABEL (label_in_use_stub), GTK_JUSTIFY_RIGHT);
@@ -284,14 +314,15 @@
 
         label_in_use = gtk_label_new ("");
         gtk_widget_show (label_in_use);
-        gtk_table_attach (GTK_TABLE (table), label_in_use, 1, 2, 3, 4,
+        gtk_table_attach (GTK_TABLE (priv->table), label_in_use, 1, 2, 3, 4,
                           (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
                           (GtkAttachOptions) (0), 0, 0);
         gtk_misc_set_alignment (GTK_MISC (label_in_use), 0.0, 0.5);
-
+        
+        /* Available: XMB */
         label_available_stub = gtk_label_new (_("sfil_fi_storage_details_available"));
         gtk_widget_show (label_available_stub);
-        gtk_table_attach (GTK_TABLE (table), label_available_stub, 0, 1, 4, 5,
+        gtk_table_attach (GTK_TABLE (priv->table), label_available_stub, 0, 1, 4, 5,
                           (GtkAttachOptions) (GTK_FILL),
                           (GtkAttachOptions) (0), 0, 0);
         gtk_label_set_justify (GTK_LABEL (label_available_stub), GTK_JUSTIFY_RIGHT);
@@ -299,14 +330,15 @@
 
         label_available = gtk_label_new ("");
         gtk_widget_show (label_available);
-        gtk_table_attach (GTK_TABLE (table), label_available, 1, 2, 4, 5,
+        gtk_table_attach (GTK_TABLE (priv->table), label_available, 1, 2, 4, 5,
                           (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
                           (GtkAttachOptions) (0), 0, 0);
         gtk_misc_set_alignment (GTK_MISC (label_available), 0.0, 0.5);
 
-        label_read_only_stub = gtk_label_new (_("sfil_fi_storage_details_readonly"));
+        /* Read-only: to be defined, check the spec if it is available */
+	label_read_only_stub = gtk_label_new (_("sfil_fi_storage_details_readonly"));
         gtk_widget_show (label_read_only_stub);
-        gtk_table_attach (GTK_TABLE (table), label_read_only_stub, 0, 1, 5, 6,
+        gtk_table_attach (GTK_TABLE (priv->table), label_read_only_stub, 0, 1, 5, 6,
                           (GtkAttachOptions) (GTK_FILL),
                           (GtkAttachOptions) (0), 0, 0);
         gtk_label_set_justify (GTK_LABEL (label_read_only_stub), GTK_JUSTIFY_RIGHT);
@@ -315,40 +347,40 @@
         checkbutton_readonly = gtk_check_button_new ();
         gtk_widget_show (checkbutton_readonly);
         gtk_widget_set_sensitive (checkbutton_readonly, FALSE);
-        gtk_table_attach (GTK_TABLE (table), checkbutton_readonly, 1, 2, 5, 6,
+        gtk_table_attach (GTK_TABLE (priv->table), checkbutton_readonly, 1, 2, 5, 6,
                           (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
                           (GtkAttachOptions) (0), 0, 0);
 
-        page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0);
-        label_common = gtk_label_new (_("sfil_ti_storage_details_common"));
-        gtk_widget_show (label_common);
-        gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), page, label_common);
+        #ifndef HILDON_FREMANTLE_FM_UI
+            page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0);
+	    label_common = gtk_label_new (_("sfil_ti_storage_details_common"));
+	    gtk_widget_show (label_common);
+            gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), page, label_common);
+	    /* Create second page for "Data" properties */
+	    scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+	    gtk_widget_show (scrolledwindow);
+	    gtk_container_add (GTK_CONTAINER (notebook), scrolledwindow);
+	    gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), HILDON_MARGIN_DEFAULT);
+	    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), 
+					    GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+	    viewport_data = gtk_viewport_new (NULL, NULL);
+	    gtk_widget_show (viewport_data);
+	    gtk_container_add (GTK_CONTAINER (scrolledwindow), viewport_data);
 
-        /* Create second page for "Data" properties */
-        scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
-        gtk_widget_show (scrolledwindow);
-        gtk_container_add (GTK_CONTAINER (notebook), scrolledwindow);
-        gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), HILDON_MARGIN_DEFAULT);
-        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), 
-                                        GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+	    /* There is no table or widget set here, we use the _set_no_data()
+	     * or the _set_data() functions here to do that.
+	     */
 
-        viewport_data = gtk_viewport_new (NULL, NULL);
-        gtk_widget_show (viewport_data);
-        gtk_container_add (GTK_CONTAINER (scrolledwindow), viewport_data);
+	    page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1);
+	    label_data = gtk_label_new (_("sfil_ti_storage_details_data"));
+	    gtk_widget_show (label_data);
+	    gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), page, label_data);
 
-        /* There is no table or widget set here, we use the _set_no_data()
-         * or the _set_data() functions here to do that.
-         */
+	    /* Set private widgets */
+	    priv->viewport_common = viewport_common;
+	    priv->viewport_data = viewport_data;
+	#endif
 
-        page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1);
-        label_data = gtk_label_new (_("sfil_ti_storage_details_data"));
-        gtk_widget_show (label_data);
-        gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), page, label_data);
-
-        /* Set private widgets */
-        priv->viewport_common = viewport_common;
-        priv->viewport_data = viewport_data;
-
         priv->label_name = label_name;
         priv->image_type = image_type;
         priv->label_type = label_type;
@@ -799,7 +831,6 @@
 		}
 		
 		g_strfreev (rows);
-
 		file_system_storage_dialog_set_data (widget);
 
 		return FALSE;
@@ -1061,7 +1092,9 @@
 {
         HildonFileSystemStorageDialogPriv *priv;
         GnomeVFSFileSize                   size;
-        GtkWidget                         *table;
+       	#ifndef HILDON_FREMANTLE_FM_UI
+	   GtkWidget                      *table;
+	#endif
         GtkWidget                         *label_size;
         GtkWidget                         *label_category;
         const gchar                       *category_str;
@@ -1071,20 +1104,21 @@
         gboolean                           have_data;
 
         g_return_if_fail (HILDON_IS_FILE_SYSTEM_STORAGE_DIALOG (widget));
-
         priv = GET_PRIV (widget);
 
         /* Clear current child */
         file_system_storage_dialog_clear_data_container (widget);
 
-        /* Create new table for categories */
-        table = gtk_table_new (1, 1, FALSE);
-        gtk_widget_show (table);
-        gtk_container_add (GTK_CONTAINER (priv->viewport_data), table);
-        gtk_table_set_col_spacings (GTK_TABLE (table), HILDON_MARGIN_DOUBLE);
+       	#ifndef HILDON_FREMANTLE_FM_UI
+           /* Create new table for categories */
+           table = gtk_table_new (1, 1, FALSE);
+           gtk_widget_show (table);
+           gtk_container_add (GTK_CONTAINER (priv->viewport_data), table);
+           gtk_table_set_col_spacings (GTK_TABLE (table), HILDON_MARGIN_DOUBLE);
+	#endif
 
         category = 0;
-        col = 0;
+        col = 6;
         have_data = FALSE;
 
         while (category < 9) {
@@ -1138,7 +1172,7 @@
 
                 label_size = gtk_label_new (str);
                 gtk_widget_show (label_size);
-                gtk_table_attach (GTK_TABLE (table), label_size, 0, 1, col, col + 1,
+                gtk_table_attach (GTK_TABLE (priv->table), label_size, 0, 1, col, col + 1,
                                   (GtkAttachOptions) (GTK_FILL),
                                   (GtkAttachOptions) (0), 0, 0);
                 gtk_label_set_justify (GTK_LABEL (label_size), GTK_JUSTIFY_RIGHT);
@@ -1146,7 +1180,7 @@
                 
                 label_category = gtk_label_new (category_str);
                 gtk_widget_show (label_category);
-                gtk_table_attach (GTK_TABLE (table), label_category, 1, 2, col, col + 1,
+                gtk_table_attach (GTK_TABLE (priv->table), label_category, 1, 2, col, col + 1,
                                   (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
                                   (GtkAttachOptions) (0), 0, 0);
                 gtk_label_set_justify (GTK_LABEL (label_size), GTK_JUSTIFY_LEFT);
@@ -1296,7 +1330,9 @@
 	file_system_storage_dialog_stats_get_contacts (widget);
 	file_system_storage_dialog_stats_get_emails (widget);
 	file_system_storage_dialog_stats_get_apps (widget);
-        file_system_storage_dialog_set_data (widget);
+        #ifndef HILDON_FREMANTLE_FM_UI
+           file_system_storage_dialog_set_data (widget);
+	#endif
 
         /* Clean up */
         g_free (total);


More information about the maemo-commits mailing list