aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-08-10 09:07:46 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-08-10 09:07:46 +0800
commitd471640fe82b68d5430514120dffa69be196f852 (patch)
tree2f6db2e1263b31b7727c941979f21487953e675c
parent518d8af11bdadf0245735ca632e9ec1e0e50a533 (diff)
downloadgsoc2013-evolution-d471640fe82b68d5430514120dffa69be196f852.tar.gz
gsoc2013-evolution-d471640fe82b68d5430514120dffa69be196f852.tar.zst
gsoc2013-evolution-d471640fe82b68d5430514120dffa69be196f852.zip
Updated to display the parent folder's URI and its type as well.
* evolution-test-component.c (user_create_new_item_callback): Updated to display the parent folder's URI and its type as well. * evolution-shell-component.c (impl_userCreateNewItem): Updated to get the @parent_folder_physical_uri and the @parent_folder_type. (class_init): Update the "user_create_new_item" signal to have @parent_folder_physical_uri and @parent_folder_type args. * e-shell-view.c (get_type_for_folder): Don't bork on a NULL @physical_uri_return. (e_shell_view_get_current_physical_uri): New. (e_shell_view_get_current_folder_type): New. * e-shell-user-creatable-items-handler.c (e_shell_user_creatable_items_handler_setup_menus): Replace @ui_component arg with a @shell_view arg. Set it on the UIComponent using gtk_object_set_data(). (verb_fn): Pass the type and physical URI of the current folder; retrieve that from the shell_view got with gtk_object_get_data(). * Evolution-ShellComponent.idl (userCreateNewItem): New args @parent_folder_uri, @parent_folder_type. svn path=/trunk/; revision=11863
-rw-r--r--shell/ChangeLog26
-rw-r--r--shell/Evolution-ShellComponent.idl4
-rw-r--r--shell/e-shell-user-creatable-items-handler.c23
-rw-r--r--shell/e-shell-user-creatable-items-handler.h4
-rw-r--r--shell/e-shell-view.c39
-rw-r--r--shell/e-shell-view.h16
-rw-r--r--shell/evolution-shell-component.c10
-rw-r--r--shell/evolution-shell-component.h4
-rw-r--r--shell/evolution-test-component.c5
9 files changed, 111 insertions, 20 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 9ca8bd0ca9..3baf2eced1 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,31 @@
2001-08-09 Ettore Perazzoli <ettore@ximian.com>
+ * evolution-test-component.c (user_create_new_item_callback):
+ Updated to display the parent folder's URI and its type as well.
+
+ * evolution-shell-component.c (impl_userCreateNewItem): Updated to
+ get the @parent_folder_physical_uri and the @parent_folder_type.
+ (class_init): Update the "user_create_new_item" signal to have
+ @parent_folder_physical_uri and @parent_folder_type args.
+
+ * e-shell-view.c (get_type_for_folder): Don't bork on a NULL
+ @physical_uri_return.
+ (e_shell_view_get_current_physical_uri): New.
+ (e_shell_view_get_current_folder_type): New.
+
+ * e-shell-user-creatable-items-handler.c
+ (e_shell_user_creatable_items_handler_setup_menus): Replace
+ @ui_component arg with a @shell_view arg. Set it on the
+ UIComponent using gtk_object_set_data().
+ (verb_fn): Pass the type and physical URI of the current folder;
+ retrieve that from the shell_view got with gtk_object_get_data().
+
+ * Evolution-ShellComponent.idl
+ (userCreateNewItem): New args @parent_folder_uri,
+ @parent_folder_type.
+
+2001-08-09 Ettore Perazzoli <ettore@ximian.com>
+
* e-shortcuts-view.c (show_new_group_dialog): Cast the toplevel to
be passed to `e_request_string()' to GtkWindow, not GtkWidget.
Also, remove unused variables.
diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl
index 101d23d4f3..9a041fa00e 100644
--- a/shell/Evolution-ShellComponent.idl
+++ b/shell/Evolution-ShellComponent.idl
@@ -92,7 +92,9 @@ module Evolution {
in string physical_uri,
in string type);
- void userCreateNewItem (in string id)
+ void userCreateNewItem (in string id,
+ in string parent_folder_physical_uri,
+ in string parent_folder_type)
raises (UnsupportedType);
};
diff --git a/shell/e-shell-user-creatable-items-handler.c b/shell/e-shell-user-creatable-items-handler.c
index 340f0b50bc..6be8942a5d 100644
--- a/shell/e-shell-user-creatable-items-handler.c
+++ b/shell/e-shell-user-creatable-items-handler.c
@@ -40,6 +40,7 @@ static GtkObjectClass *parent_class = NULL;
#define VERB_PREFIX "ShellUserCreatableItemVerb"
+#define SHELL_VIEW_DATA_KEY "EShellUserCreatableItemsHandler:shell_view"
struct _Component {
EvolutionShellComponentClient *component_client;
@@ -259,6 +260,7 @@ verb_fn (BonoboUIComponent *ui_component,
{
EShellUserCreatableItemsHandler *handler;
EShellUserCreatableItemsHandlerPrivate *priv;
+ EShellView *shell_view;
const Component *component;
int component_number;
const char *p;
@@ -266,6 +268,9 @@ verb_fn (BonoboUIComponent *ui_component,
GSList *component_list_item;
int i;
+ shell_view = gtk_object_get_data (GTK_OBJECT (ui_component), SHELL_VIEW_DATA_KEY);
+ g_assert (E_IS_SHELL_VIEW (shell_view));
+
handler = E_SHELL_USER_CREATABLE_ITEMS_HANDLER (data);
priv = handler->priv;
@@ -289,7 +294,11 @@ verb_fn (BonoboUIComponent *ui_component,
CORBA_exception_init (&ev);
GNOME_Evolution_ShellComponent_userCreateNewItem
- (bonobo_object_corba_objref (BONOBO_OBJECT (component->component_client)), id, &ev);
+ (bonobo_object_corba_objref (BONOBO_OBJECT (component->component_client)),
+ id,
+ e_shell_view_get_current_physical_uri (shell_view),
+ e_shell_view_get_current_folder_type (shell_view),
+ &ev);
if (ev._major != CORBA_NO_EXCEPTION)
g_warning ("Error in userCreateNewItem -- %s", ev._repo_id);
@@ -407,22 +416,28 @@ e_shell_user_creatable_items_handler_add_component (EShellUserCreatableItemsHan
void
e_shell_user_creatable_items_handler_setup_menus (EShellUserCreatableItemsHandler *handler,
- BonoboUIComponent *ui_component)
+ EShellView *shell_view)
{
EShellUserCreatableItemsHandlerPrivate *priv;
+ BonoboUIComponent *ui_component;
g_return_if_fail (handler != NULL);
g_return_if_fail (E_IS_SHELL_USER_CREATABLE_ITEMS_HANDLER (handler));
- g_return_if_fail (ui_component != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
+ g_return_if_fail (shell_view != NULL);
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
priv = handler->priv;
if (priv->menu_xml == NULL)
setup_menu_xml (handler);
+ ui_component = e_shell_view_get_bonobo_ui_component (shell_view);
+ g_assert (ui_component);
+
add_verbs_to_ui_component (handler, ui_component);
+ gtk_object_set_data (GTK_OBJECT (ui_component), SHELL_VIEW_DATA_KEY, shell_view); /* Yuck. */
+
bonobo_ui_component_set (ui_component, "/", priv->menu_xml, NULL);
}
diff --git a/shell/e-shell-user-creatable-items-handler.h b/shell/e-shell-user-creatable-items-handler.h
index ffe8a608b5..50cf2bd750 100644
--- a/shell/e-shell-user-creatable-items-handler.h
+++ b/shell/e-shell-user-creatable-items-handler.h
@@ -45,6 +45,8 @@ typedef struct _EShellUserCreatableItemsHandler EShellUserCreatableItemsH
typedef struct _EShellUserCreatableItemsHandlerPrivate EShellUserCreatableItemsHandlerPrivate;
typedef struct _EShellUserCreatableItemsHandlerClass EShellUserCreatableItemsHandlerClass;
+#include "e-shell-view.h"
+
struct _EShellUserCreatableItemsHandler {
GtkObject parent;
@@ -63,7 +65,7 @@ void e_shell_user_creatable_items_handler_add_component (EShellUserCreatableIt
EvolutionShellComponentClient *shell_component_client);
void e_shell_user_creatable_items_handler_setup_menus (EShellUserCreatableItemsHandler *handler,
- BonoboUIComponent *ui_component);
+ EShellView *shell_view);
#ifdef __cplusplus
}
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 696c4e5643..00087db30d 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -1213,7 +1213,7 @@ e_shell_view_construct (EShellView *shell_view,
GTK_OBJECT (view));
e_shell_user_creatable_items_handler_setup_menus (e_shell_get_user_creatable_items_handler (priv->shell),
- priv->ui_component);
+ shell_view);
return view;
}
@@ -1648,7 +1648,8 @@ get_type_for_folder (EShellView *shell_view,
if (!folder)
return NULL;
- *physical_uri_return = e_folder_get_physical_uri (folder);
+ if (physical_uri_return != NULL)
+ *physical_uri_return = e_folder_get_physical_uri (folder);
return e_folder_get_type_string (folder);
}
@@ -2107,6 +2108,40 @@ e_shell_view_get_current_path (EShellView *shell_view)
return current_path;
}
+const char *
+e_shell_view_get_current_physical_uri (EShellView *shell_view)
+{
+ const char *current_path;
+ const char *physical_uri;
+
+ g_return_val_if_fail (shell_view != NULL, NULL);
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ current_path = e_shell_view_get_current_path (shell_view);
+ if (current_path == NULL)
+ return NULL;
+
+ if (get_type_for_folder (shell_view, current_path, &physical_uri) == NULL)
+ return NULL;
+ else
+ return physical_uri;
+}
+
+const char *
+e_shell_view_get_current_folder_type (EShellView *shell_view)
+{
+ const char *current_path;
+
+ g_return_val_if_fail (shell_view != NULL, NULL);
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ current_path = e_shell_view_get_current_path (shell_view);
+ if (current_path == NULL)
+ return NULL;
+
+ return get_type_for_folder (shell_view, current_path, NULL);
+}
+
/**
* e_shell_view_save_settings:
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index 86e5aa8498..a49d0cf337 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -94,13 +94,15 @@ void e_shell_view_set_folder_bar_mode (EShellView
EShellViewSubwindowMode mode);
EShellViewSubwindowMode e_shell_view_get_folder_bar_mode (EShellView *shell_view);
-ETaskBar *e_shell_view_get_task_bar (EShellView *shell_view);
-EShell *e_shell_view_get_shell (EShellView *shell_view);
-BonoboUIComponent *e_shell_view_get_bonobo_ui_component (EShellView *shell_view);
-BonoboUIContainer *e_shell_view_get_bonobo_ui_container (EShellView *shell_view);
-GtkWidget *e_shell_view_get_appbar (EShellView *shell_view);
-const char *e_shell_view_get_current_uri (EShellView *shell_view);
-const char *e_shell_view_get_current_path (EShellView *shell_view);
+ETaskBar *e_shell_view_get_task_bar (EShellView *shell_view);
+EShell *e_shell_view_get_shell (EShellView *shell_view);
+BonoboUIComponent *e_shell_view_get_bonobo_ui_component (EShellView *shell_view);
+BonoboUIContainer *e_shell_view_get_bonobo_ui_container (EShellView *shell_view);
+GtkWidget *e_shell_view_get_appbar (EShellView *shell_view);
+const char *e_shell_view_get_current_uri (EShellView *shell_view);
+const char *e_shell_view_get_current_physical_uri (EShellView *shell_view);
+const char *e_shell_view_get_current_folder_type (EShellView *shell_view);
+const char *e_shell_view_get_current_path (EShellView *shell_view);
gboolean e_shell_view_save_settings (EShellView *shell_view,
int view_num);
diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c
index 18b53da202..ce49e843d4 100644
--- a/shell/evolution-shell-component.c
+++ b/shell/evolution-shell-component.c
@@ -529,6 +529,8 @@ impl_populateFolderContextMenu (PortableServer_Servant servant,
static void
impl_userCreateNewItem (PortableServer_Servant servant,
const CORBA_char *id,
+ const CORBA_char *parent_physical_uri,
+ const CORBA_char *parent_type,
CORBA_Environment *ev)
{
EvolutionShellComponent *shell_component;
@@ -539,7 +541,7 @@ impl_userCreateNewItem (PortableServer_Servant servant,
/* FIXME: Check that the type is good. */
- gtk_signal_emit (GTK_OBJECT (shell_component), signals[USER_CREATE_NEW_ITEM], id);
+ gtk_signal_emit (GTK_OBJECT (shell_component), signals[USER_CREATE_NEW_ITEM], id, parent_physical_uri, parent_type);
}
@@ -640,8 +642,10 @@ class_init (EvolutionShellComponentClass *klass)
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, user_create_new_item),
- gtk_marshal_NONE__STRING,
- GTK_TYPE_NONE, 1,
+ gtk_marshal_NONE__POINTER_POINTER_POINTER,
+ GTK_TYPE_NONE, 3,
+ GTK_TYPE_STRING,
+ GTK_TYPE_STRING,
GTK_TYPE_STRING);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h
index 69a17f69a9..2505cf7e33 100644
--- a/shell/evolution-shell-component.h
+++ b/shell/evolution-shell-component.h
@@ -141,7 +141,9 @@ struct _EvolutionShellComponentClass {
const char *uri);
void (* user_create_new_item) (EvolutionShellComponent *shell_component,
- const char *id);
+ const char *id,
+ const char *parent_folder_physical_uri,
+ const char *parent_folder_type);
};
diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c
index 336912cb8c..b4ad8334a5 100644
--- a/shell/evolution-test-component.c
+++ b/shell/evolution-test-component.c
@@ -270,9 +270,12 @@ owner_unset_callback (EvolutionShellComponent *shell_component,
static void
user_create_new_item_callback (EvolutionShellComponent *shell_component,
- const char *id)
+ const char *id,
+ const char *parent_folder_physical_uri,
+ const char *parent_folder_type)
{
g_print ("\n*** Should create -- %s\n", id);
+ g_print ("\n\tType %s, URI %s\n", parent_folder_type, parent_folder_physical_uri);
}