* fixed some more typos
authorSilvan Marco Fin <silvan@kernelconcepts.de>
Thu, 8 Jun 2006 13:39:36 +0000 (13:39 +0000)
committerSilvan Marco Fin <silvan@kernelconcepts.de>
Thu, 8 Jun 2006 13:39:36 +0000 (13:39 +0000)
* added Submenu "Account Wizardry" to glade file
  and "New Account..." As first menuitem thereof
* added dynamic generation for this submenu (from the list of accounts)

proposals for other names for "Account Wizardry" welcome :-)

pmo-trunk-r185

src/gtk-glade/modest-ui-wizard.c
src/gtk-glade/modest-ui-wizard.h
src/gtk-glade/modest-ui.c
src/gtk-glade/modest.glade

index dbf20b2..d828771 100644 (file)
@@ -112,15 +112,19 @@ gboolean advance_sanity_check(GtkWindow *parent, GladeXML *glade_xml, gint cp)
         return FALSE;
 }
 
-gboolean wizard_account_add(GladeXML *glade_xml, ModestUIPrivate *priv)
+gboolean wizard_account_add(GladeXML *glade_xml, ModestUI *modest_ui)
 {
        ModestAccountMgr *acc_mgr;
        ModestIdentityMgr *id_mgr;
        const gchar *account_name="default";
-       ModestConf *conf=priv->modest_conf;
+       ModestUIPrivate *priv;
+       ModestConf *conf;
        gchar *tmptext;
 
-       g_return_if_fail (conf);
+       g_return_if_fail (MODEST_IS_UI(modest_ui));
+       priv = MODEST_UI_GET_PRIVATE(MODEST_UI(modest_ui));
+       conf = priv->modest_conf;
+
 
        acc_mgr = MODEST_ACCOUNT_MGR(modest_account_mgr_new (conf));
        if (!acc_mgr) {
@@ -186,6 +190,7 @@ void wizard_account_dialog(ModestUI *modest_ui)
        gint finishallowed=0;
        gboolean account_added_successfully;
 
+       g_return_if_fail(MODEST_IS_UI(modest_ui));
        priv = MODEST_UI_GET_PRIVATE(MODEST_UI(modest_ui));
 
        glade_xml = glade_xml_new(MODEST_GLADE, "account_wizard", NULL);
@@ -238,7 +243,7 @@ void wizard_account_dialog(ModestUI *modest_ui)
                         gtk_notebook_prev_page(GTK_NOTEBOOK(Notebook));
                        break;
                case GTK_RESPONSE_ACCEPT:
-                       account_added_successfully=wizard_account_add(glade_xml, priv);
+                       account_added_successfully=wizard_account_add(glade_xml, modest_ui);
                        break;
                default:
                        account_added_successfully=FALSE;
@@ -257,3 +262,34 @@ void new_wizard_account (GtkWidget *widget,
        wizard_account_dialog(MODEST_UI(user_data));
 }
 
+void setup_account_wizardry_menu (GtkWidget *menu,
+                                 ModestUI *modest_ui)
+{
+       ModestUIPrivate *priv;
+       gint retval;
+       GSList *account_name_list;
+       GSList *account_name_list_iter;
+       GtkWidget *awidget;
+       gint menucounter;
+
+        g_return_if_fail(MODEST_IS_UI(modest_ui));
+       priv = MODEST_UI_GET_PRIVATE(MODEST_UI(modest_ui));
+
+       account_name_list=modest_account_mgr_account_names(priv->modest_acc_mgr, NULL);
+
+       menucounter=1; /* The first item is supposed to be the "New Account..." item. */
+       for (account_name_list_iter=account_name_list;
+            account_name_list_iter!=NULL;
+            account_name_list_iter=g_slist_next(account_name_list_iter))
+       {
+               awidget=gtk_menu_item_new_with_label(account_name_list_iter->data);
+               gtk_widget_show(awidget);
+               gtk_menu_attach(GTK_MENU(menu),
+                               awidget,
+                               0, 1, menucounter, menucounter+1);
+       }
+
+       g_slist_free(account_name_list);
+}
+
+
index 254bee0..bb97ff8 100644 (file)
@@ -4,8 +4,14 @@
 #ifndef __MODEST_UI_WIZZARD_H__
 #define __MODEST_UI_WIZZARD_H__
 
+#include "modest-ui-glade.h"
+
 void new_wizard_account (GtkWidget *,
                          gpointer);
 
+void setup_account_wizardry_menu(GtkWidget *,
+                                 ModestUI *);
+
+
 #endif /* __MODEST_UI_WIZZARD_H__ */
 
index 85d6e6c..53e5b59 100644 (file)
@@ -256,7 +256,8 @@ modest_ui_show_main_window (ModestUI *modest_ui)
        GtkWidget     *message_view;
        GtkWidget     *account_settings_item;
        GtkWidget     *new_account_item;
-       GtkWidget     *delete_item;
+        GtkWidget     *delete_item;
+        GtkWidget     *AccountWizardryMenu;
 
        GtkWidget  *folder_view_holder,
                *header_view_holder,
@@ -306,7 +307,10 @@ modest_ui_show_main_window (ModestUI *modest_ui)
 
        g_signal_connect (header_view, "message_selected",
                          G_CALLBACK(on_message_clicked),
-                         modest_ui);
+                          modest_ui);
+
+        AccountWizardryMenu=glade_xml_get_widget(priv->glade_xml, "AccountWizardry_menu");
+        setup_account_wizardry_menu(AccountWizardryMenu, modest_ui);
 
        account_settings_item = glade_xml_get_widget (priv->glade_xml, "AccountSettingsMenuItem");
        if (!account_settings_item)
@@ -318,17 +322,17 @@ modest_ui_show_main_window (ModestUI *modest_ui)
                           G_CALLBACK(on_account_settings1_activate),
                           modest_ui);
 
-       new_account_item = glade_xml_get_widget (priv->glade_xml, "NewAccountWizzardMenuItem");
+       new_account_item = glade_xml_get_widget (priv->glade_xml, "NewAccountWizardMenuItem");
        if (!new_account_item)
        {
                g_warning ("The new account item isn't available!\n");
                return FALSE;
        }
-/*
+
         g_signal_connect (new_account_item, "activate",
-                          G_CALLBACK(on_new_account1_activate),
+                          G_CALLBACK(new_wizard_account),
                           modest_ui);
-*/
+
        delete_item = glade_xml_get_widget (priv->glade_xml, "delete1");
        if (!delete_item)
        {
@@ -501,7 +505,7 @@ modest_ui_new_edit_window (ModestUI *modest_ui, const gchar* to,
                modest_window_mgr_register (priv->modest_window_mgr,
                                                                        G_OBJECT(win), MODEST_EDIT_WINDOW, 0);
        }
-       
+
        to_entry      = glade_xml_get_widget (priv->glade_xml, "to_entry");
        subject_entry = glade_xml_get_widget (priv->glade_xml, "subject_entry");
        body_view     = glade_xml_get_widget (priv->glade_xml, "body_view");
index 0e6a27a..e70b112 100644 (file)
@@ -40,7 +40,7 @@
              <property name="use_underline">True</property>
 
              <child>
-               <widget class="GtkMenu" id="Message_menu">
+               <widget class="GtkMenu" id="MessageMenuItem_menu">
 
                  <child>
                    <widget class="GtkMenuItem" id="new_e-mail1">
              <property name="use_underline">True</property>
 
              <child>
-               <widget class="GtkMenu" id="Edit_menu">
+               <widget class="GtkMenu" id="EditMenuItem_menu">
 
                  <child>
                    <widget class="GtkMenuItem" id="undo1">
              <property name="use_underline">True</property>
 
              <child>
-               <widget class="GtkMenu" id="Folders_menu">
+               <widget class="GtkMenu" id="FoldersMenuItem_menu">
 
                  <child>
                    <widget class="GtkMenuItem" id="new_folder1">
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">Outbox</property>
                      <property name="use_underline">True</property>
-                     <property name="active">False</property>
+                     <property name="active">True</property>
                      <property name="group">inbox1</property>
                      <signal name="activate" handler="on_outbox1_activate" last_modification_time="Fri, 28 Apr 2006 12:15:47 GMT"/>
                    </widget>
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">Drafts</property>
                      <property name="use_underline">True</property>
-                     <property name="active">False</property>
+                     <property name="active">True</property>
                      <property name="group">inbox1</property>
                      <signal name="activate" handler="on_drafts1_activate" last_modification_time="Fri, 28 Apr 2006 12:15:47 GMT"/>
                    </widget>
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">Sent</property>
                      <property name="use_underline">True</property>
-                     <property name="active">False</property>
+                     <property name="active">True</property>
                      <property name="group">inbox1</property>
                      <signal name="activate" handler="on_sent1_activate" last_modification_time="Fri, 28 Apr 2006 12:15:47 GMT"/>
                    </widget>
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">Archive</property>
                      <property name="use_underline">True</property>
-                     <property name="active">False</property>
+                     <property name="active">True</property>
                      <property name="group">inbox1</property>
                      <signal name="activate" handler="on_archive1_activate" last_modification_time="Fri, 28 Apr 2006 12:15:47 GMT"/>
                    </widget>
              <property name="use_underline">True</property>
 
              <child>
-               <widget class="GtkMenu" id="View_menu">
+               <widget class="GtkMenu" id="ViewMenuItem_menu">
 
                  <child>
                    <widget class="GtkMenuItem" id="sort1">
              <signal name="activate" handler="on_e-mail1_activate" last_modification_time="Fri, 28 Apr 2006 12:12:02 GMT"/>
 
              <child>
-               <widget class="GtkMenu" id="EMail_menu">
+               <widget class="GtkMenu" id="EMailMenuItem_menu">
 
                  <child>
                    <widget class="GtkMenuItem" id="send_&amp;_receive1">
              <signal name="activate" handler="on_tools1_activate" last_modification_time="Fri, 28 Apr 2006 12:12:02 GMT"/>
 
              <child>
-               <widget class="GtkMenu" id="Tools_menu">
+               <widget class="GtkMenu" id="ToolsMenuItem_menu">
 
                  <child>
                    <widget class="GtkMenuItem" id="OpenContactsMenuItem">
                  </child>
 
                  <child>
-                   <widget class="GtkMenuItem" id="NewAccountWizzardMenuItem">
+                   <widget class="GtkMenuItem" id="AccountWizardryMenuItem">
                      <property name="visible">True</property>
-                     <property name="label" translatable="yes">New account...</property>
+                     <property name="label" translatable="yes">Account Wizardry</property>
                      <property name="use_underline">True</property>
-                     <signal name="activate" handler="on_new_account1_activate" last_modification_time="Fri, 28 Apr 2006 12:23:17 GMT"/>
+
+                     <child>
+                       <widget class="GtkMenu" id="AccountWizardry_menu">
+
+                         <child>
+                           <widget class="GtkMenuItem" id="NewAccountWizardMenuItem">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">New account...</property>
+                             <property name="use_underline">True</property>
+                             <signal name="activate" handler="new_wizard_account" last_modification_time="Fri, 28 Apr 2006 12:23:17 GMT"/>
+                           </widget>
+                         </child>
+                       </widget>
+                     </child>
                    </widget>
                  </child>
 
              <property name="use_underline">True</property>
 
              <child>
-               <widget class="GtkMenu" id="Close_menu">
+               <widget class="GtkMenu" id="CloseMenuItem_menu">
 
                  <child>
                    <widget class="GtkMenuItem" id="about1">
   <property name="has_separator">True</property>
 
   <child internal-child="vbox">
-    <widget class="GtkVBox" id="account_wizzard_top_container">
+    <widget class="GtkVBox" id="account_wizard_top_container">
       <property name="visible">True</property>
       <property name="homogeneous">False</property>
       <property name="spacing">0</property>