aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>2000-01-19 15:57:20 +0800
committerArturo Espinosa <unammx@src.gnome.org>2000-01-19 15:57:20 +0800
commit711ce9920ad6ca4f9ffd8a246d70acc574f2ae39 (patch)
tree7cd058083b3ea1df671ea3aefeff2a5a49532dac /shell
parentd44875ac5f2dfc7753cc33281c5fc8a866edd0b7 (diff)
downloadgsoc2013-evolution-711ce9920ad6ca4f9ffd8a246d70acc574f2ae39.tar.gz
gsoc2013-evolution-711ce9920ad6ca4f9ffd8a246d70acc574f2ae39.tar.zst
gsoc2013-evolution-711ce9920ad6ca4f9ffd8a246d70acc574f2ae39.zip
More work on the code. Added more for the framework.
More work on the code. Added more for the framework. Miguel. svn path=/trunk/; revision=1593
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-shortcut.c99
-rw-r--r--shell/e-shell-view.c58
-rw-r--r--shell/e-shell-view.h8
-rw-r--r--shell/main.c7
4 files changed, 104 insertions, 68 deletions
diff --git a/shell/e-shell-shortcut.c b/shell/e-shell-shortcut.c
index a04171bdd2..56671dccd3 100644
--- a/shell/e-shell-shortcut.c
+++ b/shell/e-shell-shortcut.c
@@ -12,35 +12,35 @@
#include <gnome.h>
#include "shortcut-bar/e-shortcut-bar.h"
#include "e-shell-shortcut.h"
+#include "e-shell-view.h"
#define SMALL_ICONS 1
#define LARGE_ICONS 2
+typedef struct {
+ EShellView *eshell_view;
+ EShortcutGroup *sg;
+} closure_group_t;
+
static void
-set_large_icons (GtkMenuItem *menu_item, EShellView *eshell_view)
+set_large_icons (GtkMenuItem *menu_item, closure_group_t *closure)
{
- EShortcutGroup *sg = gtk_object_get_data (GTK_OBJECT (menu_item), "shortcut_group");
-
- g_assert (sg != NULL);
- e_shortcut_group_set_view_type (sg, E_ICON_BAR_LARGE_ICONS);
+ e_shortcut_group_set_view_type (closure->sg, E_ICON_BAR_LARGE_ICONS);
}
static void
-set_small_icons (GtkMenu *menu_item, EShellView *eshell_view)
+set_small_icons (GtkMenu *menu_item, closure_group_t *closure)
{
- EShortcutGroup *sg = gtk_object_get_data (GTK_OBJECT (menu_item), "shortcut_group");
-
- g_assert (sg != NULL);
- e_shortcut_group_set_view_type (sg, E_ICON_BAR_SMALL_ICONS);
+ e_shortcut_group_set_view_type (closure->sg, E_ICON_BAR_SMALL_ICONS);
}
static void
-add_group (GtkMenu *menu, EShellView *eshell_view)
+add_group (GtkMenu *menu, closure_group_t *closure)
{
int group_num;
GtkWidget *entry;
- group_num = e_shortcut_bar_model_add_group (eshell_view->eshell->shortcut_bar);
+ group_num = e_shortcut_bar_model_add_group (closure->eshell_view->eshell->shortcut_bar);
/*
* FIXME: Figure out why this does not quite work
@@ -49,19 +49,15 @@ add_group (GtkMenu *menu, EShellView *eshell_view)
gtk_widget_show (entry);
e_group_bar_set_group_button_label (
- E_GROUP_BAR (eshell_view->shortcut_bar),
+ E_GROUP_BAR (closure->eshell_view->shortcut_bar),
group_num,
entry);
}
static void
-remove_group (GtkMenuItem *menu_item, EShellView *eshell_view)
+remove_group (GtkMenuItem *menu_item, closure_group_t *closure)
{
- EShortcutGroup *sg = gtk_object_get_data (GTK_OBJECT (menu_item), "shortcut_group");
-
- g_assert (sg != NULL);
-
- e_shortcut_bar_model_remove_group (eshell_view->eshell->shortcut_bar, sg);
+ e_shortcut_bar_model_remove_group (closure->eshell_view->eshell->shortcut_bar, closure->sg);
}
static void
@@ -71,16 +67,13 @@ do_rename (GtkEntry *entry, EShortcutGroup *sg)
}
static void
-rename_group (GtkMenuItem *menu_item, EShellView *eshell_view)
+rename_group (GtkMenuItem *menu_item, closure_group_t *closure)
{
- EShortcutGroup *sg = gtk_object_get_data (GTK_OBJECT (menu_item), "shortcut_group");
GtkWidget *entry;
int item;
- g_assert (sg != NULL);
-
- item = e_group_num_from_group_ptr (eshell_view->eshell->shortcut_bar, sg);
- e_shortcut_group_rename (sg, "Dum de da");
+ item = e_group_num_from_group_ptr (closure->eshell_view->eshell->shortcut_bar, closure->sg);
+ e_shortcut_group_rename (closure->sg, "Ren Test");
return;
@@ -88,13 +81,13 @@ rename_group (GtkMenuItem *menu_item, EShellView *eshell_view)
gtk_widget_show (entry);
gtk_widget_grab_focus (entry);
- gtk_signal_connect (GTK_OBJECT (entry), "activate", GTK_SIGNAL_FUNC (do_rename), sg);
+ gtk_signal_connect (GTK_OBJECT (entry), "activate", GTK_SIGNAL_FUNC (do_rename), closure->sg);
- e_group_bar_set_group_button_label (E_GROUP_BAR (eshell_view->shortcut_bar), item, entry);
+ e_group_bar_set_group_button_label (E_GROUP_BAR (closure->eshell_view->shortcut_bar), item, entry);
}
static void
-add_shortcut (GtkMenu *menu, EShellView *eshell_view)
+add_shortcut (GtkMenu *menu, closure_group_t *closure)
{
}
@@ -120,9 +113,13 @@ shortcut_bar_show_standard_popup (EShellView *eshell_view, GdkEvent *event, ESho
{
GtkWidget *menu, *menuitem;
int i;
+ closure_group_t closure;
menu = gtk_menu_new ();
+ closure.sg = shortcut_group;
+ closure.eshell_view = eshell_view;
+
for (i = 0; i < ELEMENTS (shortcut_menu); i++){
gboolean disable = FALSE;
@@ -148,10 +145,7 @@ shortcut_bar_show_standard_popup (EShellView *eshell_view, GdkEvent *event, ESho
gtk_signal_connect (
GTK_OBJECT (menuitem), "activate",
- shortcut_menu [i].callback, eshell_view);
- gtk_object_set_data (
- GTK_OBJECT (menuitem), "shortcut_group",
- shortcut_group);
+ shortcut_menu [i].callback, &closure);
}
gtk_signal_connect (GTK_OBJECT (menu), "deactivate",
@@ -165,29 +159,41 @@ shortcut_bar_show_standard_popup (EShellView *eshell_view, GdkEvent *event, ESho
gtk_object_destroy (GTK_OBJECT (menu));
}
+typedef struct {
+ EShellView *eshell_view;
+ EShortcutGroup *sg;
+ EShortcut *shortcut;
+} closure_context_t;
+
static void
-shortcut_open (GtkMenuItem *menuitem, EShellView *eshell_view)
+shortcut_open (GtkMenuItem *menuitem, closure_context_t *closure)
{
+ e_shell_view_set_view (closure->eshell_view, closure->shortcut->efolder);
}
static void
-shortcut_open_new_window (GtkMenuItem *menuitem, EShellView *eshell_view)
+shortcut_open_new_window (GtkMenuItem *menuitem, closure_context_t *closure)
{
+ GtkWidget *toplevel;
+
+ toplevel = e_shell_view_new (closure->eshell_view->eshell, closure->shortcut->efolder, FALSE);
+ gtk_widget_show (toplevel);
}
static void
-shortcut_remove (GtkMenuItem *menuitem, EShellView *eshell_view)
+shortcut_remove (GtkMenuItem *menuitem, closure_context_t *closure)
{
+ e_shortcut_group_remove (closure->sg, closure->shortcut);
}
static void
-shortcut_rename (GtkMenuItem *menuitem, EShellView *eshell_view)
+shortcut_rename (GtkMenuItem *menuitem, closure_context_t *closure)
{
printf ("Implement: %s %s\n", __FILE__, __FUNCTION__);
}
static void
-shortcut_properties (GtkMenuItem *menuitem, EShellView *eshell_view)
+shortcut_properties (GtkMenuItem *menuitem, closure_context_t *closure)
{
printf ("Implement: %s %s\n", __FILE__, __FUNCTION__);
}
@@ -210,14 +216,20 @@ static struct {
};
static void
-shortcut_bar_show_context_popup (EShellView *eshell_view, GdkEvent *event, EShortcutGroup *shortcut_group)
+shortcut_bar_show_context_popup (EShellView *eshell_view, GdkEvent *event,
+ EShortcutGroup *shortcut_group, EShortcut *shortcut)
{
+ closure_context_t closure;
GtkWidget *menu, *menuitem;
int i;
gboolean disable;
menu = gtk_menu_new ();
+ closure.eshell_view = eshell_view;
+ closure.sg = shortcut_group;
+ closure.shortcut = shortcut;
+
for (i = 0; i < ELEMENTS (context_shortcut_menu); i++){
disable = FALSE;
@@ -259,10 +271,7 @@ shortcut_bar_show_context_popup (EShellView *eshell_view, GdkEvent *event, EShor
gtk_signal_connect (
GTK_OBJECT (menuitem), "activate",
- context_shortcut_menu [i].callback, eshell_view);
- gtk_object_set_data (
- GTK_OBJECT (menuitem), "shortcut_group",
- shortcut_group);
+ context_shortcut_menu [i].callback, &closure);
}
gtk_signal_connect (GTK_OBJECT (menu), "deactivate",
@@ -291,11 +300,11 @@ shortcut_bar_item_selected (EShortcutBar *e_shortcut_bar,
shortcut = e_shortcut_from_pos (shortcut_group, item_num);
- if (group_num == -1)
+ if (shortcut == NULL)
return;
if (event->button.button == 1) {
- printf ("Item Selected - %i:%i", group_num + 1, item_num + 1);
+ e_shell_view_set_view (eshell_view, shortcut->efolder);
} else if (event->button.button == 3) {
if (shortcut == NULL)
@@ -303,7 +312,7 @@ shortcut_bar_item_selected (EShortcutBar *e_shortcut_bar,
eshell_view, event, shortcut_group);
else
shortcut_bar_show_context_popup (
- eshell_view, event, shortcut_group);
+ eshell_view, event, shortcut_group, shortcut);
}
}
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 300a996959..bdbc34238b 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -65,8 +65,43 @@ e_shell_view_setup_shortcut_display (EShellView *eshell_view)
GTK_SIGNAL_FUNC (shortcut_bar_item_selected), eshell_view);
}
+static GtkWidget *
+get_view (EFolder *efolder)
+{
+ GtkWidget *w;
+ char buffer [80];
+
+ sprintf (buffer, "I am the view for %s\n",
+ e_folder_get_description (efolder));
+
+ w = gtk_label_new (buffer);
+
+ gtk_widget_show (w);
+
+ return w;
+}
+
+void
+e_shell_view_set_view (EShellView *eshell_view, EFolder *efolder)
+{
+ GtkWidget *w = get_view (efolder);
+
+ if (eshell_view->contents){
+ gtk_widget_destroy (eshell_view->contents);
+ }
+
+ eshell_view->contents = w;
+
+ if (eshell_view->shortcut_displayed){
+ gtk_paned_pack2 (GTK_PANED (eshell_view->shortcut_hpaned),
+ eshell_view->contents, FALSE, TRUE);
+ } else {
+ gnome_app_set_contents (GNOME_APP (eshell_view), eshell_view->contents);
+ }
+}
+
GtkWidget *
-e_shell_view_new (EShell *eshell, gboolean show_shortcut_bar)
+e_shell_view_new (EShell *eshell, EFolder *efolder, gboolean show_shortcut_bar)
{
EShellView *eshell_view;
@@ -79,30 +114,15 @@ e_shell_view_new (EShell *eshell, gboolean show_shortcut_bar)
e_shell_view_setup_menus (eshell_view);
e_shell_register_view (eshell, eshell_view);
-
- if (show_shortcut_bar){
- e_shell_view_setup_shortcut_display (eshell_view);
- } else {
- g_error ("Non-shortcut bar code not written yet");
- }
-
-
eshell_view->shortcut_displayed = show_shortcut_bar;
+ e_shell_view_setup_shortcut_display (eshell_view);
+
+ e_shell_view_set_view (eshell_view, efolder);
return (GtkWidget *) eshell_view;
}
void
-e_shell_view_set_view (EShellView *eshell_view, EFolder *efolder)
-{
- if (efolder == NULL){
- printf ("Display executive summary");
- } else {
-
- }
-}
-
-void
e_shell_view_display_shortcut_bar (EShellView *eshell_view, gboolean display)
{
g_return_if_fail (eshell_view != NULL);
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index 4011cfc6ac..b8737a5fc8 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -20,7 +20,9 @@ struct _EShellView {
/* Our user interface handler */
GnomeUIHandler *uih;
- /*
+
+ EFolder *efolder;
+/*
*
*/
char shortcut_displayed;
@@ -33,7 +35,8 @@ typedef struct {
GnomeAppClass parent_class;
} EShellViewClass;
-GtkWidget *e_shell_view_new (EShell *eshell, gboolean show_shortcut_bar);
+GtkWidget *e_shell_view_new (EShell *eshell, EFolder *folder,
+ gboolean show_shortcut_bar);
GtkType e_shell_view_get_type (void);
void e_shell_view_new_folder (EShellView *esv);
@@ -41,6 +44,7 @@ void e_shell_view_new_shortcut (EShellView *esv);
void e_shell_view_set_view (EShellView *eshell_view,
EFolder *efolder);
+
void e_shell_view_display_shortcut_bar (EShellView *eshell_view, gboolean display);
#endif /* E_SHELL_VIEW_H */
diff --git a/shell/main.c b/shell/main.c
index 688591014e..1d30bbad7d 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -67,9 +67,12 @@ static void
evolution_boot (void)
{
EShellView *e_shell_view;
-
+
eshell = e_shell_new ();
- e_shell_view = E_SHELL_VIEW (e_shell_view_new (eshell, TRUE));
+ e_shell_view = E_SHELL_VIEW (
+ e_shell_view_new (eshell,
+ eshell->default_folders.inbox,
+ TRUE));
gtk_widget_show (GTK_WIDGET (e_shell_view));
}