* Fixes NB#66958, now menus show the account names ellipsized
authorSergio Villar Senin <svillar@igalia.com>
Fri, 18 Jan 2008 09:58:04 +0000 (09:58 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Fri, 18 Jan 2008 09:58:04 +0000 (09:58 +0000)
pmo-trunk-r4063

src/maemo/modest-main-window.c
src/maemo/modest-signature-editor-dialog.c

index c9170fd..0e49e44 100644 (file)
@@ -704,14 +704,11 @@ update_menus (ModestMainWindow* self)
                        if (num_accounts > 1) {
                                GtkWidget *label = gtk_label_new(NULL);
                                gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-                               if (default_account && (strcmp(account_name, default_account) == 0))
-                               {
+                               if (default_account && (strcmp(account_name, default_account) == 0)) {
                                        gchar *escaped = g_markup_printf_escaped ("<b>%s</b>", display_name);
                                        gtk_label_set_markup (GTK_LABEL (label), escaped);
                                        g_free (escaped);
-                               }
-                               else
-                               {
+                               } else {
                                        gtk_label_set_text (GTK_LABEL (label), display_name);
                                }
 
@@ -739,46 +736,54 @@ update_menus (ModestMainWindow* self)
         * group being inserted. This makes the default account appear in bold.
         * I agree it is a rather ugly way, but I don't see another possibility. armin. */
        for (i = 0; i < num_accounts; i++) {
-               ModestAccountSettings *settings = (ModestAccountSettings *) g_slist_nth_data (accounts, i);
+               gchar *item_name, *path;
+               GtkWidget *item;
+               ModestAccountSettings *settings;
                const gchar *account_name;
+               gboolean is_default;
 
+               settings = (ModestAccountSettings *) g_slist_nth_data (accounts, i);
                account_name = modest_account_settings_get_account_name (settings);
+               is_default = (account_name && default_account && !strcmp (account_name, default_account));
 
-               if(account_name && default_account &&
-                  strcmp (account_name, default_account) == 0) {
-                       gchar *item_name = g_strconcat (account_name, "Menu", NULL);
-
-                       gchar *path = g_strconcat ("/MenuBar/ViewMenu/ViewMenuAdditions/", item_name, NULL);
-                       GtkWidget *item = gtk_ui_manager_get_widget (parent_priv->ui_manager, path);
-                       g_free(path);
-
-                       if (item) {
-                               GtkWidget *child = gtk_bin_get_child (GTK_BIN (item));
-                               if (GTK_IS_LABEL (child)) {
-                                       const gchar *cur_name = gtk_label_get_text (GTK_LABEL (child));
+               /* Get the item of the view menu */
+               item_name = g_strconcat (account_name, "Menu", NULL);
+               path = g_strconcat ("/MenuBar/ViewMenu/ViewMenuAdditions/", item_name, NULL);
+               item = gtk_ui_manager_get_widget (parent_priv->ui_manager, path);
+               g_free(path);
+               
+               if (item) {
+                       GtkWidget *child = gtk_bin_get_child (GTK_BIN (item));
+                       if (GTK_IS_LABEL (child)) {
+                               const gchar *cur_name = gtk_label_get_text (GTK_LABEL (child));
+                               if (is_default) {
                                        gchar *bold_name = g_markup_printf_escaped("<b>%s</b>", cur_name);
                                        gtk_label_set_markup (GTK_LABEL (child), bold_name);
                                        g_free (bold_name);
                                }
+                               gtk_label_set_ellipsize (GTK_LABEL (child),  PANGO_ELLIPSIZE_END);
                        }
+               }
                        
-                       path = g_strconcat("/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsMenuAdditions/", item_name, NULL);
-                       item = gtk_ui_manager_get_widget (parent_priv->ui_manager, path);
-                       g_free (path);
-
-                       if (item) {
-                               GtkWidget *child = gtk_bin_get_child (GTK_BIN (item));
-                               if (GTK_IS_LABEL (child)) {
-                                       const gchar *cur_name = gtk_label_get_text (GTK_LABEL (child));
+               /* Get the item of the tools menu */
+               path = g_strconcat("/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsMenuAdditions/", item_name, NULL);
+               item = gtk_ui_manager_get_widget (parent_priv->ui_manager, path);
+               g_free (path);
+
+               if (item) {
+                       GtkWidget *child = gtk_bin_get_child (GTK_BIN (item));
+                       if (GTK_IS_LABEL (child)) {
+                               const gchar *cur_name = gtk_label_get_text (GTK_LABEL (child));
+                               if (is_default) {
                                        gchar *bold_name = g_markup_printf_escaped("<b>%s</b>", cur_name);
                                        gtk_label_set_markup (GTK_LABEL (child), bold_name);
                                        g_free (bold_name);
                                }
+                               gtk_label_set_ellipsize (GTK_LABEL (child),  PANGO_ELLIPSIZE_END);
                        }
-
-                       g_free(item_name);
                }
 
+               g_free(item_name);
                g_object_unref (settings);
        }
 
index 1daf304..793d718 100644 (file)
@@ -196,6 +196,7 @@ modest_signature_editor_dialog_set_settings (
        gchar* label_text = g_strdup_printf (_("mcen_ia_email_signatures_edit_dlg_label"), 
                account_title);
        gtk_label_set_text (GTK_LABEL (priv->label), label_text);
+       gtk_label_set_ellipsize (GTK_LABEL (priv->label),  PANGO_ELLIPSIZE_END);
        g_free (label_text);
        
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->checkbox_use), use_signature);