[anjuta] message-view: Port message-view to use AnjutaTabber
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] message-view: Port message-view to use AnjutaTabber
- Date: Mon, 5 Apr 2010 17:08:41 +0000 (UTC)
commit 8cb108c63a09a9ac3668764656e8f6acff541ef0
Author: Johannes Schmid <jhs gnome org>
Date: Mon Apr 5 14:25:45 2010 +0200
message-view: Port message-view to use AnjutaTabber
plugins/message-view/anjuta-msgman.c | 74 +++++-----------------------------
1 files changed, 11 insertions(+), 63 deletions(-)
---
diff --git a/plugins/message-view/anjuta-msgman.c b/plugins/message-view/anjuta-msgman.c
index f088328..4291787 100644
--- a/plugins/message-view/anjuta-msgman.c
+++ b/plugins/message-view/anjuta-msgman.c
@@ -19,6 +19,7 @@
#include <libanjuta/anjuta-utils.h>
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/anjuta-shell.h>
+#include <libanjuta/anjuta-tabber.h>
#include <libanjuta/resources.h>
#include "anjuta-msgman.h"
@@ -31,6 +32,7 @@ struct _AnjutaMsgmanPriv
GtkWidget* tab_popup;
GList *views;
+ GtkWidget* tabber;
GtkWidget* hbox;
GSList* button_group;
};
@@ -40,9 +42,7 @@ struct _AnjutaMsgmanPage
GtkWidget *widget;
GtkWidget *pixmap;
GtkWidget *label;
- GtkWidget *button;
GtkWidget *box;
- GtkWidget *frame;
GtkWidget *close_button;
GtkWidget *close_icon;
};
@@ -50,29 +50,6 @@ struct _AnjutaMsgmanPage
typedef struct _AnjutaMsgmanPage AnjutaMsgmanPage;
static void
-on_page_button_toggled (GtkToggleButton* button,
- AnjutaMsgman* msgman)
-{
- AnjutaMsgmanPage* page;
- int page_num;
-
- page = g_object_get_data (G_OBJECT (button), "__page");
- page_num = gtk_notebook_page_num (GTK_NOTEBOOK(msgman), page->widget);
-
- if (page_num == gtk_notebook_get_current_page (GTK_NOTEBOOK(msgman)))
- {
- if (!gtk_toggle_button_get_active (button))
- {
- g_signal_handlers_block_by_func (button, on_page_button_toggled, msgman);
- gtk_toggle_button_set_active (button, TRUE);
- g_signal_handlers_unblock_by_func (button, on_page_button_toggled, msgman);
- }
- }
- else
- gtk_notebook_set_current_page (GTK_NOTEBOOK(msgman), page_num);
-}
-
-static void
on_msgman_close_page (GtkButton* button,
AnjutaMsgman *msgman)
{
@@ -180,22 +157,12 @@ anjuta_msgman_page_new (GtkWidget * view, const gchar * name,
G_CALLBACK(on_msgman_close_page),
msgman);
- page->button = gtk_toggle_button_new ();
- g_signal_connect (page->button, "toggled", G_CALLBACK(on_page_button_toggled),
- msgman);
- g_object_set_data (G_OBJECT(page->button), "__page", page);
- gtk_container_add (GTK_CONTAINER (page->button), box);
page->box = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX(page->box), page->button, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX(page->box), box, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX(page->box), page->close_button, FALSE, FALSE, 0);
-
- page->frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(page->frame),
- GTK_SHADOW_OUT);
- gtk_container_add (GTK_CONTAINER (page->frame), page->box);
- gtk_widget_show_all (page->frame);
+ gtk_widget_show_all (page->box);
return page;
}
@@ -203,7 +170,6 @@ anjuta_msgman_page_new (GtkWidget * view, const gchar * name,
static void
anjuta_msgman_page_destroy (AnjutaMsgmanPage * page)
{
- gtk_widget_destroy (page->frame);
g_free (page);
}
@@ -229,7 +195,6 @@ on_notebook_switch_page (GtkNotebook * notebook,
GtkNotebookPage * npage,
gint page_num, AnjutaMsgman * msgman)
{
- GList* node;
AnjutaMsgmanPage* page = anjuta_msgman_page_from_widget(msgman,
MESSAGE_VIEW (gtk_notebook_get_nth_page(GTK_NOTEBOOK(msgman), page_num)));
@@ -237,21 +202,6 @@ on_notebook_switch_page (GtkNotebook * notebook,
g_return_if_fail (page != NULL);
g_return_if_fail (msgman != NULL);
- for (node = msgman->priv->views; node != NULL; node = g_list_next (node))
- {
- AnjutaMsgmanPage* cur_page = node->data;
- g_signal_handlers_block_by_func (cur_page->button, on_page_button_toggled, msgman);
- if (cur_page != page)
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cur_page->button), FALSE);
- }
- else
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cur_page->button), TRUE);
- }
- g_signal_handlers_unblock_by_func (cur_page->button, on_page_button_toggled, msgman);
- }
-
anjuta_msgman_set_current_view(msgman, NULL);
}
@@ -285,8 +235,13 @@ anjuta_msgman_instance_init (AnjutaMsgman * msgman)
msgman->priv = g_new0(AnjutaMsgmanPriv, 1);
msgman->priv->views = NULL;
msgman->priv->tab_popup = create_tab_popup_menu(msgman);
- msgman->priv->hbox = gtk_hbox_new (FALSE, 1);
+ msgman->priv->hbox = gtk_hbox_new (FALSE, 0);
+ msgman->priv->tabber = anjuta_tabber_new (GTK_NOTEBOOK (msgman));
msgman->priv->button_group = NULL;
+
+ gtk_box_pack_end (GTK_BOX (msgman->priv->hbox),
+ msgman->priv->tabber, TRUE, TRUE, TRUE);
+
g_signal_connect(GTK_OBJECT(msgman), "popup-menu",
G_CALLBACK(on_msgman_popup_menu), msgman);
g_signal_connect(GTK_OBJECT(msgman), "button-press-event",
@@ -411,22 +366,15 @@ anjuta_msgman_append_view (AnjutaMsgman * msgman, GtkWidget *mv,
gtk_widget_show_all (mv);
page = anjuta_msgman_page_new (mv, name, pixmap, msgman);
- g_signal_handlers_block_by_func (GTK_OBJECT (msgman),
- G_CALLBACK
- (on_notebook_switch_page), msgman);
msgman->priv->views =
g_list_prepend (msgman->priv->views, (gpointer) page);
page_num = gtk_notebook_append_page (GTK_NOTEBOOK (msgman), mv, NULL);
- gtk_box_pack_start (GTK_BOX(msgman->priv->hbox), page->frame, TRUE, TRUE, 0);
+ anjuta_tabber_add_tab (ANJUTA_TABBER(msgman->priv->tabber), page->box);
g_signal_connect (G_OBJECT (mv), "destroy",
G_CALLBACK (on_message_view_destroy), msgman);
- g_signal_handlers_unblock_by_func (GTK_OBJECT (msgman),
- G_CALLBACK
- (on_notebook_switch_page), msgman);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->button), TRUE);
g_signal_emit_by_name(G_OBJECT(msgman), "view_changed");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]