SF.net SVN: geany:[3362] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Dec 11 16:56:28 UTC 2008


Revision: 3362
          http://geany.svn.sourceforge.net/geany/?rev=3362&view=rev
Author:   eht16
Date:     2008-12-11 16:56:28 +0000 (Thu, 11 Dec 2008)

Log Message:
-----------
Move ui_auto_separator_add_ref() and related code back to ui_utils.c since it's no toolbar specific code (oops).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/toolbar.c
    trunk/src/ui_utils.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-12-11 16:51:46 UTC (rev 3361)
+++ trunk/ChangeLog	2008-12-11 16:56:28 UTC (rev 3362)
@@ -4,6 +4,9 @@
    Fix plugin toolbar icon placement. Now they are always inserted
    before the Quit button if it is the last toolbar element or at
    the end otherwise.
+ * src/toolbar.c, src/ui_utils.c:
+   Move ui_auto_separator_add_ref() and related code back to ui_utils.c
+   since it's no toolbar specific code (oops).
 
 
 2008-12-11  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/toolbar.c
===================================================================
--- trunk/src/toolbar.c	2008-12-11 16:51:46 UTC (rev 3361)
+++ trunk/src/toolbar.c	2008-12-11 16:56:28 UTC (rev 3362)
@@ -277,62 +277,6 @@
 }
 
 
-static void auto_separator_update(GeanyAutoSeparator *autosep)
-{
-	g_return_if_fail(autosep->ref_count >= 0);
-
-	if (autosep->widget)
-		ui_widget_show_hide(autosep->widget, autosep->ref_count > 0);
-}
-
-
-static void on_auto_separator_item_show_hide(GtkWidget *widget, gpointer user_data)
-{
-	GeanyAutoSeparator *autosep = user_data;
-
-	if (GTK_WIDGET_VISIBLE(widget))
-		autosep->ref_count++;
-	else
-		autosep->ref_count--;
-
-	auto_separator_update(autosep);
-}
-
-
-static void on_auto_separator_item_destroy(GtkWidget *widget, gpointer user_data)
-{
-	GeanyAutoSeparator *autosep = user_data;
-
-	/* GTK_WIDGET_VISIBLE won't work now the widget is being destroyed,
-	 * so assume widget was visible */
-	autosep->ref_count--;
-	autosep->ref_count = MAX(autosep->ref_count, 0);
-	auto_separator_update(autosep);
-}
-
-
-/* Show the separator widget if @a item or another is visible. */
-/* Note: This would be neater taking a widget argument, setting a "visible-count"
- * property, and using reference counting to keep the widget alive whilst its visible group
- * is alive. */
-void ui_auto_separator_add_ref(GeanyAutoSeparator *autosep, GtkWidget *item)
-{
-	/* set widget ptr NULL when widget destroyed */
-	if (autosep->ref_count == 0)
-		g_signal_connect(autosep->widget, "destroy",
-			G_CALLBACK(gtk_widget_destroyed), &autosep->widget);
-
-	if (GTK_WIDGET_VISIBLE(item))
-	{
-		autosep->ref_count++;
-		auto_separator_update(autosep);
-	}
-	g_signal_connect(item, "show", G_CALLBACK(on_auto_separator_item_show_hide), autosep);
-	g_signal_connect(item, "hide", G_CALLBACK(on_auto_separator_item_show_hide), autosep);
-	g_signal_connect(item, "destroy", G_CALLBACK(on_auto_separator_item_destroy), autosep);
-}
-
-
 void toolbar_finalize(void)
 {
     /* unref'ing the GtkUIManager object will destroy all its widgets unless they were ref'ed */

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2008-12-11 16:51:46 UTC (rev 3361)
+++ trunk/src/ui_utils.c	2008-12-11 16:56:28 UTC (rev 3362)
@@ -1649,6 +1649,62 @@
 }
 
 
+static void auto_separator_update(GeanyAutoSeparator *autosep)
+{
+	g_return_if_fail(autosep->ref_count >= 0);
+
+	if (autosep->widget)
+		ui_widget_show_hide(autosep->widget, autosep->ref_count > 0);
+}
+
+
+static void on_auto_separator_item_show_hide(GtkWidget *widget, gpointer user_data)
+{
+	GeanyAutoSeparator *autosep = user_data;
+
+	if (GTK_WIDGET_VISIBLE(widget))
+		autosep->ref_count++;
+	else
+		autosep->ref_count--;
+
+	auto_separator_update(autosep);
+}
+
+
+static void on_auto_separator_item_destroy(GtkWidget *widget, gpointer user_data)
+{
+	GeanyAutoSeparator *autosep = user_data;
+
+	/* GTK_WIDGET_VISIBLE won't work now the widget is being destroyed,
+	 * so assume widget was visible */
+	autosep->ref_count--;
+	autosep->ref_count = MAX(autosep->ref_count, 0);
+	auto_separator_update(autosep);
+}
+
+
+/* Show the separator widget if @a item or another is visible. */
+/* Note: This would be neater taking a widget argument, setting a "visible-count"
+ * property, and using reference counting to keep the widget alive whilst its visible group
+ * is alive. */
+void ui_auto_separator_add_ref(GeanyAutoSeparator *autosep, GtkWidget *item)
+{
+	/* set widget ptr NULL when widget destroyed */
+	if (autosep->ref_count == 0)
+		g_signal_connect(autosep->widget, "destroy",
+			G_CALLBACK(gtk_widget_destroyed), &autosep->widget);
+
+	if (GTK_WIDGET_VISIBLE(item))
+	{
+		autosep->ref_count++;
+		auto_separator_update(autosep);
+	}
+	g_signal_connect(item, "show", G_CALLBACK(on_auto_separator_item_show_hide), autosep);
+	g_signal_connect(item, "hide", G_CALLBACK(on_auto_separator_item_show_hide), autosep);
+	g_signal_connect(item, "destroy", G_CALLBACK(on_auto_separator_item_destroy), autosep);
+}
+
+
 /**
  *  Sets @a text as the contents of the tooltip for @a widget.
  *


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list