[anjal] Add experimental floating bar. Not used by default.



commit 62734e67f3e18e33baab6217f80392e6c05bdf13
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Thu Aug 27 22:39:27 2009 +0530

    Add experimental floating bar. Not used by default.

 src/Makefile.am        |    4 +-
 src/mail-float-bar.c   |  139 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/mail-float-bar.h   |   67 +++++++++++++++++++++++
 src/mail-folder-view.c |    1 +
 src/mail-shell.c       |    7 +++
 src/mail-shell.h       |    2 +
 6 files changed, 219 insertions(+), 1 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 5748db0..917eed0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -65,7 +65,9 @@ anjal_SOURCES = \
 	em-format-mail.c \
 	em-format-mail.h \
 	em-format-mail-display.c \
-	em-format-mail-display.h
+	em-format-mail-display.h \
+	mail-float-bar.c \
+	mail-float-bar.h
 
 if ENABLE_WEBKIT
 anjal_SOURCES += em-webkit-stream.c \
diff --git a/src/mail-float-bar.c b/src/mail-float-bar.c
new file mode 100644
index 0000000..9e952e8
--- /dev/null
+++ b/src/mail-float-bar.c
@@ -0,0 +1,139 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>  
+ *
+ *
+ * Authors:
+ *		Srinivasa Ragavan <sragavan gnome org>
+ *
+ * Copyright (C) 2009 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "mail-float-bar.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#define MAIL_FLOAT_BAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MAIL_FLOAT_BAR_TYPE, MailFloatBarPrivate))
+
+struct _MailFloatBarPrivate
+{
+	GtkWidget *toolbar;
+};
+
+static GObjectClass *parent_class = NULL;
+
+static void mail_float_bar_class_init(MailFloatBarClass *klass);
+static void mail_float_bar_init(MailFloatBar *facet);
+
+GType
+mail_float_bar_get_type(void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0))
+	{
+		static const GTypeInfo mail_float_bar_info =
+		{
+			sizeof (MailFloatBarClass),
+			NULL,
+			NULL,
+			(GClassInitFunc) mail_float_bar_class_init,
+			NULL,
+			NULL,
+			sizeof (MailFloatBar),
+			0,
+			(GInstanceInitFunc) mail_float_bar_init
+		};
+
+		type = g_type_register_static (G_TYPE_OBJECT,
+					       "MailFloatBar",
+					       &mail_float_bar_info, 0);
+	}
+
+	return type;
+}
+
+
+
+static void
+mail_float_bar_class_init(MailFloatBarClass *klass)
+{
+
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	/* GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);*/
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	g_type_class_add_private (object_class, sizeof(MailFloatBarPrivate));
+}
+
+static void
+mail_float_bar_init(MailFloatBar *editor)
+{
+	MailFloatBarPrivate *priv;
+	gchar *index_html;
+	GtkWidget *scroller, *vbox;
+
+	priv = MAIL_FLOAT_BAR_GET_PRIVATE (editor);
+}
+
+static void
+mfb_construct (MailFloatBar *bar, GtkWidget *top)
+{
+	GtkWidget *toolbar;
+	GtkToolItem *item;
+	GtkWidget *window = gtk_window_new (GTK_WINDOW_POPUP), *box;
+	int pos = 0, x, y;
+
+	MailFloatBarPrivate *priv;
+
+	toolbar = gtk_hbox_new (FALSE, 2);
+	priv = MAIL_FLOAT_BAR_GET_PRIVATE (bar);
+	priv->toolbar = toolbar;
+
+	/*Create items.*/
+	item = gtk_tool_button_new (gtk_label_new(_("Hide Folder Tree")), NULL);
+	gtk_box_pack_start (toolbar, item, FALSE, FALSE, 0);
+
+	item = gtk_tool_button_new (gtk_image_new_from_icon_name("go-previous", GTK_ICON_SIZE_MENU), NULL);
+	gtk_box_pack_start (toolbar, item, FALSE, FALSE, 0);
+
+	item = gtk_tool_button_new (gtk_image_new_from_icon_name("go-next", GTK_ICON_SIZE_MENU), NULL);
+	gtk_box_pack_start (toolbar, item, FALSE, FALSE, 0);
+
+	item = gtk_tool_button_new (gtk_image_new_from_icon_name("gtk-close", GTK_ICON_SIZE_MENU), NULL);
+	gtk_box_pack_start (toolbar, item, FALSE, FALSE, 0);
+
+	box = gtk_hbox_new (FALSE, 0);
+	gtk_box_pack_start (box, toolbar, TRUE, TRUE, 4);
+	gtk_widget_set_size_request (box, 200, 32);
+	gtk_window_set_default_size (window, 250, 32);
+	gtk_container_add(window, box);
+	gtk_window_set_transient_for (window, top);
+	gtk_widget_show_all(window);
+	gtk_window_get_position (top, &x, &y);
+
+	gtk_window_move (window, x - 125 + (top->allocation.width/2), y + top->allocation.height-32);
+}
+MailFloatBar * mail_float_bar_new(GtkWidget *top)
+{
+	MailFloatBar *bar = (MailFloatBar *) g_object_new(mail_float_bar_get_type(), NULL);
+
+	mfb_construct (bar, top);
+
+	return bar;
+}
+
diff --git a/src/mail-float-bar.h b/src/mail-float-bar.h
new file mode 100644
index 0000000..6bb7b7c
--- /dev/null
+++ b/src/mail-float-bar.h
@@ -0,0 +1,67 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>  
+ *
+ *
+ * Authors:
+ *		Srinivasa  Ragavan <sragavan gnome org>
+ *
+ * Copyright (C) 2009 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef __MAIL_FLOAT_BAR_H
+#define __MAIL_FLOAT_BAR_H
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#define MAIL_FLOAT_BAR_TYPE \
+	(mail_float_bar_get_type ())
+#define MAIL_EDITOR(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), MAIL_FLOAT_BAR_TYPE, MailFloatBar))
+#define MAIL_FLOAT_BAR_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), MAIL_FLOAT_BAR_TYPE, MailFloatBarClass))
+#define IS_MAIL_EDITOR(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), MAIL_FLOAT_BAR_TYPE))
+#define IS_MAIL_FLOAT_BAR_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((obj), MAIL_FLOAT_BAR_TYPE))
+#define MAIL_FLOAT_BAR_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), MAIL_FLOAT_BAR_TYPE, MailFloatBarClass))
+
+typedef struct _MailFloatBar MailFloatBar;
+typedef struct _MailFloatBarClass MailFloatBarClass;
+typedef struct _MailFloatBarPrivate MailFloatBarPrivate;
+
+struct _MailFloatBar {
+        GObject parent; 
+
+	MailFloatBarPrivate *priv;
+};
+
+struct _MailFloatBarClass {
+	GObjectClass parent_class;
+};
+
+MailFloatBar *mail_float_bar_new(GtkWidget *top);
+
+#endif 
diff --git a/src/mail-folder-view.c b/src/mail-folder-view.c
index 92e48b5..1421faa 100644
--- a/src/mail-folder-view.c
+++ b/src/mail-folder-view.c
@@ -1270,6 +1270,7 @@ mfv_message_activated (GtkTreeView       *tree_view,  GtkTreePath       *path, G
 		gtk_widget_hide ((GtkWidget *)shell->tree);
 		gtk_widget_hide (shell->priv->view_scroller);
 		gtk_widget_show ((GtkWidget *)shell->mail);
+		/* mail_float_bar_new (gtk_widget_get_ancestor (tree_view, GTK_TYPE_WINDOW)); */
 	}
 
 	if (!gtk_tree_model_get_iter (shell->model, &iter, path)) {
diff --git a/src/mail-shell.c b/src/mail-shell.c
index dbc1d6a..70760f8 100644
--- a/src/mail-shell.c
+++ b/src/mail-shell.c
@@ -427,6 +427,7 @@ mail_shell_construct (MailShell *shell)
 	GtkStyle *style = gtk_widget_get_default_style ();
 	int window_width = 1024;
 
+	gtk_window_set_icon_name ((GtkWindow *)shell, "evolution-mail");
 	ms_init_style (style);
 	g_signal_connect ((GObject *)shell, "delete-event", G_CALLBACK (ms_delete_event), NULL);
 	gtk_window_set_type_hint ((GtkWindow *)shell, GDK_WINDOW_TYPE_HINT_NORMAL);
@@ -629,6 +630,12 @@ mail_shell_construct (MailShell *shell)
 	}
 }
 
+int
+mail_shell_toolbar_height (MailShell *shell)
+{
+	return shell->priv->top_bar->allocation.height;
+}
+
 MailShell *
 mail_shell_new ()
 {
diff --git a/src/mail-shell.h b/src/mail-shell.h
index 2bdcd89..fc270b6 100644
--- a/src/mail-shell.h
+++ b/src/mail-shell.h
@@ -59,6 +59,8 @@ MailViewChild *mail_shell_create_composer (void);
 void mail_shell_set_cmdline_args (MailShell *shell, char **args);
 void mail_shell_handle_cmdline (MailShell *shell);
 MailViewChild * mail_shell_create_composer_mailto (const char *uri);
+int mail_shell_toolbar_height (MailShell *shell);
+
 #endif
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]