[anjuta] build-basic-autotools: Keep the most recent message pane on the left
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] build-basic-autotools: Keep the most recent message pane on the left
- Date: Sat, 26 Apr 2014 19:10:06 +0000 (UTC)
commit 45daa4a3398066d8cd71d6f7d9c59a6f34aab9d6
Author: Sébastien Granjoux <seb sfo free fr>
Date: Sat Apr 26 21:09:04 2014 +0200
build-basic-autotools: Keep the most recent message pane on the left
libanjuta/anjuta-tabber.c | 38 ++++++++++++++--
libanjuta/anjuta-tabber.h | 1 +
plugins/build-basic-autotools/plugin.c | 78 ++++++++++----------------------
plugins/message-view/anjuta-msgman.c | 10 ++--
4 files changed, 64 insertions(+), 63 deletions(-)
---
diff --git a/libanjuta/anjuta-tabber.c b/libanjuta/anjuta-tabber.c
index 0065c3f..5244810 100644
--- a/libanjuta/anjuta-tabber.c
+++ b/libanjuta/anjuta-tabber.c
@@ -751,7 +751,7 @@ anjuta_tabber_unmap (GtkWidget* widget)
}
static void
-anjuta_tabber_add (GtkContainer* container, GtkWidget* widget)
+anjuta_tabber_append (GtkContainer* container, GtkWidget* widget)
{
g_return_if_fail (ANJUTA_IS_TABBER (container));
g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -769,6 +769,24 @@ anjuta_tabber_add (GtkContainer* container, GtkWidget* widget)
}
static void
+anjuta_tabber_prepend (GtkContainer* container, GtkWidget* widget)
+{
+ g_return_if_fail (ANJUTA_IS_TABBER (container));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ AnjutaTabber* tabber = ANJUTA_TABBER (container);
+ gboolean visible = gtk_widget_get_visible (widget);
+
+ tabber->priv->children = g_list_prepend (tabber->priv->children, widget);
+ gtk_widget_set_parent (widget, GTK_WIDGET (tabber));
+ if (visible)
+ {
+ gtk_container_resize_children (GTK_CONTAINER (tabber));
+ gtk_widget_queue_resize (widget);
+ }
+}
+
+static void
anjuta_tabber_remove (GtkContainer* container, GtkWidget* widget)
{
g_return_if_fail (ANJUTA_IS_TABBER (container));
@@ -846,7 +864,7 @@ anjuta_tabber_class_init (AnjutaTabberClass *klass)
widget_class->map = anjuta_tabber_map;
widget_class->unmap = anjuta_tabber_unmap;
- container_class->add = anjuta_tabber_add;
+ container_class->add = anjuta_tabber_append;
container_class->remove = anjuta_tabber_remove;
container_class->forall = anjuta_tabber_forall;
container_class->get_path_for_child = anjuta_tabber_get_path_for_child;
@@ -897,9 +915,21 @@ GtkWidget* anjuta_tabber_new (GtkNotebook* notebook)
* @tabber: a AnjutaTabber widget
* @tab_label: widget used as tab label
*
- * Adds a tab to the AnjutaTabber widget
+ * Append a tab to the AnjutaTabber widget
*/
void anjuta_tabber_add_tab (AnjutaTabber* tabber, GtkWidget* tab_label)
{
- gtk_container_add (GTK_CONTAINER (tabber), tab_label);
+ anjuta_tabber_append (GTK_CONTAINER (tabber), tab_label);
+}
+
+/**
+ * anjuta_tabber_prepend_tab:
+ * @tabber: a AnjutaTabber widget
+ * @tab_label: widget used as tab label
+ *
+ * Prepend a tab to the AnjutaTabber widget
+ */
+void anjuta_tabber_prepend_tab (AnjutaTabber* tabber, GtkWidget* tab_label)
+{
+ anjuta_tabber_prepend (GTK_CONTAINER (tabber), tab_label);
}
diff --git a/libanjuta/anjuta-tabber.h b/libanjuta/anjuta-tabber.h
index 54cb9c4..4e2c2d5 100644
--- a/libanjuta/anjuta-tabber.h
+++ b/libanjuta/anjuta-tabber.h
@@ -51,6 +51,7 @@ GType anjuta_tabber_get_type (void) G_GNUC_CONST;
GtkWidget* anjuta_tabber_new (GtkNotebook* notebook);
void anjuta_tabber_add_tab (AnjutaTabber* tabber, GtkWidget* tab_label);
+void anjuta_tabber_prepend_tab (AnjutaTabber* tabber, GtkWidget* tab_label);
G_END_DECLS
diff --git a/plugins/build-basic-autotools/plugin.c b/plugins/build-basic-autotools/plugin.c
index 98d2155..ee22d75 100644
--- a/plugins/build-basic-autotools/plugin.c
+++ b/plugins/build-basic-autotools/plugin.c
@@ -433,23 +433,6 @@ build_context_destroy (BuildContext *context)
}
static void
-build_context_reset (BuildContext *context)
-{
- /* Reset context */
-
- ianjuta_message_view_clear (context->message_view, NULL);
-
- if (context->build_dir_stack)
- g_hash_table_destroy (context->build_dir_stack);
- context->build_dir_stack = NULL;
-
- g_slist_foreach (context->locations,
- (GFunc) build_indicator_location_free, NULL);
- g_slist_free (context->locations);
- context->locations = NULL;
-}
-
-static void
build_regex_load (void)
{
FILE *fp;
@@ -1120,56 +1103,43 @@ build_get_context_with_message(BasicAutotoolsPlugin *plugin, const gchar *dir)
snprintf (mname, 128, _("Build %d: %s"), ++message_pane_count, subdir);
g_free (subdir);
- /* If we already have MAX_BUILD_PANES build panes, find a free context */
+ /* If we already have MAX_BUILD_PANES build panes, try to find a free
+ * context and destroy it */
if (g_list_length (plugin->contexts_pool) >= MAX_BUILD_PANES)
{
GList *node;
node = plugin->contexts_pool;
while (node)
{
- BuildContext *c;
- c = node->data;
- if (c->launcher == NULL)
+ BuildContext *context;
+ context = node->data;
+ if (context->launcher == NULL)
{
- context = c;
+ gtk_widget_destroy (GTK_WIDGET (context->message_view));
break;
}
node = g_list_next (node);
}
}
+ /* Create a new context */
mesg_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
IAnjutaMessageManager, NULL);
- if (context)
- {
- build_context_reset (context);
-
- /* It will be re-inserted in right order */
- plugin->contexts_pool = g_list_remove (plugin->contexts_pool, context);
- ianjuta_message_manager_set_view_title (mesg_manager,
-
context->message_view,
- mname, NULL);
- }
- else
- {
-
- /* If no free context found, create one */
- context = g_new0 (BuildContext, 1);
- context->plugin = ANJUTA_PLUGIN(plugin);
- context->indicators_updated_editors =
- g_hash_table_new (g_direct_hash, g_direct_equal);
-
- context->message_view =
- ianjuta_message_manager_add_view (mesg_manager, mname,
- ICON_FILE, NULL);
-
- g_signal_connect (G_OBJECT (context->message_view), "buffer_flushed",
- G_CALLBACK (on_build_mesg_format), context);
- g_signal_connect (G_OBJECT (context->message_view), "message_clicked",
- G_CALLBACK (on_build_mesg_parse), context);
- g_object_weak_ref (G_OBJECT (context->message_view),
- (GWeakNotify)on_message_view_destroyed, context);
- }
+ context = g_new0 (BuildContext, 1);
+ context->plugin = ANJUTA_PLUGIN(plugin);
+ context->indicators_updated_editors =
+ g_hash_table_new (g_direct_hash, g_direct_equal);
+
+ context->message_view =
+ ianjuta_message_manager_add_view (mesg_manager, mname,
+ ICON_FILE, NULL);
+
+ g_signal_connect (G_OBJECT (context->message_view), "buffer_flushed",
+ G_CALLBACK (on_build_mesg_format), context);
+ g_signal_connect (G_OBJECT (context->message_view), "message_clicked",
+ G_CALLBACK (on_build_mesg_parse), context);
+ g_object_weak_ref (G_OBJECT (context->message_view),
+ (GWeakNotify)on_message_view_destroyed, context);
build_set_animation (mesg_manager, context);
ianjuta_message_manager_set_current_view (mesg_manager,
@@ -2595,7 +2565,7 @@ deactivate_plugin (AnjutaPlugin *plugin)
if (ba_plugin->update_indicators_idle)
{
g_source_remove (ba_plugin->update_indicators_idle);
- ba_plugin->update_indicators_idle = NULL;
+ ba_plugin->update_indicators_idle = 0;
}
/* Remove UI */
@@ -2627,7 +2597,7 @@ dispose (GObject *obj)
if (ba_plugin->update_indicators_idle)
{
g_source_remove (ba_plugin->update_indicators_idle);
- ba_plugin->update_indicators_idle = NULL;
+ ba_plugin->update_indicators_idle = 0;
}
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
diff --git a/plugins/message-view/anjuta-msgman.c b/plugins/message-view/anjuta-msgman.c
index be38694..1769dfb 100644
--- a/plugins/message-view/anjuta-msgman.c
+++ b/plugins/message-view/anjuta-msgman.c
@@ -336,7 +336,7 @@ on_message_view_destroy (MessageView *view, AnjutaMsgman *msgman)
}
static void
-anjuta_msgman_append_view (AnjutaMsgman * msgman, MessageView *mv,
+anjuta_msgman_prepend_view (AnjutaMsgman * msgman, MessageView *mv,
const gchar * name, const gchar * pixmap)
{
AnjutaMsgmanPage *page;
@@ -351,11 +351,11 @@ anjuta_msgman_append_view (AnjutaMsgman * msgman, MessageView *mv,
msgman->priv->views =
g_list_prepend (msgman->priv->views, (gpointer) page);
- gtk_notebook_append_page (GTK_NOTEBOOK (msgman), GTK_WIDGET (mv), NULL);
+ gtk_notebook_prepend_page (GTK_NOTEBOOK (msgman), GTK_WIDGET (mv), NULL);
g_signal_emit_by_name (msgman, "view-changed");
- anjuta_tabber_add_tab (ANJUTA_TABBER(msgman->priv->tabber), page->box);
+ anjuta_tabber_prepend_tab (ANJUTA_TABBER(msgman->priv->tabber), page->box);
g_signal_connect (G_OBJECT (mv), "destroy",
G_CALLBACK (on_message_view_destroy), msgman);
@@ -374,7 +374,7 @@ anjuta_msgman_add_view (AnjutaMsgman * msgman,
g_return_val_if_fail (mv != NULL, NULL);
g_object_set (G_OBJECT (mv), "highlite", TRUE, "label", name,
"pixmap", pixmap, NULL);
- anjuta_msgman_append_view (msgman, mv, name, pixmap);
+ anjuta_msgman_prepend_view (msgman, mv, name, pixmap);
return mv;
}
@@ -557,7 +557,7 @@ anjuta_msgman_deserialize (AnjutaMsgman *msgman, AnjutaSerializer *serializer)
return FALSE;
}
g_object_get (view, "label", &label, "pixmap", &pixmap, NULL);
- anjuta_msgman_append_view (msgman, view, label, pixmap);
+ anjuta_msgman_prepend_view (msgman, view, label, pixmap);
g_free (label);
g_free (pixmap);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]