[dia] get rid of intergrated_ui_main_*_hide()
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] get rid of intergrated_ui_main_*_hide()
- Date: Wed, 1 Jun 2011 15:56:54 +0000 (UTC)
commit 166bd3af645771b3defb63fb59241f9017823459
Author: Hans Breuer <hans breuer org>
Date: Fri May 13 22:43:23 2011 +0200
get rid of intergrated_ui_main_*_hide()
removed some code duplication, simplified by parameter to *_show()
app/commands.c | 27 ++------------
app/interface.c | 99 +++++++++++++++++----------------------------------
app/interface.h | 11 ++----
app/layer_dialog.c | 2 +-
4 files changed, 41 insertions(+), 98 deletions(-)
---
diff --git a/app/commands.c b/app/commands.c
index 90ac845..0239a47 100644
--- a/app/commands.c
+++ b/app/commands.c
@@ -1188,40 +1188,19 @@ view_diagram_properties_callback (GtkAction *action)
void
view_main_toolbar_callback (GtkAction *action)
{
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action)) == TRUE)
- {
- integrated_ui_main_toolbar_show ();
- }
- else
- {
- integrated_ui_main_toolbar_hide ();
- }
+ integrated_ui_toolbar_show (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action)));
}
void
view_main_statusbar_callback (GtkAction *action)
{
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action)) == TRUE)
- {
- integrated_ui_main_statusbar_show ();
- }
- else
- {
- integrated_ui_main_statusbar_hide ();
- }
+ integrated_ui_statusbar_show (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action)));
}
void
view_layers_callback (GtkAction *action)
{
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action)) == TRUE)
- {
- integrated_ui_layer_view_show ();
- }
- else
- {
- integrated_ui_layer_view_hide ();
- }
+ integrated_ui_layer_view_show (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION(action)));
}
void
diff --git a/app/interface.c b/app/interface.c
index d550197..1b41c7b 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -1778,8 +1778,8 @@ create_integrated_ui (void)
/* NOTE: These functions use ui.xxx assignments above and so must come after
* the user interface components are set. */
- integrated_ui_main_toolbar_show ();
- integrated_ui_main_statusbar_show ();
+ integrated_ui_toolbar_show (TRUE);
+ integrated_ui_statusbar_show (TRUE);
/* For access outside here: */
g_object_set_data (G_OBJECT (ui.main_window), DIA_MAIN_NOTEBOOK, notebook);
@@ -1900,7 +1900,8 @@ interface_get_toolbox_shell(void)
/* Indicate if the integrated UI toolbar is showing.
* @return TRUE if showing, FALSE if not showing or doesn't exist
*/
-gboolean integrated_ui_main_toolbar_is_showing (void)
+gboolean
+integrated_ui_toolbar_is_showing (void)
{
if (ui.toolbar)
{
@@ -1913,36 +1914,27 @@ gboolean integrated_ui_main_toolbar_is_showing (void)
return FALSE;
}
-/* show() integrated UI main toolbar and set pulldown menu action. */
-void integrated_ui_main_toolbar_show (void)
-{
- if (ui.toolbar)
- {
- GtkAction *action = NULL;
- gtk_widget_show (GTK_WIDGET (ui.toolbar));
- action = menus_get_action (VIEW_MAIN_TOOLBAR_ACTION);
- if (action)
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
- }
-}
-
-/* hide() integrated UI main toolbar and reset pulldown menu action. */
-void integrated_ui_main_toolbar_hide (void)
+/* show integrated UI main toolbar and set pulldown menu action. */
+void
+integrated_ui_toolbar_show (gboolean show)
{
- if (ui.toolbar)
- {
+ if (ui.toolbar) {
GtkAction *action = NULL;
- gtk_widget_hide (GTK_WIDGET (ui.toolbar));
+ if (show)
+ gtk_widget_show (GTK_WIDGET (ui.toolbar));
+ else
+ gtk_widget_hide (GTK_WIDGET (ui.toolbar));
action = menus_get_action (VIEW_MAIN_TOOLBAR_ACTION);
if (action)
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), FALSE);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show);
}
}
/* Indicate if the integrated UI Layer View is showing.
* @return TRUE if showing, FALSE if not showing or doesn't exist
*/
-gboolean integrated_ui_layer_view_is_showing (void)
+gboolean
+integrated_ui_layer_view_is_showing (void)
{
if (ui.layer_view)
{
@@ -1955,38 +1947,25 @@ gboolean integrated_ui_layer_view_is_showing (void)
return FALSE;
}
-void integrated_ui_layer_view_show (void)
+void
+integrated_ui_layer_view_show (gboolean show)
{
- if (ui.layer_view)
- {
- GtkAction *action = NULL;
- gtk_widget_show (ui.layer_view);
+ if (ui.layer_view) {
+ GtkAction *action;
+ if (show)
+ gtk_widget_show (ui.layer_view);
+ else
+ gtk_widget_hide (ui.layer_view);
action = menus_get_action (VIEW_LAYERS_ACTION);
if (action)
- {
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
- }
- }
-}
-
-void integrated_ui_layer_view_hide (void)
-{
- if (ui.layer_view)
- {
- GtkAction *action = NULL;
- gtk_widget_hide (ui.layer_view);
- action = menus_get_action (VIEW_LAYERS_ACTION);
- if (action)
- {
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), FALSE);
- }
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show);
}
}
/* Indicate if the integrated UI statusbar is showing.
* @return TRUE if showing, FALSE if not showing or doesn't exist
*/
-gboolean integrated_ui_main_statusbar_is_showing (void)
+gboolean integrated_ui_statusbar_is_showing (void)
{
if (ui.statusbar)
{
@@ -2000,30 +1979,18 @@ gboolean integrated_ui_main_statusbar_is_showing (void)
}
/* show() integrated UI main statusbar and set pulldown menu action. */
-void integrated_ui_main_statusbar_show (void)
-{
- if (ui.statusbar)
- {
- GtkAction *action = NULL;
- gtk_widget_show (GTK_WIDGET (ui.statusbar));
- action = menus_get_action (VIEW_MAIN_STATUSBAR_ACTION);
- if (action)
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
- }
-}
-
-/* hide() integrated UI main statusbar and reset pulldown menu action. */
-void integrated_ui_main_statusbar_hide (void)
+void
+integrated_ui_statusbar_show (gboolean show)
{
if (ui.statusbar)
{
- GtkAction *action = NULL;
- gtk_widget_hide (GTK_WIDGET (ui.statusbar));
+ GtkAction *action;
+ if (show)
+ gtk_widget_show (GTK_WIDGET (ui.statusbar));
+ else
+ gtk_widget_hide (GTK_WIDGET (ui.statusbar));
action = menus_get_action (VIEW_MAIN_STATUSBAR_ACTION);
if (action)
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), FALSE);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show);
}
}
-
-
-
diff --git a/app/interface.h b/app/interface.h
index a09fbc1..71a4962 100644
--- a/app/interface.h
+++ b/app/interface.h
@@ -37,17 +37,14 @@
void create_integrated_ui (void);
-gboolean integrated_ui_main_toolbar_is_showing (void);
-void integrated_ui_main_toolbar_show (void);
-void integrated_ui_main_toolbar_hide (void);
+gboolean integrated_ui_toolbar_is_showing (void);
+void integrated_ui_toolbar_show (gboolean show);
gboolean integrated_ui_main_statusbar_is_showing (void);
-void integrated_ui_main_statusbar_show (void);
-void integrated_ui_main_statusbar_hide (void);
+void integrated_ui_statusbar_show (gboolean show);
gboolean integrated_ui_layer_view_is_showing (void);
-void integrated_ui_layer_view_show (void);
-void integrated_ui_layer_view_hide (void);
+void integrated_ui_layer_view_show (gboolean show);
int is_integrated_ui (void);
diff --git a/app/layer_dialog.c b/app/layer_dialog.c
index f22d8de..83364cb 100644
--- a/app/layer_dialog.c
+++ b/app/layer_dialog.c
@@ -279,7 +279,7 @@ layer_dialog_delete(GtkWidget *widget, gpointer data)
static void
layer_view_hide_button_clicked (void * not_used)
{
- integrated_ui_layer_view_hide ();
+ integrated_ui_layer_view_show (FALSE);
}
GtkWidget * create_layer_view_widget (void)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]