diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-05-27 01:09:33 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-05-27 01:09:33 +0800 |
commit | c9ec8c3f4dce2b02c91268529977770364ef87fe (patch) | |
tree | d574f2be1b5438407e59e2fead1321766c9bbc83 /shell | |
parent | 6fec6bf39467dd32625847be1b021a7e5bc94d76 (diff) | |
parent | 96538878911586a9e9ca26b81e1916c04e538980 (diff) | |
download | gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.gz gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.bz2 gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.lz gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.xz gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.tar.zst gsoc2013-evolution-c9ec8c3f4dce2b02c91268529977770364ef87fe.zip |
Merge branch 'express2'
Diffstat (limited to 'shell')
-rw-r--r-- | shell/e-shell-meego.c | 97 | ||||
-rw-r--r-- | shell/e-shell-utils.c | 56 | ||||
-rw-r--r-- | shell/e-shell-utils.h | 5 | ||||
-rw-r--r-- | shell/e-shell-view.c | 22 | ||||
-rw-r--r-- | shell/e-shell-window-actions.c | 37 | ||||
-rw-r--r-- | shell/e-shell-window-private.c | 4 | ||||
-rw-r--r-- | shell/e-shell-window-private.h | 1 | ||||
-rw-r--r-- | shell/e-shell-window.c | 60 | ||||
-rw-r--r-- | shell/e-shell-window.h | 1 | ||||
-rw-r--r-- | shell/e-shell.c | 161 | ||||
-rw-r--r-- | shell/e-shell.h | 8 | ||||
-rw-r--r-- | shell/main.c | 12 |
12 files changed, 409 insertions, 55 deletions
diff --git a/shell/e-shell-meego.c b/shell/e-shell-meego.c index 3f024c4c99..0b54250498 100644 --- a/shell/e-shell-meego.c +++ b/shell/e-shell-meego.c @@ -37,15 +37,9 @@ void e_shell_detect_meego (gboolean *is_meego, gboolean *small_screen) #else void e_shell_detect_meego (gboolean *is_meego, gboolean *small_screen) { - GdkAtom wm_win, mob_atom; - Atom dummy_t; - unsigned long dummy_l; - gint dummy_i; - GdkScreen *screen; - GdkDisplay *display; Window *wm_window_v = NULL; guchar *moblin_string = NULL; - GModule *module; + GModule *module = NULL; /* * Wow - this is unpleasant, but it is hard to link directly * to the X libraries, and we have to use XGetWindowProperty @@ -60,46 +54,56 @@ void e_shell_detect_meego (gboolean *is_meego, gboolean *small_screen) *is_meego = *small_screen = FALSE; - if (!gdk_display_get_default ()) - return; - - wm_win = gdk_atom_intern ("_NET_SUPPORTING_WM_CHECK", TRUE); - mob_atom = gdk_atom_intern ("_MOBLIN", TRUE); - if (!wm_win || !mob_atom) - return; - - module = g_module_open (NULL, 0); - if (!module) - return; - g_module_symbol (module, "XFree", (gpointer) &fns.XFree); - g_module_symbol (module, "XGetWindowProperty", - (gpointer) &fns.XGetWindowProperty); - if (!fns.XFree || !fns.XGetWindowProperty) { - fprintf (stderr, "defective X server\n"); - goto exit; - } + moblin_string = (guchar *)g_getenv ("EVO_MEEGO"); + if (!moblin_string) { + GdkScreen *screen; + GdkDisplay *display; + GdkAtom wm_win, mob_atom; + Atom dummy_t; + unsigned long dummy_l; + gint dummy_i; + + if (!gdk_display_get_default ()) + return; + + wm_win = gdk_atom_intern ("_NET_SUPPORTING_WM_CHECK", TRUE); + mob_atom = gdk_atom_intern ("_MOBLIN", TRUE); + if (!wm_win || !mob_atom) + return; + + module = g_module_open (NULL, 0); + if (!module) + return; + g_module_symbol (module, "XFree", (gpointer) &fns.XFree); + g_module_symbol (module, "XGetWindowProperty", + (gpointer) &fns.XGetWindowProperty); + if (!fns.XFree || !fns.XGetWindowProperty) { + fprintf (stderr, "defective X server\n"); + goto exit; + } - display = gdk_display_get_default (); - screen = gdk_display_get_default_screen (gdk_display_get_default()); + display = gdk_display_get_default (); + screen = gdk_display_get_default_screen (gdk_display_get_default()); - gdk_error_trap_push (); + gdk_error_trap_push (); - /* get the window manager's supporting window */ - fns.XGetWindowProperty (gdk_x11_display_get_xdisplay (display), - GDK_WINDOW_XID (gdk_screen_get_root_window (screen)), - gdk_x11_atom_to_xatom_for_display (display, wm_win), - 0, 1, False, XA_WINDOW, &dummy_t, &dummy_i, - &dummy_l, &dummy_l, (guchar **)(&wm_window_v)); + /* get the window manager's supporting window */ + fns.XGetWindowProperty (gdk_x11_display_get_xdisplay (display), + GDK_WINDOW_XID (gdk_screen_get_root_window (screen)), + gdk_x11_atom_to_xatom_for_display (display, wm_win), + 0, 1, False, XA_WINDOW, &dummy_t, &dummy_i, + &dummy_l, &dummy_l, (guchar **)(&wm_window_v)); - /* get the '_Moblin' setting */ - if (wm_window_v && (*wm_window_v != None)) - fns.XGetWindowProperty (gdk_x11_display_get_xdisplay (display), *wm_window_v, - gdk_x11_atom_to_xatom_for_display (display, mob_atom), - 0, 8192, False, XA_STRING, - &dummy_t, &dummy_i, &dummy_l, &dummy_l, - &moblin_string); + /* get the '_Moblin' setting */ + if (wm_window_v && (*wm_window_v != None)) + fns.XGetWindowProperty (gdk_x11_display_get_xdisplay (display), *wm_window_v, + gdk_x11_atom_to_xatom_for_display (display, mob_atom), + 0, 8192, False, XA_STRING, + &dummy_t, &dummy_i, &dummy_l, &dummy_l, + &moblin_string); - gdk_error_trap_pop (); + gdk_error_trap_pop (); + } if (moblin_string) { gint i; @@ -123,14 +127,15 @@ void e_shell_detect_meego (gboolean *is_meego, gboolean *small_screen) g_strfreev (pair); } g_strfreev (props); - fns.XFree (moblin_string); + if (fns.XFree) + fns.XFree (moblin_string); } exit: if (wm_window_v) - fns.XFree (wm_window_v); - - g_module_close (module); + fns.XFree (wm_window_v); + if (module) + g_module_close (module); } #endif diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c index 4bc9c480cb..9fbb0bbca0 100644 --- a/shell/e-shell-utils.c +++ b/shell/e-shell-utils.c @@ -348,3 +348,59 @@ e_shell_utils_import_uris (EShell *shell, gchar **uris, gboolean preview) return g_strv_length (uris); } + +/** + * e_shell_hide_widgets_for_express_mode: + * @shell: an #EShell + * @builder: a #GtkBuilder + * @widget_name: NULL-terminated list of strings + * + * If Evolution is running in Express mode (i.e. if the specified @shell is + * in Express mode), then this function will hide a list of widgets, based + * on their specified names. The list of names must be NULL-terminated, + * and each element of that list must be the name of a widget present in + * @builder. Those widgets will then get hidden. + * + * This can be used to simplify preference dialogs and such in an easy + * fashion, for use in Express mode. + * + * If Evolution is not running in Express mode, this function does nothing. + */ +void +e_shell_hide_widgets_for_express_mode (EShell *shell, + GtkBuilder *builder, + const gchar *widget_name, + ...) +{ + va_list args; + const gchar *name; + + g_return_if_fail (E_IS_SHELL (shell)); + g_return_if_fail (GTK_IS_BUILDER (builder)); + g_return_if_fail (widget_name != NULL); + + if (!e_shell_get_express_mode (shell)) + return; + + va_start (args, widget_name); + + name = va_arg (args, const gchar *); + while (name) { + GObject *object; + + object = gtk_builder_get_object (builder, name); + if (!GTK_IS_WIDGET (object)) { + g_error ( + "Object '%s' was not found in the builder " + "file, or it is not a GtkWidget", name); + g_assert_not_reached (); + } + + gtk_widget_hide (GTK_WIDGET (object)); + + name = va_arg (args, const gchar *); + } + + va_end (args); +} + diff --git a/shell/e-shell-utils.h b/shell/e-shell-utils.h index 428d49a836..1b7202a5c5 100644 --- a/shell/e-shell-utils.h +++ b/shell/e-shell-utils.h @@ -50,6 +50,11 @@ guint e_shell_utils_import_uris (EShell *shell, gchar **uris, gboolean preview); +void e_shell_hide_widgets_for_express_mode (EShell *shell, + GtkBuilder *builder, + const gchar *widget_name, + ...) G_GNUC_NULL_TERMINATED; + G_END_DECLS #endif /* E_SHELL_UTILS_H */ diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index a8ece91adf..5d1c44ecc8 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -659,6 +659,28 @@ shell_view_construct_searchbar (EShellView *shell_view) gtk_toolbar_insert (GTK_TOOLBAR (main_toolbar), item, -1); + if (e_shell_get_small_screen_mode (shell)) { + GtkWidget *image; + GtkWidget *container; + GtkAction *action; + GtkToolItem *item; + + action = e_shell_window_get_action ( + shell_window, "close-window"); + image = gtk_image_new_from_icon_name ( + "window-close-hover", GTK_ICON_SIZE_DIALOG); + item = gtk_tool_button_new ( + image, gtk_action_get_label (action)); + gtk_widget_set_name (GTK_WIDGET (item), "MeeGoCloseButton"); + gtk_activatable_set_related_action ( + GTK_ACTIVATABLE (item), action); + container = e_shell_window_get_menu_bar_box (shell_window); + gtk_box_pack_start ( + GTK_BOX (container), + GTK_WIDGET (item), FALSE, FALSE, 0); + gtk_widget_show_all (GTK_WIDGET (item)); + } + return widget; } diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index 0f94dd08ec..606f125f33 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -930,10 +930,17 @@ action_preferences_cb (GtkAction *action, shell_backend = e_shell_view_get_shell_backend (shell_view); shell_backend_class = E_SHELL_BACKEND_GET_CLASS (shell_backend); - if (shell_backend_class->preferences_page != NULL) - e_preferences_window_show_page ( - E_PREFERENCES_WINDOW (preferences_window), - shell_backend_class->preferences_page); + if (shell_backend_class->preferences_page != NULL) { + if (e_shell_get_express_mode (shell)) { + e_preferences_window_filter_page ( + E_PREFERENCES_WINDOW (preferences_window), + shell_backend_class->preferences_page); + } else { + e_preferences_window_show_page ( + E_PREFERENCES_WINDOW (preferences_window), + shell_backend_class->preferences_page); + } + } } /** @@ -1450,6 +1457,20 @@ static GtkActionEntry shell_entries[] = { N_("Close this window"), G_CALLBACK (action_close_cb) }, + { "close-window-menu", + GTK_STOCK_CLOSE, + NULL, + "<Control>w", + N_("Close this window"), + G_CALLBACK (action_close_cb) }, + + { "close-window", + GTK_STOCK_CLOSE, + N_("_Close Window"), + "<Control>w", + N_("Close this window"), + G_CALLBACK (action_close_cb) }, + { "contents", GTK_STOCK_HELP, N_("_Contents"), @@ -2081,9 +2102,11 @@ e_shell_window_create_new_menu (EShellWindow *shell_window) /* Add menu separators. */ - separator = gtk_separator_menu_item_new (); - new_item_actions = g_list_prepend (new_item_actions, separator); - gtk_widget_show (GTK_WIDGET (separator)); + if (new_item_actions != NULL) { + separator = gtk_separator_menu_item_new (); + new_item_actions = g_list_prepend (new_item_actions, separator); + gtk_widget_show (GTK_WIDGET (separator)); + } if (new_source_actions != NULL) { separator = gtk_separator_menu_item_new (); diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c index a2b8ccec40..6e47132bc1 100644 --- a/shell/e-shell-window-private.c +++ b/shell/e-shell-window-private.c @@ -432,7 +432,9 @@ e_shell_window_private_constructed (EShellWindow *shell_window) object = G_OBJECT (shell_window); key = "/apps/evolution/shell/view_defaults/component_id"; - gconf_bridge_bind_property (bridge, key, object, "active-view"); + g_object_set (object, "active-view", + gconf_client_get_string (e_shell_get_gconf_client (shell), key, NULL), + NULL); object = G_OBJECT (priv->content_pane); key = "/apps/evolution/shell/view_defaults/folder_bar/width"; diff --git a/shell/e-shell-window-private.h b/shell/e-shell-window-private.h index 6050ce135d..02a688503e 100644 --- a/shell/e-shell-window-private.h +++ b/shell/e-shell-window-private.h @@ -93,6 +93,7 @@ struct _EShellWindowPrivate { GtkWidget *status_notebook; /* Miscellaneous */ + GtkWidget *menubar_box; /* Shell signal handlers. */ GArray *signal_handler_ids; diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index dfa3616642..9838f9c730 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -324,9 +324,15 @@ shell_window_finalize (GObject *object) static void shell_window_constructed (GObject *object) { - e_shell_window_private_constructed (E_SHELL_WINDOW (object)); + EShellWindow *shell_window = E_SHELL_WINDOW (object); + + e_shell_window_private_constructed (shell_window); e_extensible_load_extensions (E_EXTENSIBLE (object)); + + if (e_shell_get_meego_mode (shell_window->priv->shell) && + e_shell_get_small_screen_mode (shell_window->priv->shell)) + gtk_window_set_decorated (GTK_WINDOW (object), FALSE); } static GtkWidget * @@ -338,6 +344,23 @@ shell_window_construct_menubar (EShellWindow *shell_window) shell_window, "/main-menu"); gtk_widget_show (main_menu); + if (e_shell_get_small_screen_mode (shell_window->priv->shell)) { + GtkWidget *parent, *child; + + parent = gtk_widget_get_parent (main_menu); + g_object_ref (parent); + gtk_container_remove ((GtkContainer *)parent, main_menu); + child = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start ((GtkBox *)child, main_menu, TRUE, TRUE, 0); + gtk_widget_show (child); + gtk_container_add ((GtkContainer *)parent, child); + shell_window->priv->menubar_box = child; + + e_mutual_binding_new (main_menu, "visible", + child, "visible"); + main_menu = child; + } + g_signal_connect ( shell_window, "notify::active-view", G_CALLBACK (shell_window_menubar_update_new_menu), NULL); @@ -345,6 +368,12 @@ shell_window_construct_menubar (EShellWindow *shell_window) return main_menu; } +GtkWidget * +e_shell_window_get_menu_bar_box (EShellWindow *shell_window) +{ + return shell_window->priv->menubar_box; +} + static GtkWidget * shell_window_construct_toolbar (EShellWindow *shell_window) { @@ -365,6 +394,9 @@ shell_window_construct_toolbar (EShellWindow *shell_window) toolbar = e_shell_window_get_managed_widget ( shell_window, "/main-toolbar"); + if (e_shell_get_meego_mode (shell_window->priv->shell)) + gtk_widget_set_name (GTK_WIDGET (toolbar), "MeeGoToolbar"); + /* XXX Having this separator in the UI definition doesn't work * because GtkUIManager is unaware of the "New" button, so * it makes the separator invisible. One possibility is to @@ -399,6 +431,15 @@ shell_window_construct_toolbar (EShellWindow *shell_window) shell_window, "/search-toolbar"); gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE); gtk_box_pack_start (GTK_BOX (box), toolbar, FALSE, FALSE, 0); + if (e_shell_get_meego_mode (shell_window->priv->shell)) + gtk_widget_set_name (GTK_WIDGET (toolbar), "MeeGoToolbar"); + + toolbar = e_shell_window_get_managed_widget ( + shell_window, "/close-toolbar"); + gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE); + gtk_box_pack_start (GTK_BOX (box), toolbar, FALSE, FALSE, 0); + if (e_shell_get_meego_mode (shell_window->priv->shell)) + gtk_widget_set_name (GTK_WIDGET (toolbar), "MeeGoToolbar"); return box; } @@ -605,9 +646,23 @@ shell_window_create_shell_view (EShellWindow *shell_window, } static void +shell_window_realize (GtkWidget *widget) +{ + EShellWindow *shell_window; + + shell_window = E_SHELL_WINDOW (widget); + e_shell_adapt_window_size (shell_window->priv->shell, + GTK_WINDOW (widget)); + + /* Chain up to parent's dispose() method. */ + GTK_WIDGET_CLASS (e_shell_window_parent_class)->realize (widget); +} + +static void e_shell_window_class_init (EShellWindowClass *class) { GObjectClass *object_class; + GtkWidgetClass *widget_class; g_type_class_add_private (class, sizeof (EShellWindowPrivate)); @@ -618,6 +673,9 @@ e_shell_window_class_init (EShellWindowClass *class) object_class->finalize = shell_window_finalize; object_class->constructed = shell_window_constructed; + widget_class = GTK_WIDGET_CLASS (class); + widget_class->realize = shell_window_realize; + class->construct_menubar = shell_window_construct_menubar; class->construct_toolbar = shell_window_construct_toolbar; class->construct_sidebar = shell_window_construct_sidebar; diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h index 58401b2dba..9baa3cf8e9 100644 --- a/shell/e-shell-window.h +++ b/shell/e-shell-window.h @@ -146,6 +146,7 @@ void e_shell_window_register_new_source_actions const gchar *backend_name, GtkActionEntry *entries, guint n_entries); +GtkWidget * e_shell_window_get_menu_bar_box (EShellWindow *shell_window); G_END_DECLS diff --git a/shell/e-shell.c b/shell/e-shell.c index ab7d683bed..60bbe30526 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -62,17 +62,23 @@ struct _EShellPrivate { gchar *geometry; gchar *module_directory; + gchar *startup_view; + guint auto_reconnect : 1; guint network_available : 1; guint online : 1; guint quit_cancelled : 1; guint safe_mode : 1; guint express_mode : 1; + guint meego_mode : 1; + guint small_screen_mode : 1; }; enum { PROP_0, PROP_EXPRESS_MODE, + PROP_MEEGO_MODE, + PROP_SMALL_SCREEN_MODE, PROP_GEOMETRY, PROP_MODULE_DIRECTORY, PROP_NETWORK_AVAILABLE, @@ -471,6 +477,18 @@ shell_set_express_mode (EShell *shell, } static void +shell_set_meego_mode (EShell *shell, gboolean is_meego) +{ + shell->priv->meego_mode = is_meego; +} + +static void +shell_set_small_screen_mode (EShell *shell, gboolean small_screen) +{ + shell->priv->small_screen_mode = small_screen; +} + +static void shell_set_geometry (EShell *shell, const gchar *geometry) { @@ -501,6 +519,18 @@ shell_set_property (GObject *object, g_value_get_boolean (value)); return; + case PROP_MEEGO_MODE: + shell_set_meego_mode ( + E_SHELL (object), + g_value_get_boolean (value)); + return; + + case PROP_SMALL_SCREEN_MODE: + shell_set_small_screen_mode ( + E_SHELL (object), + g_value_get_boolean (value)); + return; + case PROP_GEOMETRY: shell_set_geometry ( E_SHELL (object), @@ -542,6 +572,18 @@ shell_get_property (GObject *object, E_SHELL (object))); return; + case PROP_MEEGO_MODE: + g_value_set_boolean ( + value, e_shell_get_meego_mode ( + E_SHELL (object))); + return; + + case PROP_SMALL_SCREEN_MODE: + g_value_set_boolean ( + value, e_shell_get_small_screen_mode ( + E_SHELL (object))); + return; + case PROP_MODULE_DIRECTORY: g_value_set_string ( value, e_shell_get_module_directory ( @@ -577,6 +619,11 @@ shell_dispose (GObject *object) priv = E_SHELL_GET_PRIVATE (object); + if (priv->startup_view != NULL) { + g_free (priv->startup_view); + priv->startup_view = NULL; + } + if (priv->settings != NULL) { g_object_unref (priv->settings); priv->settings = NULL; @@ -789,6 +836,40 @@ e_shell_class_init (EShellClass *class) G_PARAM_CONSTRUCT_ONLY)); /** + * EShell:meego + * + * Are we running under meego - if so, adapt ourselves + * to fit in well with their theming. + **/ + g_object_class_install_property ( + object_class, + PROP_MEEGO_MODE, + g_param_spec_boolean ( + "meego-mode", + "Meego Mode", + "Whether meego mode is enabled", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + /** + * EShell:small-screen + * + * Are we running with a small (1024x600) screen - if so, start + * throwing the babies overboard to fit onto that screen size. + **/ + g_object_class_install_property ( + object_class, + PROP_SMALL_SCREEN_MODE, + g_param_spec_boolean ( + "small-screen-mode", + "Small Screen Mode", + "Whether we run on a rather small screen", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + /** * EShell:geometry * * User-specified initial window geometry string to apply @@ -1079,6 +1160,8 @@ e_shell_init (EShell *shell) shell->priv->backends_by_scheme = backends_by_scheme; shell->priv->safe_mode = e_file_lock_exists (); + shell->priv->startup_view = NULL; + g_object_ref_sink (shell->priv->preferences_window); /* Add our icon directory to the theme's search path @@ -1580,6 +1663,38 @@ e_shell_get_express_mode (EShell *shell) } /** + * e_shell_get_meego_mode: + * @shell: an #EShell + * + * Returns %TRUE if Evolution is in MeeGo mode. + * + * Returns: %TRUE if Evolution is in MeeGo mode + **/ +gboolean +e_shell_get_meego_mode (EShell *shell) +{ + g_return_val_if_fail (E_IS_SHELL (shell), FALSE); + + return shell->priv->meego_mode; +} + +/** + * e_shell_get_small_screen_mode: + * @shell: an #EShell + * + * Returns %TRUE if Evolution is in small (netbook) screen mode. + * + * Returns: %TRUE if Evolution is in small screen mode + **/ +gboolean +e_shell_get_small_screen_mode (EShell *shell) +{ + g_return_val_if_fail (E_IS_SHELL (shell), FALSE); + + return shell->priv->small_screen_mode; +} + +/** * e_shell_get_module_directory: * @shell: an #EShell * @@ -1797,3 +1912,49 @@ e_shell_cancel_quit (EShell *shell) g_signal_stop_emission (shell, signals[QUIT_REQUESTED], 0); } + +/** + * e_shell_adapt_window_size: + * @shell: an #EShell + * @window: a #GtkWindow to adapt to full-screen + * + * This is used to adapt to window's size to be optimal for + * the platform. The shell settings are used to determine if + * a window should be set to full screen etc. + * + * This method is best called when the widget is realized on + * a given screen. + **/ +void +e_shell_adapt_window_size (EShell *shell, + GtkWindow *window) +{ + gint monitor; + GdkScreen *scr; + GdkRectangle rect; + + if (!e_shell_get_meego_mode (shell) || + !e_shell_get_small_screen_mode (shell)) + return; + + scr = gdk_screen_get_default (); + monitor = gdk_screen_get_monitor_at_window (scr, GTK_WIDGET (window)->window); + gdk_screen_get_monitor_geometry (scr, monitor, &rect); + + gtk_window_set_default_size (window, rect.width, rect.height); + gtk_window_set_decorated (window, FALSE); + gtk_window_maximize (window); +} + +void +e_shell_set_startup_view (EShell *shell, + const gchar *view) +{ + shell->priv->startup_view = g_strdup(view); +} + +const gchar * +e_shell_get_startup_view (EShell *shell) +{ + return shell->priv->startup_view; +} diff --git a/shell/e-shell.h b/shell/e-shell.h index adc0ffd126..f1d76b9ea6 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -108,7 +108,9 @@ GList * e_shell_get_watched_windows (EShell *shell); GtkWindow * e_shell_get_active_window (EShell *shell); void e_shell_send_receive (EShell *shell, GtkWindow *parent); +gboolean e_shell_get_meego_mode (EShell *shell); gboolean e_shell_get_express_mode (EShell *shell); +gboolean e_shell_get_small_screen_mode (EShell *shell); const gchar * e_shell_get_module_directory (EShell *shell); gboolean e_shell_get_network_available (EShell *shell); void e_shell_set_network_available (EShell *shell, @@ -123,6 +125,12 @@ void e_shell_event (EShell *shell, gboolean e_shell_quit (EShell *shell); void e_shell_cancel_quit (EShell *shell); +void e_shell_adapt_window_size (EShell *shell, + GtkWindow *window); +void e_shell_set_startup_view (EShell *shell, + const gchar *view); +const gchar * e_shell_get_startup_view (EShell *shell); + G_END_DECLS #endif /* E_SHELL_H */ diff --git a/shell/main.c b/shell/main.c index f42f0647cf..4824cfcf8c 100644 --- a/shell/main.c +++ b/shell/main.c @@ -49,6 +49,7 @@ #include "e-shell.h" #include "e-shell-migrate.h" +#include "e-shell-meego.h" #include "es-event.h" #include "e-util/e-dialog-utils.h" @@ -362,6 +363,7 @@ create_default_shell (void) gboolean online = TRUE; const gchar *key; GError *error = NULL; + gboolean is_meego = FALSE, small_screen = FALSE; client = gconf_client_get_default (); @@ -396,6 +398,9 @@ create_default_shell (void) if (!express_mode) express_mode = gconf_client_get_bool (client, key, &error); + if (express_mode) + e_shell_detect_meego (&is_meego, &small_screen); + if (error != NULL) { g_warning ("%s", error->message); g_clear_error (&error); @@ -406,7 +411,9 @@ create_default_shell (void) "name", "org.gnome.Evolution", "geometry", geometry, "module-directory", EVOLUTION_MODULEDIR, + "meego-mode", is_meego, "express-mode", express_mode, + "small-screen-mode", small_screen, "online", online, NULL); @@ -585,6 +592,11 @@ main (gint argc, gchar **argv) e_plugin_load_plugins (); } + if (requested_view) + e_shell_set_startup_view(shell, requested_view); + else if (express_mode) + e_shell_set_startup_view(shell, "mail"); + /* Attempt migration -after- loading all modules and plugins, * as both shell backends and certain plugins hook into this. */ e_shell_migrate_attempt (shell); |