Commit 474f5e98 authored by Garrett Regier's avatar Garrett Regier

Use gtk_widget_set_visible

parent 9d4cfcb5
......@@ -288,24 +288,19 @@ static void
show_replace_widgets (GeditSearchDialog *dlg,
gboolean show_replace)
{
gtk_widget_set_visible (dlg->priv->replace_label, show_replace);
gtk_widget_set_visible (dlg->priv->replace_entry, show_replace);
gtk_widget_set_visible (dlg->priv->replace_all_button, show_replace);
gtk_widget_set_visible (dlg->priv->replace_button, show_replace);
if (show_replace)
{
gtk_widget_show (dlg->priv->replace_label);
gtk_widget_show (dlg->priv->replace_entry);
gtk_widget_show (dlg->priv->replace_all_button);
gtk_widget_show (dlg->priv->replace_button);
gtk_table_set_row_spacings (GTK_TABLE (dlg->priv->table), 12);
gtk_window_set_title (GTK_WINDOW (dlg), _("Replace"));
}
else
{
gtk_widget_hide (dlg->priv->replace_label);
gtk_widget_hide (dlg->priv->replace_entry);
gtk_widget_hide (dlg->priv->replace_all_button);
gtk_widget_hide (dlg->priv->replace_button);
gtk_table_set_row_spacings (GTK_TABLE (dlg->priv->table), 0);
gtk_window_set_title (GTK_WINDOW (dlg), _("Find"));
......
......@@ -52,10 +52,7 @@ _gedit_cmd_view_show_toolbar (GtkAction *action,
visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (visible)
gtk_widget_show (window->priv->toolbar);
else
gtk_widget_hide (window->priv->toolbar);
gtk_widget_set_visible (window->priv->toolbar, visible);
}
void
......@@ -68,10 +65,7 @@ _gedit_cmd_view_show_statusbar (GtkAction *action,
visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (visible)
gtk_widget_show (window->priv->statusbar);
else
gtk_widget_hide (window->priv->statusbar);
gtk_widget_set_visible (window->priv->statusbar, visible);
}
void
......@@ -84,18 +78,14 @@ _gedit_cmd_view_show_side_pane (GtkAction *action,
gedit_debug (DEBUG_COMMANDS);
visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
panel = gedit_window_get_side_panel (window);
gtk_widget_set_visible (GTK_WIDGET (panel), visible);
if (visible)
{
gtk_widget_show (GTK_WIDGET (panel));
gtk_widget_grab_focus (GTK_WIDGET (panel));
}
else
{
gtk_widget_hide (GTK_WIDGET (panel));
}
}
void
......@@ -108,18 +98,14 @@ _gedit_cmd_view_show_bottom_pane (GtkAction *action,
gedit_debug (DEBUG_COMMANDS);
visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
panel = gedit_window_get_bottom_panel (window);
gtk_widget_set_visible (GTK_WIDGET (panel), visible);
if (visible)
{
gtk_widget_show (GTK_WIDGET (panel));
gtk_widget_grab_focus (GTK_WIDGET (panel));
}
else
{
gtk_widget_hide (GTK_WIDGET (panel));
}
}
void
......
......@@ -125,16 +125,10 @@ create_option_menu (GeditFileChooserDialog *dialog)
static void
update_newline_visibility (GeditFileChooserDialog *dialog)
{
if (gtk_file_chooser_get_action (GTK_FILE_CHOOSER (dialog)) == GTK_FILE_CHOOSER_ACTION_SAVE)
{
gtk_widget_show (dialog->priv->newline_label);
gtk_widget_show (dialog->priv->newline_combo);
}
else
{
gtk_widget_hide (dialog->priv->newline_label);
gtk_widget_hide (dialog->priv->newline_combo);
}
gboolean visible = gtk_file_chooser_get_action (GTK_FILE_CHOOSER (dialog)) == GTK_FILE_CHOOSER_ACTION_SAVE;
gtk_widget_set_visible (dialog->priv->newline_label, visible);
gtk_widget_set_visible (dialog->priv->newline_combo, visible);
}
static void
......
......@@ -468,8 +468,8 @@ gedit_session_is_restored (void)
}
static void
parse_window (GKeyFile *state_file,
const char *group_name)
parse_window (GKeyFile *state_file,
const gchar *group_name)
{
GeditWindow *window;
gchar *role, *active_document, **documents;
......@@ -477,7 +477,7 @@ parse_window (GKeyFile *state_file,
gboolean visible;
GeditPanel *panel;
GError *error = NULL;
role = g_key_file_get_string (state_file, group_name, "role", NULL);
gedit_debug_message (DEBUG_SESSION, "Window role: %s", role);
......@@ -495,60 +495,51 @@ parse_window (GKeyFile *state_file,
"width", &error);
if (error)
{
g_clear_error (&error);
g_clear_error (&error);
width = -1;
}
height = g_key_file_get_integer (state_file, group_name,
"height", &error);
if (error)
{
g_clear_error (&error);
g_clear_error (&error);
height = -1;
}
gtk_window_set_default_size (GTK_WINDOW (window), width, height);
visible = g_key_file_get_boolean (state_file, group_name,
"side-panel-visible", &error);
if (error)
{
g_clear_error (&error);
g_clear_error (&error);
visible = FALSE;
}
panel = gedit_window_get_side_panel (window);
gtk_widget_set_visible (GTK_WIDGET (panel), visible);
if (visible)
{
gedit_debug_message (DEBUG_SESSION, "Side panel visible");
gtk_widget_show (GTK_WIDGET (panel));
gedit_debug_message (DEBUG_SESSION, "Side panel visible");
}
else
{
gedit_debug_message (DEBUG_SESSION, "Side panel _NOT_ visible");
gtk_widget_hide (GTK_WIDGET (panel));
gedit_debug_message (DEBUG_SESSION, "Side panel _NOT_ visible");
}
visible = g_key_file_get_boolean (state_file, group_name,
"bottom-panel-visible", &error);
if (error)
{
g_clear_error (&error);
g_clear_error (&error);
visible = FALSE;
}
panel = gedit_window_get_bottom_panel (window);
if (visible)
{
gedit_debug_message (DEBUG_SESSION, "Bottom panel visible");
gtk_widget_show (GTK_WIDGET (panel));
}
else
{
gedit_debug_message (DEBUG_SESSION, "Bottom panel _NOT_ visible");
gtk_widget_hide (GTK_WIDGET (panel));
}
panel = gedit_window_get_bottom_panel (window);
gtk_widget_set_visible (GTK_WIDGET (panel), visible);
gedit_debug_message (DEBUG_SESSION, "Bottom panel %svisible",
visible ? "" : "_NOT_ ");
active_document = g_key_file_get_string (state_file, group_name,
"active-document", NULL);
documents = g_key_file_get_string_list (state_file, group_name,
......@@ -588,7 +579,7 @@ parse_window (GKeyFile *state_file,
}
g_free (active_document);
gtk_widget_show (GTK_WIDGET (window));
}
......@@ -605,7 +596,7 @@ gedit_session_load (void)
{
GKeyFile *state_file;
gchar **groups;
int i;
gint i;
gedit_debug (DEBUG_SESSION);
......
......@@ -642,10 +642,7 @@ set_toolbar_style (GeditWindow *window,
visible = gtk_widget_get_visible (origin->priv->toolbar);
/* Set visibility */
if (visible)
gtk_widget_show (window->priv->toolbar);
else
gtk_widget_hide (window->priv->toolbar);
gtk_widget_set_visible (window->priv->toolbar, visible);
action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
"ViewToolbar");
......@@ -1989,10 +1986,7 @@ set_statusbar_style (GeditWindow *window,
visible = gtk_widget_get_visible (origin->priv->statusbar);
}
if (visible)
gtk_widget_show (window->priv->statusbar);
else
gtk_widget_hide (window->priv->statusbar);
gtk_widget_set_visible (window->priv->statusbar, visible);
action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
"ViewStatusbar");
......@@ -4052,14 +4046,8 @@ check_window_is_active (GeditWindow *window,
{
if (window->priv->window_state & GDK_WINDOW_STATE_FULLSCREEN)
{
if (gtk_window_is_active (GTK_WINDOW (window)))
{
gtk_widget_show (window->priv->fullscreen_controls);
}
else
{
gtk_widget_hide (window->priv->fullscreen_controls);
}
gtk_widget_set_visible (window->priv->fullscreen_controls,
gtk_window_is_active (GTK_WINDOW (window)));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment