[evolution-kolab] EPlugin: pass on name of selected folder to subdialogs
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] EPlugin: pass on name of selected folder to subdialogs
- Date: Mon, 4 Jun 2012 21:05:46 +0000 (UTC)
commit b0ec910a80df66e6407115b70a8a26ca7b9fb371
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Jun 4 11:18:18 2012 +0200
EPlugin: pass on name of selected folder to subdialogs
* pass the name of the selected folder through
to "Kolab Folder Properties" dialogs
* changed icon for "Kolab Folder Properties"
context menu entries to stock GTK properties
icon
src/eplugin/e-kolab-plugin-ui.c | 69 ++++++++++++++++++++++----------------
1 files changed, 40 insertions(+), 29 deletions(-)
---
diff --git a/src/eplugin/e-kolab-plugin-ui.c b/src/eplugin/e-kolab-plugin-ui.c
index 06285e6..327cc51 100644
--- a/src/eplugin/e-kolab-plugin-ui.c
+++ b/src/eplugin/e-kolab-plugin-ui.c
@@ -49,6 +49,7 @@
#include "e-kolab-folder-metadata.h"
#include "e-kolab-folder-permissions.h"
+#include "e-kolab-plugin-util.h"
#include "e-kolab-plugin-ui.h"
/*----------------------------------------------------------------------------*/
@@ -61,7 +62,7 @@ static void kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action, EShel
static GtkActionEntry mail_folder_context_entries[] = {
{ "kolab-mail-folder-properties",
- "folder-new",
+ GTK_STOCK_PROPERTIES,
N_("Kolab Folder Properties..."),
NULL,
N_("Edit Kolab mail folder properties"),
@@ -70,7 +71,7 @@ static GtkActionEntry mail_folder_context_entries[] = {
static GtkActionEntry calendar_context_entries[] = {
{ "kolab-calendar-folder-properties",
- "folder-new",
+ GTK_STOCK_PROPERTIES,
N_("Kolab Folder Properties..."),
NULL,
N_("Edit Kolab calendar folder properties"),
@@ -79,7 +80,7 @@ static GtkActionEntry calendar_context_entries[] = {
static GtkActionEntry memos_context_entries[] = {
{ "kolab-memos-folder-properties",
- "folder-new",
+ GTK_STOCK_PROPERTIES,
N_("Kolab Folder Properties..."),
NULL,
N_("Edit Kolab memos folder properties"),
@@ -88,7 +89,7 @@ static GtkActionEntry memos_context_entries[] = {
static GtkActionEntry tasks_context_entries[] = {
{ "kolab-tasks-folder-properties",
- "folder-new",
+ GTK_STOCK_PROPERTIES,
N_("Kolab Folder Properties..."),
NULL,
N_("Edit Kolab Tasks folder properties"),
@@ -97,7 +98,7 @@ static GtkActionEntry tasks_context_entries[] = {
static GtkActionEntry contacts_context_entries[] = {
{ "kolab-contacts-folder-properties",
- "folder-new",
+ GTK_STOCK_PROPERTIES,
N_("Kolab Folder Properties..."),
NULL,
N_("Edit Kolab contacts folder properties"),
@@ -123,6 +124,7 @@ struct _KolabFolderPropUIData {
KolabFolderMetaUIData *meta_ui_data;
KolabFolderPermUIData *perm_ui_data;
KolabDataImapAccount *account;
+ gchar *selected_folder;
};
static void
@@ -130,6 +132,7 @@ kolab_folder_prop_ui_widgets_enable (KolabFolderPropUIWidgets *widgets,
gboolean enabled)
{
g_return_if_fail (widgets != NULL);
+ (void)enabled; /* FIXME */
/* FIXME implement me */
g_warning ("%s: FIXME implement me", __func__);
@@ -145,6 +148,7 @@ kolab_folder_prop_ui_data_new ()
uidata->meta_ui_data = NULL;
uidata->perm_ui_data = NULL;
uidata->account = NULL;
+ uidata->selected_folder = NULL;
return uidata;
}
@@ -164,6 +168,8 @@ kolab_folder_prop_ui_data_free (KolabFolderPropUIData *uidata)
e_kolab_folder_metadata_ui_free (uidata->meta_ui_data);
e_kolab_folder_permissions_ui_free (uidata->perm_ui_data);
kolab_data_imap_account_free (uidata->account);
+ if (uidata->selected_folder != NULL)
+ g_free (uidata->selected_folder);
g_free (uidata);
}
@@ -353,16 +359,14 @@ kolab_plugin_ui_get_selected_path (EShellView *shell_view,
return selected_path;
}
-static GtkWidget*
-kolab_plugin_ui_selected_folder_widget (GtkAction *action,
- EShellView *shell_view)
+static gchar*
+kolab_plugin_ui_selected_folder_name (GtkAction *action,
+ EShellView *shell_view)
{
- GtkWidget *label = NULL;
- gchar *labeltext = NULL;
gchar *foldername = NULL;
gboolean is_kolab_account_node = FALSE;
gboolean is_kolab_folder_node = FALSE;
-
+
g_assert (action != NULL);
g_assert (E_IS_SHELL_VIEW (shell_view));
@@ -371,17 +375,14 @@ kolab_plugin_ui_selected_folder_widget (GtkAction *action,
&is_kolab_folder_node);
g_return_val_if_fail (foldername != NULL, NULL);
- g_return_val_if_fail (!is_kolab_account_node, NULL);
- g_return_val_if_fail (is_kolab_folder_node, NULL);
- label = gtk_label_new (NULL);
- labeltext = g_strconcat ("<b>", _("Selected Folder"), ": </b>", foldername, NULL);
- g_free (foldername);
- gtk_label_set_markup (GTK_LABEL (label), labeltext);
- g_free (labeltext);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
-
- return label;
+ if (is_kolab_account_node || (! is_kolab_folder_node)) {
+ if (foldername != NULL)
+ g_free (foldername);
+ return NULL;
+ }
+
+ return foldername;
}
static void
@@ -392,12 +393,11 @@ kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
GObject *dialog = NULL;
GtkWidget *content = NULL;
GtkNotebook *notebook = NULL;
+ gchar *foldername = NULL;
- uidata = kolab_folder_prop_ui_data_new ();
-
- uidata->widgets->selected_folder =
- kolab_plugin_ui_selected_folder_widget (action, shell_view);
- if (uidata->widgets->selected_folder == NULL) {
+ foldername = kolab_plugin_ui_selected_folder_name (action,
+ shell_view);
+ if (foldername == NULL) {
/* TODO this should not happen.
*
* If the selected folder is NULL here, it means
@@ -407,10 +407,15 @@ kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
*/
g_warning ("%s()[%u]: Selected folder is no Kolab folder node",
__func__, __LINE__);
- kolab_folder_prop_ui_data_free (uidata);
return;
}
+ uidata = kolab_folder_prop_ui_data_new ();
+
+ uidata->widgets->selected_folder =
+ e_kolab_plugin_util_ui_selected_folder_widget (foldername);
+ uidata->selected_folder = foldername;
+
uidata->widgets->dialog =
gtk_dialog_new_with_buttons (_("Edit Kolab Folder Properties..."),
NULL, /* parent */
@@ -421,7 +426,11 @@ kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
gtk_window_set_resizable (GTK_WINDOW (uidata->widgets->dialog), FALSE);
uidata->meta_ui_data = e_kolab_folder_metadata_ui_new ();
+ uidata->meta_ui_data->selected_folder = g_strdup (foldername);
+
uidata->perm_ui_data = e_kolab_folder_permissions_ui_new ();
+ uidata->perm_ui_data->selected_folder = g_strdup (foldername);
+
/* FIXME get account data here */
uidata->account = kolab_data_imap_account_new ();
@@ -445,7 +454,8 @@ kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
NULL);
gtk_notebook_set_tab_label_text (notebook,
uidata->meta_ui_data->widgets->container,
- _("IMAP Metadata"));
+ C_("Kolab Folder Properties",
+ "IMAP Metadata"));
/* folder permissions notebook page */
gtk_notebook_append_page (notebook,
@@ -453,7 +463,8 @@ kolab_plugin_ui_action_kolab_properties_cb (GtkAction *action,
NULL);
gtk_notebook_set_tab_label_text (notebook,
uidata->perm_ui_data->widgets->container,
- _("IMAP Access Control"));
+ C_("Kolab Folder Properties",
+ "IMAP Access Control"));
/* TODO connect signals */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]