aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2010-04-12 21:50:44 +0800
committerMichael Meeks <michael.meeks@novell.com>2010-04-12 21:50:44 +0800
commit2593383aec61d0b1f2f8950e5301f30176d2cbce (patch)
tree6e2d3e7f3a095ab349cb5a3cd9f8b957841f8b1f /shell
parentdae9d2e575e0a239c53d3079b8e20bd17f6c37b4 (diff)
downloadgsoc2013-evolution-2593383aec61d0b1f2f8950e5301f30176d2cbce.tar.gz
gsoc2013-evolution-2593383aec61d0b1f2f8950e5301f30176d2cbce.tar.zst
gsoc2013-evolution-2593383aec61d0b1f2f8950e5301f30176d2cbce.zip
Detect MeeGo, and propagate settings variously.
Adapt widget naming on MeeGo for theming etc.
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-window.c29
-rw-r--r--shell/e-shell.c139
-rw-r--r--shell/e-shell.h5
-rw-r--r--shell/main.c7
4 files changed, 179 insertions, 1 deletions
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index f6176c1a35..62c39fee37 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 *
@@ -365,6 +371,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
@@ -605,9 +614,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 +641,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;
@@ -625,6 +651,7 @@ e_shell_window_class_init (EShellWindowClass *class)
class->construct_taskbar = shell_window_construct_taskbar;
class->create_shell_view = shell_window_create_shell_view;
+
/**
* EShellWindow:active-view
*
diff --git a/shell/e-shell.c b/shell/e-shell.c
index f877bca4ec..3859b2971a 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -68,11 +68,15 @@ struct _EShellPrivate {
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 +475,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 +517,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 +570,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 (
@@ -789,6 +829,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
@@ -1580,6 +1654,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 +1903,36 @@ 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);
+}
diff --git a/shell/e-shell.h b/shell/e-shell.h
index adc0ffd126..1b191e4efb 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,9 @@ 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);
+
G_END_DECLS
#endif /* E_SHELL_H */
diff --git a/shell/main.c b/shell/main.c
index e3d69412a6..5a9855b402 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 "e-config-upgrade.h"
#include "es-event.h"
@@ -371,6 +372,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 ();
@@ -405,6 +407,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);
@@ -415,7 +420,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);