[gnome-terminal] Fix tab closing after TerminalScreenContainer changes
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] Fix tab closing after TerminalScreenContainer changes
- Date: Fri, 30 Apr 2010 10:19:15 +0000 (UTC)
commit 14ab5add88684d9d12bdf94980d87c340bf8462d
Author: Christian Persch <chpe gnome org>
Date: Fri Apr 30 12:18:11 2010 +0200
Fix tab closing after TerminalScreenContainer changes
The screen container isn't the screen's immediate parent widget anymore;
change the code to always use
terminal_screen_container_get_from_screen().
src/terminal-screen.c | 4 ++--
src/terminal-window.c | 24 ++++++++++++------------
2 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index ec3d4f7..4237524 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -2163,7 +2163,8 @@ _terminal_screen_update_scrollbar (TerminalScreen *screen)
GtkPolicyType policy = GTK_POLICY_ALWAYS;
GtkCornerType corner = GTK_CORNER_TOP_LEFT;
- if (!GTK_WIDGET (screen)->parent)
+ container = terminal_screen_container_get_from_screen (screen);
+ if (container == NULL)
return;
switch (terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_SCROLLBAR_POSITION))
@@ -2184,7 +2185,6 @@ _terminal_screen_update_scrollbar (TerminalScreen *screen)
break;
}
- container = terminal_screen_container_get_from_screen (screen);
terminal_screen_container_set_placement (container, corner);
terminal_screen_container_set_policy (container, GTK_POLICY_NEVER, policy);
}
diff --git a/src/terminal-window.c b/src/terminal-window.c
index fa4ca84..11b2f78 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -2328,18 +2328,15 @@ terminal_window_remove_screen (TerminalWindow *window,
TerminalScreen *screen)
{
TerminalWindowPrivate *priv = window->priv;
- GtkWidget *scrolled_window;
- guint num_page;
+ TerminalScreenContainer *screen_container;
g_return_if_fail (gtk_widget_get_toplevel (GTK_WIDGET (screen)) == GTK_WIDGET (window));
update_tab_visibility (window, -1);
- scrolled_window = GTK_WIDGET (screen)->parent;
- g_return_if_fail (scrolled_window != NULL);
-
- num_page = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), scrolled_window);
- gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), num_page);
+ screen_container = terminal_screen_container_get_from_screen (screen);
+ gtk_container_remove (GTK_CONTAINER (priv->notebook),
+ GTK_WIDGET (screen_container));
}
void
@@ -2348,7 +2345,7 @@ terminal_window_move_screen (TerminalWindow *source_window,
TerminalScreen *screen,
int dest_position)
{
- GtkWidget *screen_container;
+ TerminalScreenContainer *screen_container;
g_return_if_fail (TERMINAL_IS_WINDOW (source_window));
g_return_if_fail (TERMINAL_IS_WINDOW (dest_window));
@@ -2356,8 +2353,8 @@ terminal_window_move_screen (TerminalWindow *source_window,
g_return_if_fail (gtk_widget_get_toplevel (GTK_WIDGET (screen)) == GTK_WIDGET (source_window));
g_return_if_fail (dest_position >= -1);
- screen_container = GTK_WIDGET (screen)->parent;
- g_return_if_fail (GTK_IS_WIDGET (screen_container));
+ screen_container = terminal_screen_container_get_from_screen (screen);
+ g_assert (TERMINAL_IS_SCREEN_CONTAINER (screen_container));
/* We have to ref the screen container as well as the screen,
* because otherwise removing the screen container from the source
@@ -2512,13 +2509,16 @@ terminal_window_set_size_force_grid (TerminalWindow *window,
void
terminal_window_switch_screen (TerminalWindow *window,
- TerminalScreen *screen)
+ TerminalScreen *screen)
{
TerminalWindowPrivate *priv = window->priv;
+ TerminalScreenContainer *screen_container;
int page_num;
+ screen_container = terminal_screen_container_get_from_screen (screen);
+ g_assert (TERMINAL_IS_SCREEN_CONTAINER (screen_container));
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook),
- GTK_WIDGET (screen)->parent);
+ GTK_WIDGET (screen_container));
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page_num);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]