I think is more natural for a gtkToggleActionEntry to query the GtkToggleAction to be active instead of checking if the widget is already visible or not.

This commit is contained in:
riccardom 2009-05-13 20:01:35 +00:00
parent 7cd0426a37
commit 9fbac3e7bc
1 changed files with 19 additions and 19 deletions

View File

@ -99,9 +99,9 @@ static void Edit_Controls();
static void MenuSave(GtkMenuItem *item, gpointer slot); static void MenuSave(GtkMenuItem *item, gpointer slot);
static void MenuLoad(GtkMenuItem *item, gpointer slot); static void MenuLoad(GtkMenuItem *item, gpointer slot);
static void About(); static void About();
static void ToggleMenuVisible(); static void ToggleMenuVisible(GtkToggleAction *action);
static void ToggleStatusbarVisible(); static void ToggleStatusbarVisible(GtkToggleAction *action);
static void ToggleToolbarVisible(); static void ToggleToolbarVisible(GtkToggleAction *action);
static void desmume_gtk_disable_audio (GtkToggleAction *action); static void desmume_gtk_disable_audio (GtkToggleAction *action);
static void desmume_gtk_mic_noise (GtkToggleAction *action); static void desmume_gtk_mic_noise (GtkToggleAction *action);
static void SetRotation (GtkAction *action, gpointer data); static void SetRotation (GtkAction *action, gpointer data);
@ -537,32 +537,32 @@ static void About()//GtkWidget* widget, gpointer data)
g_object_unref(pixbuf); g_object_unref(pixbuf);
} }
static void ToggleMenuVisible() static void ToggleMenuVisible(GtkToggleAction *action)
{ {
GtkWidget *pMenuBar; GtkWidget *pMenuBar = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");
pMenuBar = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");
if(GTK_WIDGET_VISIBLE(pMenuBar)) if (gtk_toggle_action_get_active(action) == TRUE)
gtk_widget_hide(pMenuBar);
else
gtk_widget_show(pMenuBar); gtk_widget_show(pMenuBar);
else
gtk_widget_hide(pMenuBar);
} }
static void ToggleToolbarVisible() static void ToggleToolbarVisible(GtkToggleAction *action)
{ {
GtkWidget *pToolBar; GtkWidget *pToolBar = gtk_ui_manager_get_widget (ui_manager, "/ToolBar");
pToolBar = gtk_ui_manager_get_widget (ui_manager, "/ToolBar");
if(GTK_WIDGET_VISIBLE(pToolBar)) if (gtk_toggle_action_get_active(action) == TRUE)
gtk_widget_hide(pToolBar);
else
gtk_widget_show(pToolBar); gtk_widget_show(pToolBar);
else
gtk_widget_hide(pToolBar);
} }
static void ToggleStatusbarVisible() static void ToggleStatusbarVisible(GtkToggleAction *action)
{ {
if(GTK_WIDGET_VISIBLE(pStatusBar)) if (gtk_toggle_action_get_active(action) == TRUE)
gtk_widget_hide(pStatusBar);
else
gtk_widget_show(pStatusBar); gtk_widget_show(pStatusBar);
else
gtk_widget_hide(pStatusBar);
} }