aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-09-19 05:10:23 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-09-19 05:10:23 +0800
commit0c27b4ab1b75a29a0ea2b2c6ae3a568663179bdf (patch)
treefacfeee294e47aab5fc57c0c86aa0dea96d13f16
parent979203663083ef89f678dc1e95bc0c9b24f55a9e (diff)
downloadgsoc2013-evolution-0c27b4ab1b75a29a0ea2b2c6ae3a568663179bdf.tar
gsoc2013-evolution-0c27b4ab1b75a29a0ea2b2c6ae3a568663179bdf.tar.gz
gsoc2013-evolution-0c27b4ab1b75a29a0ea2b2c6ae3a568663179bdf.tar.bz2
gsoc2013-evolution-0c27b4ab1b75a29a0ea2b2c6ae3a568663179bdf.tar.lz
gsoc2013-evolution-0c27b4ab1b75a29a0ea2b2c6ae3a568663179bdf.tar.xz
gsoc2013-evolution-0c27b4ab1b75a29a0ea2b2c6ae3a568663179bdf.tar.zst
gsoc2013-evolution-0c27b4ab1b75a29a0ea2b2c6ae3a568663179bdf.zip
Finally got the "Current View" menu under control.
svn path=/branches/kill-bonobo/; revision=36380
-rw-r--r--addressbook/gui/component/e-book-shell-view-actions.c27
-rw-r--r--addressbook/gui/component/e-book-shell-view-private.c51
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c560
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h6
-rw-r--r--doc/reference/shell/Makefile.am1
-rw-r--r--shell/e-shell-taskbar.c335
-rw-r--r--shell/e-shell-taskbar.h86
-rw-r--r--shell/e-shell-window-actions.c24
-rw-r--r--shell/e-shell-window-private.h1
-rw-r--r--shell/e-shell-window.c2
10 files changed, 783 insertions, 310 deletions
diff --git a/addressbook/gui/component/e-book-shell-view-actions.c b/addressbook/gui/component/e-book-shell-view-actions.c
index 814b69d82c..9a26608d84 100644
--- a/addressbook/gui/component/e-book-shell-view-actions.c
+++ b/addressbook/gui/component/e-book-shell-view-actions.c
@@ -385,6 +385,23 @@ action_contact_send_message_cb (GtkAction *action,
}
static void
+action_gal_save_custom_view_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EShellView *shell_view;
+ EAddressbookView *address_view;
+ GalViewInstance *view_instance;
+
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ address_view = e_book_shell_view_get_current_view (book_shell_view);
+ view_instance = e_addressbook_view_get_view_instance (address_view);
+ gal_view_instance_save_as (view_instance);
+}
+
+static void
action_search_execute_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
@@ -741,6 +758,10 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view)
g_object_set (action, "short-label", _("Delete"), NULL);
g_signal_connect (
+ ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
+ G_CALLBACK (action_gal_save_custom_view_cb), book_shell_view);
+
+ g_signal_connect (
ACTION (SEARCH_EXECUTE), "activate",
G_CALLBACK (action_search_execute_cb), book_shell_view);
}
@@ -775,8 +796,10 @@ e_book_shell_view_actions_update (EBookShellView *book_shell_view)
editable = e_addressbook_model_get_editable (model);
selection_model = e_addressbook_view_get_selection_model (view);
- n_contacts = e_selection_model_row_count (selection_model);
- n_selected = e_selection_model_selected_count (selection_model);
+ n_contacts = (selection_model != NULL) ?
+ e_selection_model_row_count (selection_model) : 0;
+ n_selected = (selection_model != NULL) ?
+ e_selection_model_selected_count (selection_model) : 0;
action = ACTION (ADDRESS_BOOK_STOP);
sensitive = e_addressbook_model_can_stop (model);
diff --git a/addressbook/gui/component/e-book-shell-view-private.c b/addressbook/gui/component/e-book-shell-view-private.c
index ce995a1859..94bc96588a 100644
--- a/addressbook/gui/component/e-book-shell-view-private.c
+++ b/addressbook/gui/component/e-book-shell-view-private.c
@@ -99,6 +99,7 @@ selection_change (EBookShellView *book_shell_view,
EAddressbookView *current_view;
ESelectionModel *selection_model;
EABContactDisplay *display;
+ gint n_selected;
current_view = e_book_shell_view_get_current_view (book_shell_view);
@@ -110,7 +111,10 @@ selection_change (EBookShellView *book_shell_view,
display = EAB_CONTACT_DISPLAY (book_shell_view->priv->preview);
selection_model = e_addressbook_view_get_selection_model (view);
- if (e_selection_model_selected_count (selection_model) == 1)
+ n_selected = (selection_model != NULL) ?
+ e_selection_model_selected_count (selection_model) : 0;
+
+ if (n_selected == 1)
e_selection_model_foreach (
selection_model, (EForeachFunc)
book_shell_view_selection_change_foreach,
@@ -181,28 +185,25 @@ static void
book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
ESourceSelector *selector)
{
+ EShellView *shell_view;
EAddressbookView *view;
EAddressbookModel *model;
ESource *source;
+ GalViewInstance *view_instance;
GHashTable *hash_table;
GtkNotebook *notebook;
GtkWidget *widget;
const gchar *uid;
+ gchar *view_id;
gint page_num;
+ shell_view = E_SHELL_VIEW (book_shell_view);
notebook = GTK_NOTEBOOK (book_shell_view->priv->notebook);
source = e_source_selector_peek_primary_selection (selector);
if (source == NULL)
return;
- /* XXX Add some get/set functions to EAddressbookView:
- *
- * eab_view_get_book() / eab_view_set_book()
- * eab_view_get_type() / eab_view_set_type()
- * eab_view_get_source() / eab_view_set_source()
- */
-
uid = e_source_peek_uid (source);
hash_table = book_shell_view->priv->uid_to_view;
widget = g_hash_table_lookup (hash_table, uid);
@@ -225,13 +226,10 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
}
} else {
- EShellView *shell_view;
EBook *book;
/* Create a view for this UID. */
- shell_view = E_SHELL_VIEW (book_shell_view);
widget = e_addressbook_view_new (shell_view, source);
- g_object_set (widget, "type", E_ADDRESSBOOK_VIEW_TABLE, NULL);
gtk_widget_show (widget);
g_object_ref_sink (widget);
@@ -275,6 +273,11 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
page_num = gtk_notebook_page_num (notebook, widget);
gtk_notebook_set_current_page (notebook, page_num);
+ view_instance = e_addressbook_view_get_view_instance (view);
+ view_id = gal_view_instance_get_current_view_id (view_instance);
+ e_shell_view_set_view_id (shell_view, view_id);
+ g_free (view_id);
+
e_addressbook_model_force_folder_bar_message (model);
selection_change (book_shell_view, view);
}
@@ -367,6 +370,28 @@ book_shell_view_load_view_collection (EShellViewClass *shell_view_class)
gal_view_collection_load (collection);
}
+static void
+book_shell_view_notify_view_id_cb (EBookShellView *book_shell_view)
+{
+ EAddressbookView *address_view;
+ GalViewInstance *view_instance;
+ const gchar *view_id;
+
+ address_view = e_book_shell_view_get_current_view (book_shell_view);
+ view_instance = e_addressbook_view_get_view_instance (address_view);
+ view_id = e_shell_view_get_view_id (E_SHELL_VIEW (book_shell_view));
+
+ /* A NULL view ID implies we're in a custom view. But you can
+ * only get to a custom view via the "Define Views" dialog, which
+ * would have already modified the view instance appropriately.
+ * Furthermore, there's no way to refer to a custom view by ID
+ * anyway, since custom views have no IDs. */
+ if (view_id == NULL)
+ return;
+
+ gal_view_instance_set_current_view_id (view_instance, view_id);
+}
+
void
e_book_shell_view_private_init (EBookShellView *book_shell_view,
EShellViewClass *shell_view_class)
@@ -399,6 +424,10 @@ e_book_shell_view_private_init (EBookShellView *book_shell_view,
if (!gal_view_collection_loaded (shell_view_class->view_collection))
book_shell_view_load_view_collection (shell_view_class);
+
+ g_signal_connect (
+ book_shell_view, "notify::view-id",
+ G_CALLBACK (book_shell_view_notify_view_id_cb), NULL);
}
void
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index ca25548c56..7a4f27d65f 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -63,8 +63,6 @@
#define d(x)
-static void change_view_type (EAddressbookView *view, EAddressbookViewType view_type);
-
static void status_message (GtkObject *object, const gchar *status, EAddressbookView *view);
static void search_result (EAddressbookView *view, EBookViewStatus status);
static void folder_bar_message (EAddressbookView *view, const gchar *status);
@@ -77,7 +75,6 @@ static void command_state_change (EAddressbookView *view);
struct _EAddressbookViewPrivate {
gpointer shell_view; /* weak pointer */
- EAddressbookViewType view_type;
EAddressbookModel *model;
GList *clipboard_contacts;
@@ -95,8 +92,7 @@ enum {
PROP_0,
PROP_MODEL,
PROP_SHELL_VIEW,
- PROP_SOURCE,
- PROP_TYPE
+ PROP_SOURCE
};
enum {
@@ -135,6 +131,243 @@ addressbook_view_emit_selection_change (EAddressbookView *view)
}
static void
+table_double_click (ETableScrolled *table,
+ gint row,
+ gint col,
+ GdkEvent *event,
+ EAddressbookView *view)
+{
+ EAddressbookModel *model;
+ EContact *contact;
+ EBook *book;
+ gboolean editable;
+
+ if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER (view->priv->object))
+ return;
+
+ model = view->priv->model;
+ contact = e_addressbook_model_get_contact (model, row);
+ editable = e_addressbook_model_get_editable (model);
+ book = e_addressbook_model_get_book (model);
+ g_return_if_fail (E_IS_BOOK (book));
+
+ if (e_contact_get (contact, E_CONTACT_IS_LIST))
+ eab_show_contact_list_editor (book, contact, FALSE, editable);
+ else
+ eab_show_contact_editor (book, contact, FALSE, editable);
+
+ g_object_unref (contact);
+}
+
+static gint
+table_right_click (ETableScrolled *table,
+ gint row,
+ gint col,
+ GdkEvent *event,
+ EAddressbookView *view)
+{
+ addressbook_view_emit_popup_event (view, event);
+
+ return TRUE;
+}
+
+static gint
+table_white_space_event (ETableScrolled *table,
+ GdkEvent *event,
+ EAddressbookView *view)
+{
+ gint button = ((GdkEventButton *) event)->button;
+
+ if (event->type == GDK_BUTTON_PRESS && button == 3) {
+ addressbook_view_emit_popup_event (view, event);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+table_drag_data_get (ETable *table,
+ gint row,
+ gint col,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time,
+ gpointer user_data)
+{
+ EAddressbookView *view = user_data;
+ EAddressbookModel *model;
+ EBook *book;
+ GList *contact_list;
+ gchar *value;
+
+ if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER (view->priv->object))
+ return;
+
+ model = e_addressbook_view_get_model (view);
+ book = e_addressbook_model_get_book (model);
+
+ contact_list = get_selected_contacts (view);
+
+ switch (info) {
+ case DND_TARGET_TYPE_VCARD:
+ value = eab_contact_list_to_string (contact_list);
+
+ gtk_selection_data_set (
+ selection_data, selection_data->target,
+ 8, (guchar *)value, strlen (value));
+
+ g_free (value);
+ break;
+
+ case DND_TARGET_TYPE_SOURCE_VCARD:
+ value = eab_book_and_contact_list_to_string (
+ book, contact_list);
+
+ gtk_selection_data_set (
+ selection_data, selection_data->target,
+ 8, (guchar *)value, strlen (value));
+
+ g_free (value);
+ break;
+ }
+
+ g_list_foreach (contact_list, (GFunc) g_object_unref, NULL);
+ g_list_free (contact_list);
+}
+
+static void
+addressbook_view_create_table_view (EAddressbookView *view)
+{
+ ETableModel *adapter;
+ ETable *table;
+ GtkWidget *widget;
+ gchar *etspecfile;
+
+ adapter = eab_table_adapter_new (view->priv->model);
+
+ /* Here we create the table. We give it the three pieces of
+ the table we've created, the header, the model, and the
+ initial layout. It does the rest. */
+ etspecfile = g_build_filename (
+ EVOLUTION_ETSPECDIR, "e-addressbook-view.etspec", NULL);
+ widget = e_table_scrolled_new_from_spec_file (
+ adapter, NULL, etspecfile, NULL);
+ table = E_TABLE (E_TABLE_SCROLLED (widget)->table);
+ g_free (etspecfile);
+
+ view->priv->object = G_OBJECT (adapter);
+ view->priv->widget = widget;
+
+ g_signal_connect (
+ table, "double_click",
+ G_CALLBACK(table_double_click), view);
+ g_signal_connect (
+ table, "right_click",
+ G_CALLBACK(table_right_click), view);
+ g_signal_connect (
+ table, "white_space_event",
+ G_CALLBACK(table_white_space_event), view);
+ g_signal_connect_swapped (
+ table, "selection_change",
+ G_CALLBACK (addressbook_view_emit_selection_change), view);
+
+ e_table_drag_source_set (
+ table, GDK_BUTTON1_MASK,
+ drag_types, G_N_ELEMENTS (drag_types),
+ GDK_ACTION_MOVE | GDK_ACTION_COPY);
+
+ g_signal_connect (
+ table, "table_drag_data_get",
+ G_CALLBACK (table_drag_data_get), view);
+
+ gtk_box_pack_start (GTK_BOX (view), widget, TRUE, TRUE, 0);
+
+ gtk_widget_show (widget);
+}
+
+static void
+addressbook_view_create_minicard_view (EAddressbookView *view)
+{
+ GtkWidget *scrolled_window;
+ GtkWidget *minicard_view;
+ EAddressbookReflowAdapter *adapter;
+
+ adapter = E_ADDRESSBOOK_REFLOW_ADAPTER (
+ e_addressbook_reflow_adapter_new (view->priv->model));
+ minicard_view = e_minicard_view_widget_new (adapter);
+
+ g_signal_connect_swapped (
+ minicard_view, "selection_change",
+ G_CALLBACK (addressbook_view_emit_selection_change), view);
+
+ g_signal_connect_swapped (
+ minicard_view, "right_click",
+ G_CALLBACK (addressbook_view_emit_popup_event), view);
+
+ scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+ view->priv->object = G_OBJECT (minicard_view);
+ view->priv->widget = scrolled_window;
+
+ gtk_container_add (GTK_CONTAINER (scrolled_window), minicard_view);
+ gtk_widget_show (minicard_view);
+
+ gtk_widget_show_all (scrolled_window);
+
+ gtk_box_pack_start (GTK_BOX (view), scrolled_window, TRUE, TRUE, 0);
+
+ e_reflow_model_changed (E_REFLOW_MODEL (adapter));
+}
+
+static void
+addressbook_view_changed_cb (EAddressbookView *view,
+ GalViewInstance *view_instance)
+{
+ EShellView *shell_view;
+ gchar *view_id;
+
+ shell_view = e_addressbook_view_get_shell_view (view);
+ view_id = gal_view_instance_get_current_view_id (view_instance);
+ e_shell_view_set_view_id (shell_view, view_id);
+ g_free (view_id);
+}
+
+static void
+addressbook_view_display_view_cb (EAddressbookView *view,
+ GalView *gal_view)
+{
+ if (view->priv->widget != NULL) {
+ gtk_container_remove (
+ GTK_CONTAINER (view),
+ view->priv->widget);
+ view->priv->widget = NULL;
+ }
+ view->priv->object = NULL;
+
+ if (GAL_IS_VIEW_ETABLE (gal_view)) {
+ addressbook_view_create_table_view (view);
+ gal_view_etable_attach_table (
+ GAL_VIEW_ETABLE (gal_view),
+ e_table_scrolled_get_table (
+ E_TABLE_SCROLLED (view->priv->widget)));
+ }
+ else if (GAL_IS_VIEW_MINICARD (gal_view)) {
+ addressbook_view_create_minicard_view (view);
+ gal_view_minicard_attach (
+ GAL_VIEW_MINICARD (gal_view), view);
+ }
+
+ command_state_change (view);
+}
+
+static void
addressbook_view_selection_get_cb (EAddressbookView *view,
GtkSelectionData *selection_data,
guint info,
@@ -233,8 +466,6 @@ addressbook_view_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- EAddressbookView *view = E_ADDRESSBOOK_VIEW (object);
-
switch (property_id){
case PROP_SHELL_VIEW:
addressbook_view_set_shell_view (
@@ -247,10 +478,6 @@ addressbook_view_set_property (GObject *object,
E_ADDRESSBOOK_VIEW (object),
g_value_get_object (value));
return;
-
- case PROP_TYPE:
- change_view_type(view, g_value_get_int (value));
- return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -262,8 +489,6 @@ addressbook_view_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- EAddressbookView *view = E_ADDRESSBOOK_VIEW (object);
-
switch (property_id) {
case PROP_MODEL:
g_value_set_object (
@@ -282,10 +507,6 @@ addressbook_view_get_property (GObject *object,
value, e_addressbook_view_get_source (
E_ADDRESSBOOK_VIEW (object)));
return;
-
- case PROP_TYPE:
- g_value_set_int (value, view->priv->view_type);
- return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -345,6 +566,7 @@ addressbook_view_constructed (GObject *object)
EShellView *shell_view;
EShellViewClass *shell_view_class;
GalViewCollection *view_collection;
+ GalViewInstance *view_instance;
ESource *source;
gchar *uri;
@@ -355,8 +577,15 @@ addressbook_view_constructed (GObject *object)
source = e_addressbook_view_get_source (view);
uri = e_source_get_uri (source);
- view->priv->view_instance =
- gal_view_instance_new (view_collection, uri);
+ view_instance = gal_view_instance_new (view_collection, uri);
+ g_signal_connect_swapped (
+ view_instance, "changed",
+ G_CALLBACK (addressbook_view_changed_cb), view);
+ g_signal_connect_swapped (
+ view_instance, "display-view",
+ G_CALLBACK (addressbook_view_display_view_cb), view);
+ gal_view_instance_load (view_instance);
+ view->priv->view_instance = view_instance;
g_free (uri);
}
@@ -407,18 +636,6 @@ addressbook_view_class_init (EAddressbookViewClass *class)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (
- object_class,
- PROP_TYPE,
- g_param_spec_int (
- "type",
- _("Type"),
- NULL,
- E_ADDRESSBOOK_VIEW_NONE,
- E_ADDRESSBOOK_VIEW_TABLE,
- E_ADDRESSBOOK_VIEW_NONE,
- G_PARAM_READWRITE));
-
signals[POPUP_EVENT] = g_signal_new (
"popup-event",
G_OBJECT_CLASS_TYPE (object_class),
@@ -471,8 +688,6 @@ addressbook_view_init (EAddressbookView *view)
view->priv->model = e_addressbook_model_new ();
- view->priv->view_type = E_ADDRESSBOOK_VIEW_NONE;
-
view->priv->invisible = gtk_invisible_new ();
gtk_selection_add_target (
@@ -590,31 +805,33 @@ e_addressbook_view_get_view_widget (EAddressbookView *view)
ESelectionModel *
e_addressbook_view_get_selection_model (EAddressbookView *view)
{
- EAddressbookViewType view_type;
+ GalView *gal_view;
+ GalViewInstance *view_instance;
+ ESelectionModel *model = NULL;
g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), NULL);
- view_type = view->priv->view_type;
+ view_instance = e_addressbook_view_get_view_instance (view);
+ gal_view = gal_view_instance_get_current_view (view_instance);
- if (view_type == E_ADDRESSBOOK_VIEW_TABLE) {
+ if (GAL_IS_VIEW_ETABLE (gal_view)) {
ETableScrolled *scrolled_table;
ETable *table;
scrolled_table = E_TABLE_SCROLLED (view->priv->widget);
table = e_table_scrolled_get_table (scrolled_table);
- return e_table_get_selection_model (table);
- }
+ model = e_table_get_selection_model (table);
- if (view_type == E_ADDRESSBOOK_VIEW_MINICARD) {
+ } else if (GAL_IS_VIEW_MINICARD (gal_view)) {
EMinicardViewWidget *widget;
widget = E_MINICARD_VIEW_WIDGET (view->priv->object);
- return e_minicard_view_widget_get_selection_model (widget);
+ model = e_minicard_view_widget_get_selection_model (widget);
}
- g_return_val_if_reached (NULL);
+ return model;
}
EShellView *
@@ -634,123 +851,6 @@ e_addressbook_view_get_source (EAddressbookView *view)
}
static void
-display_view(GalViewInstance *instance,
- GalView *view,
- gpointer data)
-{
- EAddressbookView *address_view = data;
- if (GAL_IS_VIEW_ETABLE(view)) {
- change_view_type (address_view, E_ADDRESSBOOK_VIEW_TABLE);
- gal_view_etable_attach_table (
- GAL_VIEW_ETABLE (view),
- e_table_scrolled_get_table (
- E_TABLE_SCROLLED (address_view->priv->widget)));
- }
- else if (GAL_IS_VIEW_MINICARD(view)) {
- change_view_type (address_view, E_ADDRESSBOOK_VIEW_MINICARD);
- gal_view_minicard_attach (
- GAL_VIEW_MINICARD (view), address_view);
- }
-}
-
-static void
-table_double_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EAddressbookView *view)
-{
- EAddressbookModel *model;
- EContact *contact;
- EBook *book;
- gboolean editable;
-
- if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER (view->priv->object))
- return;
-
- model = view->priv->model;
- contact = e_addressbook_model_get_contact (model, row);
- editable = e_addressbook_model_get_editable (model);
- book = e_addressbook_model_get_book (model);
- g_return_if_fail (E_IS_BOOK (book));
-
- if (e_contact_get (contact, E_CONTACT_IS_LIST))
- eab_show_contact_list_editor (book, contact, FALSE, editable);
- else
- eab_show_contact_editor (book, contact, FALSE, editable);
-
- g_object_unref (contact);
-}
-
-static gint
-table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EAddressbookView *view)
-{
- addressbook_view_emit_popup_event (view, event);
- return TRUE;
-}
-
-static gint
-table_white_space_event(ETableScrolled *table, GdkEvent *event, EAddressbookView *view)
-{
- if (event->type == GDK_BUTTON_PRESS && ((GdkEventButton *)event)->button == 3) {
- addressbook_view_emit_popup_event (view, event);
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-static void
-table_drag_data_get (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer user_data)
-{
- EAddressbookView *view = user_data;
- EAddressbookModel *model;
- EBook *book;
- GList *contact_list;
-
- if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->priv->object))
- return;
-
- model = e_addressbook_view_get_model (view);
- book = e_addressbook_model_get_book (model);
-
- contact_list = get_selected_contacts (view);
-
- switch (info) {
- case DND_TARGET_TYPE_VCARD: {
- char *value;
-
- value = eab_contact_list_to_string (contact_list);
-
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8,
- (guchar *)value, strlen (value));
- g_free (value);
- break;
- }
- case DND_TARGET_TYPE_SOURCE_VCARD: {
- char *value;
-
- value = eab_book_and_contact_list_to_string (book, contact_list);
-
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8,
- (guchar *)value, strlen (value));
- g_free (value);
- break;
- }
- }
-
- g_list_foreach (contact_list, (GFunc) g_object_unref, NULL);
- g_list_free (contact_list);
-}
-
-static void
emit_status_message (EAddressbookView *view, const gchar *status)
{
g_signal_emit (view, signals[STATUS_MESSAGE], 0, status);
@@ -802,7 +902,6 @@ stop_state_changed (GtkObject *object, EAddressbookView *view)
static void
command_state_change (EAddressbookView *view)
{
- /* Reffing during emission is unnecessary. Gtk automatically refs during an emission. */
g_signal_emit (view, signals[COMMAND_STATE_CHANGE], 0);
}
@@ -827,123 +926,6 @@ backend_died (EAddressbookView *view)
}
static void
-create_minicard_view (EAddressbookView *view)
-{
- GtkWidget *scrolled_window;
- GtkWidget *minicard_view;
- EAddressbookReflowAdapter *adapter;
-
- adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(e_addressbook_reflow_adapter_new (view->priv->model));
- minicard_view = e_minicard_view_widget_new(adapter);
-
- g_signal_connect_swapped (
- minicard_view, "selection_change",
- G_CALLBACK (addressbook_view_emit_selection_change), view);
-
- g_signal_connect_swapped (
- minicard_view, "right_click",
- G_CALLBACK (addressbook_view_emit_popup_event), view);
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- view->priv->object = G_OBJECT(minicard_view);
- view->priv->widget = scrolled_window;
-
- gtk_container_add (GTK_CONTAINER (scrolled_window), minicard_view);
- gtk_widget_show (minicard_view);
-
- gtk_widget_show_all (scrolled_window);
-
- gtk_box_pack_start (GTK_BOX (view), scrolled_window, TRUE, TRUE, 0);
-
- e_reflow_model_changed (E_REFLOW_MODEL (adapter));
-}
-
-static void
-create_table_view (EAddressbookView *view)
-{
- ETableModel *adapter;
- GtkWidget *table;
- char *etspecfile;
-
- adapter = eab_table_adapter_new(view->priv->model);
-
- /* Here we create the table. We give it the three pieces of
- the table we've created, the header, the model, and the
- initial layout. It does the rest. */
- etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
- "e-addressbook-view.etspec",
- NULL);
- table = e_table_scrolled_new_from_spec_file (adapter, NULL, etspecfile, NULL);
- g_free (etspecfile);
-
- view->priv->object = G_OBJECT(adapter);
- view->priv->widget = table;
-
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "double_click",
- G_CALLBACK(table_double_click), view);
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "right_click",
- G_CALLBACK(table_right_click), view);
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "white_space_event",
- G_CALLBACK(table_white_space_event), view);
- g_signal_connect_swapped (
- e_table_scrolled_get_table (E_TABLE_SCROLLED(table)),
- "selection_change", G_CALLBACK (
- addressbook_view_emit_selection_change), view);
-
- /* drag & drop signals */
- e_table_drag_source_set (
- E_TABLE (E_TABLE_SCROLLED(table)->table),
- GDK_BUTTON1_MASK, drag_types,
- G_N_ELEMENTS (drag_types),
- GDK_ACTION_MOVE | GDK_ACTION_COPY);
-
- g_signal_connect (E_TABLE_SCROLLED(table)->table,
- "table_drag_data_get",
- G_CALLBACK (table_drag_data_get),
- view);
-
- gtk_box_pack_start (GTK_BOX (view), table, TRUE, TRUE, 0);
-
- gtk_widget_show (table);
-}
-
-static void
-change_view_type (EAddressbookView *view,
- EAddressbookViewType view_type)
-{
- if (view_type == view->priv->view_type)
- return;
-
- if (view->priv->widget) {
- gtk_container_remove (
- GTK_CONTAINER (view), view->priv->widget);
- view->priv->widget = NULL;
- }
- view->priv->object = NULL;
-
- switch (view_type) {
- case E_ADDRESSBOOK_VIEW_TABLE:
- create_table_view (view);
- break;
- case E_ADDRESSBOOK_VIEW_MINICARD:
- create_minicard_view (view);
- break;
- default:
- g_warning ("view_type not recognized.");
- return;
- }
-
- view->priv->view_type = view_type;
-
- command_state_change (view);
-}
-
-static void
contact_print_button_draw_page (GtkPrintOperation *operation,
GtkPrintContext *context,
gint page_nr,
@@ -989,9 +971,15 @@ void
e_addressbook_view_print (EAddressbookView *view,
GtkPrintOperationAction action)
{
+ GalView *gal_view;
+ GalViewInstance *view_instance;
+
g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
- if (view->priv->view_type == E_ADDRESSBOOK_VIEW_MINICARD) {
+ view_instance = e_addressbook_view_get_view_instance (view);
+ gal_view = gal_view_instance_get_current_view (view_instance);
+
+ if (GAL_IS_VIEW_MINICARD (gal_view)) {
EAddressbookModel *model;
EBook *book;
EBookQuery *query;
@@ -1016,7 +1004,7 @@ e_addressbook_view_print (EAddressbookView *view,
if (query != NULL)
e_book_query_unref (query);
- } else if (view->priv->view_type == E_ADDRESSBOOK_VIEW_TABLE) {
+ } else if (GAL_IS_VIEW_ETABLE (gal_view)) {
EPrintable *printable;
ETable *table;
@@ -1034,7 +1022,8 @@ e_addressbook_view_print (EAddressbookView *view,
/* callback function to handle removal of contacts for
* which a user doesnt have write permission
*/
-static void delete_contacts_cb (EBook *book, EBookStatus status, gpointer closure)
+static void
+delete_contacts_cb (EBook *book, EBookStatus status, gpointer closure)
{
switch(status) {
case E_BOOK_ERROR_OK :
@@ -1061,12 +1050,17 @@ e_addressbook_view_delete_selection(EAddressbookView *view, gboolean is_delete)
EBook *book;
EMinicardView *card_view;
ESelectionModel *selection_model = NULL;
+ GalViewInstance *view_instance;
+ GalView *gal_view;
char *name = NULL;
gint row = 0, select;
model = e_addressbook_view_get_model (view);
book = e_addressbook_model_get_book (model);
+ view_instance = e_addressbook_view_get_view_instance (view);
+ gal_view = gal_view_instance_get_current_view (view_instance);
+
list = get_selected_contacts (view);
contact = list->data;
@@ -1078,13 +1072,13 @@ e_addressbook_view_delete_selection(EAddressbookView *view, gboolean is_delete)
if (e_contact_get (contact, E_CONTACT_IS_LIST))
is_list = TRUE;
- if (view->priv->view_type == E_ADDRESSBOOK_VIEW_MINICARD) {
+ if (GAL_IS_VIEW_MINICARD (gal_view)) {
card_view = e_minicard_view_widget_get_view (E_MINICARD_VIEW_WIDGET(view->priv->object));
selection_model = e_addressbook_view_get_selection_model (view);
row = e_selection_model_cursor_row (selection_model);
}
- else if (view->priv->view_type == E_ADDRESSBOOK_VIEW_TABLE) {
+ else if (GAL_IS_VIEW_ETABLE (gal_view)) {
etable = e_table_scrolled_get_table (
E_TABLE_SCROLLED(view->priv->widget));
row = e_table_get_cursor_row (E_TABLE (etable));
@@ -1129,7 +1123,7 @@ e_addressbook_view_delete_selection(EAddressbookView *view, gboolean is_delete)
}
/* Sets the cursor, at the row after the deleted row */
- if (view->priv->view_type == E_ADDRESSBOOK_VIEW_MINICARD && row!=0) {
+ if (GAL_IS_VIEW_MINICARD (gal_view) && row != 0) {
select = e_sorter_model_to_sorted (selection_model->sorter, row);
/* Sets the cursor, before the deleted row if its the last row */
@@ -1143,7 +1137,7 @@ e_addressbook_view_delete_selection(EAddressbookView *view, gboolean is_delete)
}
/* Sets the cursor, at the row after the deleted row */
- else if (view->priv->view_type == E_ADDRESSBOOK_VIEW_TABLE && row!=0) {
+ else if (GAL_IS_VIEW_ETABLE (gal_view) && row != 0) {
select = e_table_model_to_view_row (E_TABLE (etable), row);
/* Sets the cursor, before the deleted row if its the last row */
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index 93d67a2a22..743e873dc2 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -51,12 +51,6 @@
G_BEGIN_DECLS
-typedef enum {
- E_ADDRESSBOOK_VIEW_NONE, /* initialized to this */
- E_ADDRESSBOOK_VIEW_MINICARD,
- E_ADDRESSBOOK_VIEW_TABLE,
-} EAddressbookViewType;
-
typedef struct _EAddressbookView EAddressbookView;
typedef struct _EAddressbookViewClass EAddressbookViewClass;
typedef struct _EAddressbookViewPrivate EAddressbookViewPrivate;
diff --git a/doc/reference/shell/Makefile.am b/doc/reference/shell/Makefile.am
index f277a4feae..f41e71b303 100644
--- a/doc/reference/shell/Makefile.am
+++ b/doc/reference/shell/Makefile.am
@@ -73,7 +73,6 @@ GTKDOC_LIBS= \
$(top_builddir)/shell/es-event.o \
$(top_builddir)/shell/.libs/e-activity-handler.o \
$(top_builddir)/shell/.libs/e-shell-content.o \
- $(top_builddir)/shell/.libs/e-shell-marshal.o \
$(top_builddir)/shell/.libs/e-shell-module.o \
$(top_builddir)/shell/.libs/e-shell-sidebar.o \
$(top_builddir)/shell/.libs/e-shell-switcher.o \
diff --git a/shell/e-shell-taskbar.c b/shell/e-shell-taskbar.c
new file mode 100644
index 0000000000..f9c293d7c9
--- /dev/null
+++ b/shell/e-shell-taskbar.c
@@ -0,0 +1,335 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shell-taskbar.c
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-shell-taskbar.h"
+
+#include <e-shell-view.h>
+
+#define E_SHELL_TASKBAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SHELL_TASKBAR, EShellTaskbarPrivate))
+
+struct _EShellTaskbarPrivate {
+
+ gpointer shell_view; /* weak pointer */
+
+ GtkWidget *label;
+ GtkWidget *hbox;
+};
+
+enum {
+ PROP_0,
+ PROP_SHELL_VIEW
+};
+
+static gpointer parent_class;
+
+static void
+shell_taskbar_set_shell_view (EShellTaskbar *shell_taskbar,
+ EShellView *shell_view)
+{
+ g_return_if_fail (shell_taskbar->priv->shell_view == NULL);
+
+ shell_taskbar->priv->shell_view = shell_view;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_view),
+ &shell_taskbar->priv->shell_view);
+}
+
+static void
+shell_taskbar_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL_VIEW:
+ shell_taskbar_set_shell_view (
+ E_SHELL_TASKBAR (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_taskbar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL_VIEW:
+ g_value_set_object (
+ value, e_shell_taskbar_get_shell_view (
+ E_SHELL_TASKBAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_taskbar_dispose (GObject *object)
+{
+ EShellTaskbarPrivate *priv;
+
+ priv = E_SHELL_TASKBAR_GET_PRIVATE (object);
+
+ if (priv->shell_view != NULL) {
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->shell_view), &priv->shell_view);
+ priv->shell_view = NULL;
+ }
+
+ if (priv->label != NULL) {
+ g_object_unref (priv->label);
+ priv->label = NULL;
+ }
+
+ if (priv->hbox != NULL) {
+ g_object_unref (priv->hbox);
+ priv->hbox = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+shell_taskbar_class_init (EShellTaskbarClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EShellTaskbarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = shell_taskbar_set_property;
+ object_class->get_property = shell_taskbar_get_property;
+ object_class->dispose = shell_taskbar_dispose;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_VIEW,
+ g_param_spec_object (
+ "shell-view",
+ NULL,
+ NULL,
+ E_TYPE_SHELL_VIEW,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+shell_taskbar_init (EShellTaskbar *shell_taskbar)
+{
+ GtkWidget *widget;
+ gint height;
+
+ shell_taskbar->priv = E_SHELL_TASKBAR_GET_PRIVATE (shell_taskbar);
+
+ gtk_box_set_spacing (GTK_BOX (shell_taskbar), 12);
+
+ widget = gtk_label_new (NULL);
+ gtk_label_set_ellipsize (GTK_LABEL (widget), PANGO_ELLIPSIZE_END);
+ gtk_box_pack_start (GTK_BOX (shell_taskbar), widget, TRUE, TRUE, 0);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ shell_taskbar->priv->label = g_object_ref (widget);
+ gtk_widget_hide (widget);
+
+ widget = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (shell_taskbar), widget, TRUE, TRUE, 0);
+ shell_taskbar->priv->hbox = g_object_ref (widget);
+ gtk_widget_hide (widget);
+
+ /* Make the taskbar large enough to accomodate a small icon.
+ * XXX The "* 2" is a fudge factor to allow for some padding
+ * The true value is probably buried in a style property. */
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &height);
+ gtk_widget_set_size_request (
+ GTK_WIDGET (shell_taskbar), -1, height * 2);
+}
+
+GType
+e_shell_taskbar_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EShellTaskbarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) shell_taskbar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EShellTaskbar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) shell_taskbar_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_HBOX, "EShellTaskbar", &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_shell_taskbar_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_SHELL_TASKBAR, "shell-view", shell_view, NULL);
+}
+
+EShellView *
+e_shell_taskbar_get_shell_view (EShellTaskbar *shell_taskbar)
+{
+ g_return_val_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar), NULL);
+
+ return shell_taskbar->priv->shell_view;
+}
+
+void
+e_shell_taskbar_set_message (EShellTaskbar *shell_taskbar,
+ const gchar *message)
+{
+ GtkWidget *label;
+
+ g_return_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar));
+
+ label = shell_taskbar->priv->label;
+ message = (message == NULL) ? message : "";
+ gtk_label_set_text (GTK_LABEL (label), message);
+
+ if (*message != '\0')
+ gtk_widget_show (label);
+ else
+ gtk_widget_hide (label);
+}
+
+void
+e_shell_taskbar_unset_message (EShellTaskbar *shell_taskbar)
+{
+ g_return_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar));
+
+ e_shell_taskbar_set_message (shell_taskbar, NULL);
+}
+
+void
+e_shell_taskbar_prepend_task (EShellTaskbar *shell_taskbar,
+ ETaskWidget *task_widget)
+{
+ GtkBox *box;
+ GtkWidget *child;
+
+ g_return_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar));
+ g_return_if_fail (E_IS_TASK_WIDGET (task_widget));
+
+ child = GTK_WIDGET (task_widget);
+ box = GTK_BOX (shell_taskbar->priv->hbox);
+ gtk_box_pack_start (box, child, TRUE, TRUE, 0);
+ gtk_box_reorder_child (box, child, 0);
+ gtk_widget_show (GTK_WIDGET (box));
+}
+
+void
+e_shell_taskbar_remove_task (EShellTaskbar *shell_taskbar,
+ gint position)
+{
+ ETaskWidget *task_widget;
+ GtkBox *box;
+
+ g_return_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar));
+ g_return_if_fail (position >= 0);
+
+ task_widget = e_shell_taskbar_get_task_widget (
+ shell_taskbar, position);
+ gtk_widget_destroy (GTK_WIDGET (task_widget));
+
+ box = GTK_BOX (shell_taskbar->priv->hbox);
+ if (box->children == NULL)
+ gtk_widget_hide (GTK_WIDGET (box));
+}
+
+ETaskWidget *
+e_shell_taskbar_get_task_widget_from_id (EShellTaskbar *shell_taskbar,
+ guint task_id)
+{
+ GtkBox *box;
+ GList *iter;
+
+ g_return_val_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar), NULL);
+
+ box = GTK_BOX (shell_taskbar->priv->hbox);
+
+ for (iter = box->children; iter != NULL; iter = iter->next) {
+ GtkBoxChild *child_info = iter->data;
+ ETaskWidget *task_widget;
+
+ task_widget = E_TASK_WIDGET (child_info->widget);
+
+ if (task_widget->id == task_id)
+ return task_widget;
+ }
+
+ return NULL;
+}
+
+void
+e_shell_taskbar_remove_task_from_id (EShellTaskbar *shell_taskbar,
+ guint task_id)
+{
+ ETaskWidget *task_widget;
+ GtkBox *box;
+
+ g_return_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar));
+
+ task_widget = e_shell_taskbar_get_task_widget_from_id (
+ shell_taskbar, task_id);
+ g_return_if_fail (task_widget != NULL);
+
+ gtk_widget_destroy (GTK_WIDGET (task_widget));
+
+ box = GTK_BOX (shell_taskbar->priv->hbox);
+ if (box->children == NULL)
+ gtk_widget_hide (GTK_WIDGET (box));
+}
+
+ETaskWidget *
+e_shell_taskbar_get_task_widget (EShellTaskbar *shell_taskbar,
+ gint position)
+{
+ GtkBoxChild *child_info;
+ GtkBox *box;
+
+ g_return_val_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar), NULL);
+
+ box = GTK_BOX (shell_taskbar->priv->hbox);
+ child_info = g_list_nth (box->children, position)->data;
+
+ return E_TASK_WIDGET (child_info->widget);
+}
diff --git a/shell/e-shell-taskbar.h b/shell/e-shell-taskbar.h
new file mode 100644
index 0000000000..6e51985996
--- /dev/null
+++ b/shell/e-shell-taskbar.h
@@ -0,0 +1,86 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shell-taskbar.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef E_SHELL_TASKBAR_H
+#define E_SHELL_TASKBAR_H
+
+#include <gtk/gtk.h>
+#include <widgets/misc/e-task-widget.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SHELL_TASKBAR \
+ (e_shell_taskbar_get_type ())
+#define E_SHELL_TASKBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SHELL_TASKBAR, EShellTaskbar))
+#define E_SHELL_TASKBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SHELL_TASKBAR, EShellTaskbarClass))
+#define E_IS_SHELL_TASKBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SHELL_TASKBAR))
+#define E_IS_SHELL_TASKBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SHELL_TASKBAR))
+#define E_SHELL_TASKBAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SHELL_TASKBAR, EShellTaskbarClass))
+
+G_BEGIN_DECLS
+
+/* Avoid including <e-shell-view.h> */
+struct _EShellView;
+
+typedef struct _EShellTaskbar EShellTaskbar;
+typedef struct _EShellTaskbarClass EShellTaskbarClass;
+typedef struct _EShellTaskbarPrivate EShellTaskbarPrivate;
+
+struct _EShellTaskbar {
+ GtkHBox parent;
+ EShellTaskbarPrivate *priv;
+};
+
+struct _EShellTaskbarClass {
+ GtkHBoxClass parent_class;
+};
+
+GType e_shell_taskbar_get_type (void);
+GtkWidget * e_shell_taskbar_new (struct _EShellView *shell_view);
+struct _EShellView *
+ e_shell_taskbar_get_shell_view (EShellTaskbar *shell_taskbar);
+void e_shell_taskbar_set_message (EShellTaskbar *shell_taskbar,
+ const gchar *message);
+void e_shell_taskbar_unset_message (EShellTaskbar *shell_taskbar);
+void e_shell_taskbar_prepend_task (EShellTaskbar *shell_taskbar,
+ ETaskWidget *task_widget);
+void e_shell_taskbar_remove_task (EShellTaskbar *shell_taskbar,
+ gint position);
+ETaskWidget * e_shell_taskbar_get_task_widget_from_id
+ (EShellTaskbar *shell_taskbar,
+ guint task_id);
+void e_shell_taskbar_remove_task_from_id
+ (EShellTaskbar *shell_taskbar,
+ guint task_id);
+ETaskWidget * e_shell_taskbar_get_task_widget (EShellTaskbar *shell_taskbar,
+ gint position);
+
+G_END_DECLS
+
+#endif /* E_SHELL_TASKBAR_H */
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index b13c6785b1..f03c775b3d 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -718,9 +718,11 @@ action_gal_define_views_cb (GtkAction *action,
g_return_if_fail (view_collection != NULL);
dialog = gal_define_views_dialog_new (view_collection);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
- gal_view_collection_save (view_collection);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gal_view_collection_save (view_collection);
gtk_widget_destroy (dialog);
+
+ e_shell_window_update_view_menu (shell_window);
}
static void
@@ -1605,8 +1607,9 @@ e_shell_window_create_switcher_actions (EShellWindow *shell_window)
merge_id = gtk_ui_manager_new_merge_id (ui_manager);
/* Construct a group of radio actions from the various EShellView
- * subclasses and register them with our ESidebar. These actions
- * are manifested as switcher buttons and View->Window menu items.
+ * subclasses and register them with the EShellSwitcher. These
+ * actions are manifested as switcher buttons and View->Window
+ * menu items.
*
* Note: The shell window has already selected a view by now,
* so we have to be careful not to overwrite that when setting
@@ -1692,8 +1695,8 @@ e_shell_window_create_switcher_actions (EShellWindow *shell_window)
action, "changed",
G_CALLBACK (action_switcher_cb),
shell_window);
+ g_list_free (list);
}
- g_list_free (list);
g_free (children);
}
@@ -1742,6 +1745,12 @@ e_shell_window_update_view_menu (EShellWindow *shell_window)
count = gal_view_collection_get_count (view_collection);
path = "/main-menu/view-menu/gal-view-menu/gal-view-list";
+ /* Prevent spurious activations. */
+ action = ACTION (GAL_CUSTOM_VIEW);
+ g_signal_handlers_block_matched (
+ action, G_SIGNAL_MATCH_FUNC, 0, 0,
+ NULL, action_gal_view_cb, NULL);
+
/* Default to "Custom View", unless we find our view ID. */
radio_action = GTK_RADIO_ACTION (ACTION (GAL_CUSTOM_VIEW));
gtk_radio_action_set_group (radio_action, NULL);
@@ -1763,6 +1772,7 @@ e_shell_window_update_view_menu (EShellWindow *shell_window)
radio_action = gtk_radio_action_new (
action_name, item->title, tooltip, NULL, ii);
+ action = GTK_ACTION (radio_action);
gtk_radio_action_set_group (radio_action, radio_group);
radio_group = gtk_radio_action_get_group (radio_action);
@@ -1773,7 +1783,6 @@ e_shell_window_update_view_menu (EShellWindow *shell_window)
if (view_id != NULL && strcmp (item->id, view_id) == 0)
gtk_radio_action_set_current_value (radio_action, ii);
- action = GTK_ACTION (radio_action);
gtk_action_group_add_action (action_group, action);
gtk_ui_manager_add_ui (
@@ -1789,6 +1798,9 @@ e_shell_window_update_view_menu (EShellWindow *shell_window)
action = ACTION (GAL_CUSTOM_VIEW);
gtk_action_set_visible (action, visible);
+ g_signal_handlers_unblock_matched (
+ action, G_SIGNAL_MATCH_FUNC, 0, 0,
+ NULL, action_gal_view_cb, NULL);
action = ACTION (GAL_SAVE_CUSTOM_VIEW);
gtk_action_set_visible (action, visible);
diff --git a/shell/e-shell-window-private.h b/shell/e-shell-window-private.h
index 00eccaffbb..e496a9834e 100644
--- a/shell/e-shell-window-private.h
+++ b/shell/e-shell-window-private.h
@@ -113,6 +113,7 @@ void e_shell_window_switch_to_view (EShellWindow *shell_window,
GtkWidget * e_shell_window_create_new_menu (EShellWindow *shell_window);
void e_shell_window_create_switcher_actions
(EShellWindow *shell_window);
+void e_shell_window_update_gal_view (EShellWindow *shell_window);
void e_shell_window_update_icon (EShellWindow *shell_window);
void e_shell_window_update_title (EShellWindow *shell_window);
void e_shell_window_update_new_menu (EShellWindow *shell_window);
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 7cb7defa33..422101d549 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -87,7 +87,7 @@ shell_window_new_view (EShellWindow *shell_window,
/* Listen for changes that affect the shell window. */
g_signal_connect_swapped (
- action, "notify::icon_name",
+ action, "notify::icon-name",
G_CALLBACK (e_shell_window_update_icon), shell_window);
g_signal_connect_swapped (