Replace MMC hardcoded paths with the ones retrieving path from env
authorJose Dapena Paz <jdapena@igalia.com>
Thu, 4 Dec 2008 21:23:36 +0000 (21:23 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Thu, 4 Dec 2008 21:23:36 +0000 (21:23 +0000)
pmo-drop-split-view-r6664

src/hildon2/modest-main-window.c
src/hildon2/modest-msg-view-window.c
src/modest-defs.h
src/modest-tny-account-store.c
src/modest-tny-account.c
src/modest-ui-actions.c

index 8789390..efd2150 100644 (file)
@@ -900,6 +900,11 @@ connect_signals (ModestMainWindow *self)
                                           G_CALLBACK (on_folder_view_focus_in), 
                                           self);
 
+       /* folder view row activated */
+       priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers, G_OBJECT(priv->folder_view), "row-activated",
+                                                      G_CALLBACK(on_folder_view_row_activated),
+                                                      self);
+
        /* header view */
        priv->sighandlers = 
                modest_signal_mgr_connect (priv->sighandlers,G_OBJECT(priv->header_view), "header_selected",
index 714e883..7fc5c9e 100644 (file)
@@ -134,6 +134,10 @@ static void  modest_msg_view_window_find_toolbar_search (GtkWidget *widget,
 static void modest_msg_view_window_disconnect_signals (ModestWindow *self);
 
 static gdouble modest_msg_view_window_get_zoom (ModestWindow *window);
+static void modest_msg_view_window_set_zoom (ModestWindow *window,
+                                            gdouble zoom);
+static gboolean modest_msg_view_window_zoom_minus (ModestWindow *window);
+static gboolean modest_msg_view_window_zoom_plus (ModestWindow *window);
 static gboolean modest_msg_view_window_key_event (GtkWidget *window,
                                                  GdkEventKey *event,
                                                  gpointer userdata);
@@ -239,61 +243,6 @@ static const GtkToggleActionEntry msg_view_toggle_action_entries [] = {
        { "FindInMessage",    MODEST_TOOLBAR_ICON_FIND,    N_("qgn_toolb_gene_find"), NULL, NULL, G_CALLBACK (modest_msg_view_window_toggle_find_toolbar), FALSE },
 };
 
-typedef struct _ModestMsgViewWindowPrivate ModestMsgViewWindowPrivate;
-struct _ModestMsgViewWindowPrivate {
-
-       GtkWidget   *msg_view;
-       GtkWidget   *main_scroll;
-       GtkWidget   *find_toolbar;
-       gchar       *last_search;
-
-       /* Progress observers */
-       GtkWidget        *progress_bar;
-       GSList           *progress_widgets;
-
-       /* Tollbar items */
-       GtkWidget   *progress_toolitem;
-       GtkWidget   *cancel_toolitem;
-       GtkWidget   *prev_toolitem;
-       GtkWidget   *next_toolitem;
-       ModestToolBarModes current_toolbar_mode;
-
-       /* Optimized view enabled */
-       gboolean optimized_view;
-
-       /* Whether this was created via the *_new_for_search_result() function. */
-       gboolean is_search_result;
-
-       /* Whether the message is in outbox */
-       gboolean is_outbox;
-       
-       /* A reference to the @model of the header view 
-        * to allow selecting previous/next messages,
-        * if the message is currently selected in the header view.
-        */
-       const gchar *header_folder_id;
-       GtkTreeModel *header_model;
-       GtkTreeRowReference *row_reference;
-       GtkTreeRowReference *next_row_reference;
-
-       gulong clipboard_change_handler;
-       gulong queue_change_handler;
-       gulong account_removed_handler;
-       gulong row_changed_handler;
-       gulong row_deleted_handler;
-       gulong row_inserted_handler;
-       gulong rows_reordered_handler;
-
-       guint purge_timeout;
-       GtkWidget *remove_attachment_banner;
-
-       guint progress_bar_timeout;
-
-       gchar *msg_uid;
-       
-       GSList *sighandlers;
->>>>>>> fe21497...  * Fixes NB#92694, migrated the viewer menus to 1.5 specs version:src/hildon2/modest-msg-view-window.c
-};
 
 #define MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
                                                     MODEST_TYPE_MSG_VIEW_WINDOW, \
@@ -347,19 +296,6 @@ save_state (ModestWindow *self)
                                   MODEST_CONF_MSG_VIEW_WINDOW_KEY);
 }
 
-<<<<<<< HEAD:src/hildon2/modest-msg-view-window.c
-
-static void
-restore_settings (ModestMsgViewWindow *self)
-{
-       ModestConf *conf;
-
-       conf = modest_runtime_get_conf ();
-       modest_widget_memory_restore (conf,
-                                     G_OBJECT(self), 
-                                     MODEST_CONF_MSG_VIEW_WINDOW_KEY);
-}
-
 static 
 gboolean modest_msg_view_window_scroll_child (ModestMsgViewWindow *self,
                                              GtkScrollType scroll_type,
@@ -410,6 +346,8 @@ modest_msg_view_window_class_init (ModestMsgViewWindowClass *klass)
 
        modest_window_class->set_zoom_func = modest_msg_view_window_set_zoom;
        modest_window_class->get_zoom_func = modest_msg_view_window_get_zoom;
+       modest_window_class->zoom_plus_func = modest_msg_view_window_zoom_plus;
+       modest_window_class->zoom_minus_func = modest_msg_view_window_zoom_minus;
        modest_window_class->show_toolbar_func = modest_msg_view_window_show_toolbar;
        modest_window_class->disconnect_signals_func = modest_msg_view_window_disconnect_signals;
 
index 4927cbb..602d351 100644 (file)
 
 #define MODEST_MMC_ACCOUNT_ID             "mcc"
 
-/* FIXME: get these from the environment */
 /* Without the trailing / because gnome-vfs reports mounted 
  * volume URIs without the trailing, and we want to match them: */
-#define MODEST_MCC1_VOLUMEPATH   "/media/mmc1" 
-#define MODEST_MCC1_VOLUMEPATH_URI "file://" MODEST_MCC1_VOLUMEPATH
+#define MODEST_MMC1_VOLUMEPATH_ENV       "MMC_MOUNTPOINT" 
+#define MODEST_MMC1_VOLUMEPATH_URI_PREFIX "file://"
 
 /* configuration key definitions for modest */
 #define MODEST_CONF_NAMESPACE          "/apps/modest"
index 928c198..4d88938 100644 (file)
@@ -335,8 +335,8 @@ add_mmc_account(ModestTnyAccountStore *self, gboolean emit_insert_signal)
        g_return_if_fail (priv->session);
        
        TnyAccount *mmc_account = modest_tny_account_new_for_local_folders (priv->account_mgr, 
-                                                                       priv->session, 
-                                                                       MODEST_MCC1_VOLUMEPATH);
+                                                                           priv->session, 
+                                                                           g_getenv (MODEST_MMC1_VOLUMEPATH_ENV));
 
        /* Add to the list of store accounts */
        tny_list_append (priv->store_accounts, G_OBJECT (mmc_account));
@@ -358,6 +358,7 @@ on_vfs_volume_mounted(GnomeVFSVolumeMonitor *volume_monitor,
 {
        ModestTnyAccountStore *self;
        ModestTnyAccountStorePrivate *priv;
+       gchar *volume_path_uri;
  
        gchar *uri = NULL;
 
@@ -367,10 +368,14 @@ on_vfs_volume_mounted(GnomeVFSVolumeMonitor *volume_monitor,
        /* Check whether this was the external MMC1 card: */
        uri = gnome_vfs_volume_get_activation_uri (volume);
 
-       if (uri && (!strcmp (uri, MODEST_MCC1_VOLUMEPATH_URI))) {
+       volume_path_uri = g_strconcat (MODEST_MMC1_VOLUMEPATH_URI_PREFIX,
+                                      g_getenv (MODEST_MMC1_VOLUMEPATH_ENV),
+                                      NULL);
+       if (uri && (!strcmp (uri, volume_path_uri))) {
                add_mmc_account (self, TRUE /* emit the insert signal. */);
        }
-       
+
+       g_free (volume_path_uri);       
        g_free (uri);
 }
 
@@ -382,13 +387,17 @@ on_vfs_volume_unmounted(GnomeVFSVolumeMonitor *volume_monitor,
        ModestTnyAccountStore *self;
        ModestTnyAccountStorePrivate *priv;
        gchar *uri = NULL;
+       gchar *volume_path_uri;
 
        self = MODEST_TNY_ACCOUNT_STORE(user_data);
        priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
        
        /* Check whether this was the external MMC1 card: */
        uri = gnome_vfs_volume_get_activation_uri (volume);
-       if (uri && (strcmp (uri, MODEST_MCC1_VOLUMEPATH_URI) == 0)) {
+       volume_path_uri = g_strconcat (MODEST_MMC1_VOLUMEPATH_URI_PREFIX,
+                                      g_getenv (MODEST_MMC1_VOLUMEPATH_ENV),
+                                      NULL);
+       if (uri && (strcmp (uri, volume_path_uri) == 0)) {
                TnyAccount *mmc_account = NULL;
                gboolean found = FALSE;
                TnyIterator *iter = NULL;
@@ -422,6 +431,7 @@ on_vfs_volume_unmounted(GnomeVFSVolumeMonitor *volume_monitor,
                                   __FUNCTION__);
                }
        }
+       g_free (volume_path_uri);
        g_free (uri);
 }
 
@@ -851,7 +861,7 @@ volume_path_is_mounted (const gchar* path)
         * GnomeVFSVolume even if the drive is not mounted: */
        /*
        GnomeVFSVolume *volume = gnome_vfs_volume_monitor_get_volume_for_path (monitor, 
-               MODEST_MCC1_VOLUMEPATH);
+                                g_getenv (MODEST_MMC1_VOLUMEPATH_ENV));
        if (volume) {
                gnome_vfs_volume_unref(volume);
        }
@@ -951,7 +961,7 @@ modest_tny_account_store_new (ModestAccountMgr *account_mgr,
                add_connection_specific_transport_accounts (MODEST_TNY_ACCOUNT_STORE(obj));
        
        /* This is a singleton, so it does not need to be unrefed. */
-       if (volume_path_is_mounted (MODEST_MCC1_VOLUMEPATH)) {
+       if (volume_path_is_mounted (g_getenv (MODEST_MMC1_VOLUMEPATH_ENV))) {
                /* It is mounted: */
                add_mmc_account (MODEST_TNY_ACCOUNT_STORE (obj), FALSE /* don't emit the insert signal. */); 
        }
index cfa79f4..57a58e7 100644 (file)
@@ -637,11 +637,13 @@ on_modest_file_system_info (HildonFileSystemInfoHandle *handle,
 void modest_tny_account_get_mmc_account_name (TnyStoreAccount* self, ModestTnyAccountGetMmcAccountNameCallback callback, gpointer user_data)
 {
 #ifndef MODEST_TOOLKIT_GTK
-       /* Just use the hard-coded path for the single memory card,
+       /* Just use the path for the single memory card,
         * rather than try to figure out the path to the specific card by 
         * looking at the maildir URI:
         */
-       const gchar *uri_real = MODEST_MCC1_VOLUMEPATH_URI;
+       gchar *uri_real = g_strconcat (MODEST_MMC1_VOLUMEPATH_URI_PREFIX,
+                                      g_getenv (MODEST_MMC1_VOLUMEPATH_ENV),
+                                      NULL);
 
        /*
        gchar* uri = tny_account_get_url_string (TNY_ACCOUNT (self));
@@ -671,7 +673,7 @@ void modest_tny_account_get_mmc_account_name (TnyStoreAccount* self, ModestTnyAc
                hildon_file_system_info_async_new(uri_real, 
                        on_modest_file_system_info, callback_data /* user_data */);
 
-               /* g_free (uri_real); */
+               g_free (uri_real);
        }
 
        /* g_free (uri); */
@@ -730,7 +732,7 @@ modest_tny_account_new_for_local_folders (ModestAccountMgr *account_mgr, TnySess
         * via a derived TnyCamelStoreAccount ? */
        const gboolean is_mmc = 
                location_filepath && 
-               (strcmp (location_filepath, MODEST_MCC1_VOLUMEPATH) == 0);
+               (strcmp (location_filepath, g_getenv (MODEST_MMC1_VOLUMEPATH_ENV)) == 0);
                
        /* The name of memory card locations will be updated asynchronously.
         * This is just a default: */
index 534b350..97ee4b7 100644 (file)
@@ -948,7 +948,6 @@ get_info_from_header (TnyHeader *header, gboolean *is_draft)
                                           outbox which is not in
                                           failed state */
                                        g_object_unref(traccount);
-                                       goto cleanup;
                                 }
 #endif
                        }