[anjuta] libanjuta: Reverse the order of pane operations in anjuta_dock_replace command_pane



commit b7c041094d57531593c0bdef4fd48f5441c003b4
Author: James Liggett <jrliggett cox net>
Date:   Sun Jun 3 14:20:41 2012 -0700

    libanjuta: Reverse the order of pane operations in anjuta_dock_replace command_pane
    
    Add the new pane and then remove the old one so that GDL can properly calculate the size of the bottom section.

 libanjuta/anjuta-dock.c |   37 ++++++++++++++++++++++++-------------
 libanjuta/anjuta-dock.h |   24 ++++++++++++------------
 2 files changed, 36 insertions(+), 25 deletions(-)
---
diff --git a/libanjuta/anjuta-dock.c b/libanjuta/anjuta-dock.c
index f4ef70d..9c6a870 100644
--- a/libanjuta/anjuta-dock.c
+++ b/libanjuta/anjuta-dock.c
@@ -150,8 +150,11 @@ anjuta_dock_new (void)
  *
  * Adds a pane, with optional #AnjutaCommandBar entries, to an AnjutaDock. This
  * method adds a pane with no grip that cannot be closed, floating or iconified.
+ * 
+ * Returns: %TRUE if the pane was added, or %FALSE if a pane with the same name
+ * already exists in the dock
  */
-void 
+gboolean 
 anjuta_dock_add_pane (AnjutaDock *self, const gchar *pane_name,
                       const gchar *pane_label, const gchar *stock_icon,
                       AnjutaDockPane *pane, GdlDockPlacement placement, 
@@ -165,10 +168,10 @@ anjuta_dock_add_pane (AnjutaDock *self, const gchar *pane_name,
 	behavior |= GDL_DOCK_ITEM_BEH_CANT_CLOSE;
 	behavior |= GDL_DOCK_ITEM_BEH_CANT_ICONIFY;
 	behavior |= GDL_DOCK_ITEM_BEH_NEVER_FLOATING;
-	
-	anjuta_dock_add_pane_full (self, pane_name, pane_label, stock_icon,
-	                           pane, placement, entries, num_entries, 
-	                           user_data, behavior);
+
+	return anjuta_dock_add_pane_full (self, pane_name, pane_label, stock_icon,
+	                                  pane, placement, entries, num_entries, 
+	                                  user_data, behavior);
 }
 
 /**
@@ -188,8 +191,11 @@ anjuta_dock_add_pane (AnjutaDock *self, const gchar *pane_name,
  *
  * Does the same thing as anjuta_dock_add_pane, but allows GDL dock behavior 
  * flags to be specified.
+ * 
+ * Returns: %TRUE if the pane was added, or %FALSE if a pane with the same name
+ * already exists in the dock
  */
-void 
+gboolean
 anjuta_dock_add_pane_full (AnjutaDock *self, const gchar *pane_name,
                            const gchar *pane_label, const gchar *stock_icon,   
                            AnjutaDockPane *pane,
@@ -235,7 +241,11 @@ anjuta_dock_add_pane_full (AnjutaDock *self, const gchar *pane_name,
 			anjuta_command_bar_show_action_group (ANJUTA_COMMAND_BAR (self->priv->command_bar),
 			                                      pane_name);
 		}
+
+		return TRUE;
 	}
+
+	return FALSE;
 }
 
 /**
@@ -264,15 +274,16 @@ anjuta_dock_replace_command_pane (AnjutaDock *self,
                                   AnjutaCommandBarEntry *entries, int num_entries,
                                   gpointer user_data)
 {
-	if (self->priv->command_pane)
+	if (anjuta_dock_add_pane (self, pane_name, pane_label, stock_icon,
+	                  		  pane, placement, entries, num_entries, user_data))
 	{
-		anjuta_dock_remove_pane (self, self->priv->command_pane);
-	}
+		if (self->priv->command_pane)
+		{
+			anjuta_dock_remove_pane (self, self->priv->command_pane);
+		}
 
-	anjuta_dock_add_pane (self, pane_name, pane_label, stock_icon,
-	                      pane, placement, entries, num_entries, user_data);
-	
-	self->priv->command_pane = pane;
+		self->priv->command_pane = pane;
+	}
 }
 
 /**
diff --git a/libanjuta/anjuta-dock.h b/libanjuta/anjuta-dock.h
index 4c66914..0409c62 100644
--- a/libanjuta/anjuta-dock.h
+++ b/libanjuta/anjuta-dock.h
@@ -53,18 +53,18 @@ struct _AnjutaDock
 
 GType anjuta_dock_get_type (void) G_GNUC_CONST;
 GtkWidget *anjuta_dock_new (void);
-void anjuta_dock_add_pane (AnjutaDock *self, const gchar *pane_name,
-                           const gchar *pane_label, const gchar *stock_icon,
-                           AnjutaDockPane *pane, GdlDockPlacement placement, 
-                           AnjutaCommandBarEntry *entries, int num_entries,
-                           gpointer user_data);
-void anjuta_dock_add_pane_full (AnjutaDock *self, const gchar *pane_name,
-                                const gchar *pane_label, 
-                                const gchar *stock_icon,  AnjutaDockPane *pane, 
-                                GdlDockPlacement placement,
-                                AnjutaCommandBarEntry *entries, int num_entries,
-                                gpointer user_data, 
-                                GdlDockItemBehavior behavior);
+gboolean anjuta_dock_add_pane (AnjutaDock *self, const gchar *pane_name,
+                               const gchar *pane_label, const gchar *stock_icon,
+                               AnjutaDockPane *pane, GdlDockPlacement placement, 
+                               AnjutaCommandBarEntry *entries, int num_entries,
+                               gpointer user_data);
+gboolean anjuta_dock_add_pane_full (AnjutaDock *self, const gchar *pane_name,
+                                    const gchar *pane_label, 
+                                    const gchar *stock_icon,  AnjutaDockPane *pane, 
+                                    GdlDockPlacement placement,
+                                    AnjutaCommandBarEntry *entries, int num_entries,
+                                    gpointer user_data, 
+                                    GdlDockItemBehavior behavior);
 void anjuta_dock_replace_command_pane (AnjutaDock *self, const gchar *pane_name,
                                        const gchar *pane_label, const gchar *stock_icon,
                                        AnjutaDockPane *pane, GdlDockPlacement placement, 



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