summaryrefslogtreecommitdiff
path: root/src/terminal-screen-container.c
diff options
context:
space:
mode:
authorPerberos <[email protected]>2011-11-06 19:14:03 -0300
committerPerberos <[email protected]>2011-11-06 19:14:03 -0300
commitf2a13175e5a3a38d1340d2fff5e03f8c2e0d8f8e (patch)
tree5bc248a29ae93e5534428e6908a94d50d419ceb9 /src/terminal-screen-container.c
parentdef492f92d29f294c62d94ef562dd6271bd9b84b (diff)
downloadmate-terminal-f2a13175e5a3a38d1340d2fff5e03f8c2e0d8f8e.tar.bz2
mate-terminal-f2a13175e5a3a38d1340d2fff5e03f8c2e0d8f8e.tar.xz
aplicando formato allman
Diffstat (limited to 'src/terminal-screen-container.c')
-rw-r--r--src/terminal-screen-container.c430
1 files changed, 218 insertions, 212 deletions
diff --git a/src/terminal-screen-container.c b/src/terminal-screen-container.c
index 7aa6265..53865f6 100644
--- a/src/terminal-screen-container.c
+++ b/src/terminal-screen-container.c
@@ -29,27 +29,27 @@
struct _TerminalScreenContainerPrivate
{
- TerminalScreen *screen;
+ TerminalScreen *screen;
#ifdef USE_SCROLLED_WINDOW
- GtkWidget *scrolled_window;
+ GtkWidget *scrolled_window;
#else
- GtkWidget *hbox;
- GtkWidget *vscrollbar;
+ GtkWidget *hbox;
+ GtkWidget *vscrollbar;
#endif
- GtkPolicyType hscrollbar_policy;
- GtkPolicyType vscrollbar_policy;
- GtkCornerType window_placement;
- guint window_placement_set : 1;
+ GtkPolicyType hscrollbar_policy;
+ GtkPolicyType vscrollbar_policy;
+ GtkCornerType window_placement;
+ guint window_placement_set : 1;
};
enum
{
- PROP_0,
- PROP_SCREEN,
- PROP_HSCROLLBAR_POLICY,
- PROP_VSCROLLBAR_POLICY,
- PROP_WINDOW_PLACEMENT,
- PROP_WINDOW_PLACEMENT_SET
+ PROP_0,
+ PROP_SCREEN,
+ PROP_HSCROLLBAR_POLICY,
+ PROP_VSCROLLBAR_POLICY,
+ PROP_WINDOW_PLACEMENT,
+ PROP_WINDOW_PLACEMENT_SET
};
G_DEFINE_TYPE (TerminalScreenContainer, terminal_screen_container, GTK_TYPE_VBOX)
@@ -58,43 +58,44 @@ G_DEFINE_TYPE (TerminalScreenContainer, terminal_screen_container, GTK_TYPE_VBOX
static void
terminal_screen_container_set_placement_internal (TerminalScreenContainer *container,
- GtkCornerType corner)
+ GtkCornerType corner)
{
- TerminalScreenContainerPrivate *priv = container->priv;
+ TerminalScreenContainerPrivate *priv = container->priv;
#ifdef USE_SCROLLED_WINDOW
- gtk_scrolled_window_set_placement (GTK_SCROLLED_WINDOW (priv->scrolled_window), corner);
+ gtk_scrolled_window_set_placement (GTK_SCROLLED_WINDOW (priv->scrolled_window), corner);
#else
- switch (corner) {
- case GTK_CORNER_TOP_LEFT:
- case GTK_CORNER_BOTTOM_LEFT:
- gtk_box_reorder_child (GTK_BOX (priv->hbox), priv->vscrollbar, 1);
- break;
- case GTK_CORNER_TOP_RIGHT:
- case GTK_CORNER_BOTTOM_RIGHT:
- gtk_box_reorder_child (GTK_BOX (priv->hbox), priv->vscrollbar, 0);
- break;
- default:
- g_assert_not_reached ();
- }
+ switch (corner)
+ {
+ case GTK_CORNER_TOP_LEFT:
+ case GTK_CORNER_BOTTOM_LEFT:
+ gtk_box_reorder_child (GTK_BOX (priv->hbox), priv->vscrollbar, 1);
+ break;
+ case GTK_CORNER_TOP_RIGHT:
+ case GTK_CORNER_BOTTOM_RIGHT:
+ gtk_box_reorder_child (GTK_BOX (priv->hbox), priv->vscrollbar, 0);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
#endif
- priv->window_placement = corner;
- g_object_notify (G_OBJECT (container), "window-placement");
+ priv->window_placement = corner;
+ g_object_notify (G_OBJECT (container), "window-placement");
}
static void
terminal_screen_container_set_placement_set (TerminalScreenContainer *container,
- gboolean set)
+ gboolean set)
{
- TerminalScreenContainerPrivate *priv = container->priv;
+ TerminalScreenContainerPrivate *priv = container->priv;
#ifdef USE_SCROLLED_WINDOW
- g_object_set (priv->scrolled_window, "window-placement-set", set, NULL);
+ g_object_set (priv->scrolled_window, "window-placement-set", set, NULL);
#endif
- priv->window_placement_set = set != FALSE;
- g_object_notify (G_OBJECT (container), "window-placement-set");
+ priv->window_placement_set = set != FALSE;
+ g_object_notify (G_OBJECT (container), "window-placement-set");
}
#if defined(USE_SCROLLED_WINDOW) && defined(MATE_ENABLE_DEBUG)
@@ -103,9 +104,9 @@ size_request_cb (GtkWidget *widget,
GtkRequisition *req,
TerminalScreenContainer *container)
{
- _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
- "[screen %p] scrolled-window size req %d : %d\n",
- container->priv->screen, req->width, req->height);
+ _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
+ "[screen %p] scrolled-window size req %d : %d\n",
+ container->priv->screen, req->width, req->height);
}
#endif
@@ -114,66 +115,66 @@ size_request_cb (GtkWidget *widget,
static void
terminal_screen_container_init (TerminalScreenContainer *container)
{
- TerminalScreenContainerPrivate *priv;
+ TerminalScreenContainerPrivate *priv;
- priv = container->priv = TERMINAL_SCREEN_CONTAINER_GET_PRIVATE (container);
+ priv = container->priv = TERMINAL_SCREEN_CONTAINER_GET_PRIVATE (container);
- priv->hscrollbar_policy = GTK_POLICY_AUTOMATIC;
- priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC;
- priv->window_placement = GTK_CORNER_BOTTOM_RIGHT;
- priv->window_placement_set = FALSE;
+ priv->hscrollbar_policy = GTK_POLICY_AUTOMATIC;
+ priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC;
+ priv->window_placement = GTK_CORNER_BOTTOM_RIGHT;
+ priv->window_placement_set = FALSE;
}
static GObject *
terminal_screen_container_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_params)
+ guint n_construct_properties,
+ GObjectConstructParam *construct_params)
{
- GObject *object;
- TerminalScreenContainer *container;
- TerminalScreenContainerPrivate *priv;
+ GObject *object;
+ TerminalScreenContainer *container;
+ TerminalScreenContainerPrivate *priv;
- object = G_OBJECT_CLASS (terminal_screen_container_parent_class)->constructor
- (type, n_construct_properties, construct_params);
+ object = G_OBJECT_CLASS (terminal_screen_container_parent_class)->constructor
+ (type, n_construct_properties, construct_params);
- container = TERMINAL_SCREEN_CONTAINER (object);
- priv = container->priv;
+ container = TERMINAL_SCREEN_CONTAINER (object);
+ priv = container->priv;
- g_assert (priv->screen != NULL);
+ g_assert (priv->screen != NULL);
#ifdef USE_SCROLLED_WINDOW
- priv->scrolled_window = gtk_scrolled_window_new (NULL, vte_terminal_get_adjustment (VTE_TERMINAL (priv->screen)));
-
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
- priv->hscrollbar_policy,
- priv->vscrollbar_policy);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->scrolled_window),
- GTK_SHADOW_NONE);
- gtk_container_add (GTK_CONTAINER (priv->scrolled_window), GTK_WIDGET (priv->screen));
- gtk_widget_show (GTK_WIDGET (priv->screen));
- gtk_box_pack_end (GTK_BOX (container), priv->scrolled_window, TRUE, TRUE, 0);
- gtk_widget_show (priv->scrolled_window);
+ priv->scrolled_window = gtk_scrolled_window_new (NULL, vte_terminal_get_adjustment (VTE_TERMINAL (priv->screen)));
+
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
+ priv->hscrollbar_policy,
+ priv->vscrollbar_policy);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->scrolled_window),
+ GTK_SHADOW_NONE);
+ gtk_container_add (GTK_CONTAINER (priv->scrolled_window), GTK_WIDGET (priv->screen));
+ gtk_widget_show (GTK_WIDGET (priv->screen));
+ gtk_box_pack_end (GTK_BOX (container), priv->scrolled_window, TRUE, TRUE, 0);
+ gtk_widget_show (priv->scrolled_window);
#ifdef MATE_ENABLE_DEBUG
- g_signal_connect (priv->scrolled_window, "size-request", G_CALLBACK (size_request_cb), container);
+ g_signal_connect (priv->scrolled_window, "size-request", G_CALLBACK (size_request_cb), container);
#endif
#else
- priv->hbox = gtk_hbox_new (FALSE, 0);
+ priv->hbox = gtk_hbox_new (FALSE, 0);
- priv->vscrollbar = gtk_vscrollbar_new (vte_terminal_get_adjustment (VTE_TERMINAL (priv->screen)));
+ priv->vscrollbar = gtk_vscrollbar_new (vte_terminal_get_adjustment (VTE_TERMINAL (priv->screen)));
- gtk_box_pack_start (GTK_BOX (priv->hbox), GTK_WIDGET (priv->screen), TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->vscrollbar, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->hbox), GTK_WIDGET (priv->screen), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->hbox), priv->vscrollbar, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (container), priv->hbox, TRUE, TRUE, 0);
- gtk_widget_show_all (priv->hbox);
+ gtk_box_pack_end (GTK_BOX (container), priv->hbox, TRUE, TRUE, 0);
+ gtk_widget_show_all (priv->hbox);
#endif /* USE_SCROLLED_WINDOW */
- _terminal_screen_update_scrollbar (priv->screen);
+ _terminal_screen_update_scrollbar (priv->screen);
- return object;
+ return object;
}
static void
@@ -182,28 +183,29 @@ terminal_screen_container_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- TerminalScreenContainer *container = TERMINAL_SCREEN_CONTAINER (object);
- TerminalScreenContainerPrivate *priv = container->priv;
-
- switch (prop_id) {
- case PROP_SCREEN:
- break;
- case PROP_HSCROLLBAR_POLICY:
- g_value_set_enum (value, priv->hscrollbar_policy);
- break;
- case PROP_VSCROLLBAR_POLICY:
- g_value_set_enum (value, priv->vscrollbar_policy);
- break;
- case PROP_WINDOW_PLACEMENT:
- g_value_set_enum (value, priv->window_placement);
- break;
- case PROP_WINDOW_PLACEMENT_SET:
- g_value_set_boolean (value, priv->window_placement_set);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ TerminalScreenContainer *container = TERMINAL_SCREEN_CONTAINER (object);
+ TerminalScreenContainerPrivate *priv = container->priv;
+
+ switch (prop_id)
+ {
+ case PROP_SCREEN:
+ break;
+ case PROP_HSCROLLBAR_POLICY:
+ g_value_set_enum (value, priv->hscrollbar_policy);
+ break;
+ case PROP_VSCROLLBAR_POLICY:
+ g_value_set_enum (value, priv->vscrollbar_policy);
+ break;
+ case PROP_WINDOW_PLACEMENT:
+ g_value_set_enum (value, priv->window_placement);
+ break;
+ case PROP_WINDOW_PLACEMENT_SET:
+ g_value_set_boolean (value, priv->window_placement_set);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
@@ -212,88 +214,89 @@ terminal_screen_container_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- TerminalScreenContainer *container = TERMINAL_SCREEN_CONTAINER (object);
- TerminalScreenContainerPrivate *priv = container->priv;
-
- switch (prop_id) {
- case PROP_SCREEN:
- priv->screen = g_value_get_object (value);
- break;
- case PROP_HSCROLLBAR_POLICY:
- terminal_screen_container_set_policy (container,
- g_value_get_enum (value),
- priv->vscrollbar_policy);
- break;
- case PROP_VSCROLLBAR_POLICY:
- terminal_screen_container_set_policy (container,
- priv->hscrollbar_policy,
- g_value_get_enum (value));
- break;
- case PROP_WINDOW_PLACEMENT:
- terminal_screen_container_set_placement_internal (container, g_value_get_enum (value));
- break;
- case PROP_WINDOW_PLACEMENT_SET:
- terminal_screen_container_set_placement_set (container, g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ TerminalScreenContainer *container = TERMINAL_SCREEN_CONTAINER (object);
+ TerminalScreenContainerPrivate *priv = container->priv;
+
+ switch (prop_id)
+ {
+ case PROP_SCREEN:
+ priv->screen = g_value_get_object (value);
+ break;
+ case PROP_HSCROLLBAR_POLICY:
+ terminal_screen_container_set_policy (container,
+ g_value_get_enum (value),
+ priv->vscrollbar_policy);
+ break;
+ case PROP_VSCROLLBAR_POLICY:
+ terminal_screen_container_set_policy (container,
+ priv->hscrollbar_policy,
+ g_value_get_enum (value));
+ break;
+ case PROP_WINDOW_PLACEMENT:
+ terminal_screen_container_set_placement_internal (container, g_value_get_enum (value));
+ break;
+ case PROP_WINDOW_PLACEMENT_SET:
+ terminal_screen_container_set_placement_set (container, g_value_get_boolean (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
terminal_screen_container_class_init (TerminalScreenContainerClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (gobject_class, sizeof (TerminalScreenContainerPrivate));
-
- gobject_class->constructor = terminal_screen_container_constructor;
- gobject_class->get_property = terminal_screen_container_get_property;
- gobject_class->set_property = terminal_screen_container_set_property;
-
- g_object_class_install_property
- (gobject_class,
- PROP_SCREEN,
- g_param_spec_object ("screen", NULL, NULL,
- TERMINAL_TYPE_SCREEN,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property
- (gobject_class,
- PROP_HSCROLLBAR_POLICY,
- g_param_spec_enum ("hscrollbar-policy", NULL, NULL,
- GTK_TYPE_POLICY_TYPE,
- GTK_POLICY_AUTOMATIC,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property
- (gobject_class,
- PROP_VSCROLLBAR_POLICY,
- g_param_spec_enum ("vscrollbar-policy", NULL, NULL,
- GTK_TYPE_POLICY_TYPE,
- GTK_POLICY_AUTOMATIC,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property
- (gobject_class,
- PROP_WINDOW_PLACEMENT,
- g_param_spec_enum ("window-placement", NULL, NULL,
- GTK_TYPE_CORNER_TYPE,
- GTK_CORNER_TOP_LEFT,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property
- (gobject_class,
- PROP_WINDOW_PLACEMENT_SET,
- g_param_spec_boolean ("window-placement-set", NULL, NULL,
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (gobject_class, sizeof (TerminalScreenContainerPrivate));
+
+ gobject_class->constructor = terminal_screen_container_constructor;
+ gobject_class->get_property = terminal_screen_container_get_property;
+ gobject_class->set_property = terminal_screen_container_set_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_SCREEN,
+ g_param_spec_object ("screen", NULL, NULL,
+ TERMINAL_TYPE_SCREEN,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_HSCROLLBAR_POLICY,
+ g_param_spec_enum ("hscrollbar-policy", NULL, NULL,
+ GTK_TYPE_POLICY_TYPE,
+ GTK_POLICY_AUTOMATIC,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property
+ (gobject_class,
+ PROP_VSCROLLBAR_POLICY,
+ g_param_spec_enum ("vscrollbar-policy", NULL, NULL,
+ GTK_TYPE_POLICY_TYPE,
+ GTK_POLICY_AUTOMATIC,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_WINDOW_PLACEMENT,
+ g_param_spec_enum ("window-placement", NULL, NULL,
+ GTK_TYPE_CORNER_TYPE,
+ GTK_CORNER_TOP_LEFT,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_WINDOW_PLACEMENT_SET,
+ g_param_spec_boolean ("window-placement-set", NULL, NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
}
/* public API */
@@ -307,9 +310,9 @@ terminal_screen_container_class_init (TerminalScreenContainerClass *klass)
GtkWidget *
terminal_screen_container_new (TerminalScreen *screen)
{
- return g_object_new (TERMINAL_TYPE_SCREEN_CONTAINER,
- "screen", screen,
- NULL);
+ return g_object_new (TERMINAL_TYPE_SCREEN_CONTAINER,
+ "screen", screen,
+ NULL);
}
/**
@@ -321,9 +324,9 @@ terminal_screen_container_new (TerminalScreen *screen)
TerminalScreen *
terminal_screen_container_get_screen (TerminalScreenContainer *container)
{
- g_return_val_if_fail (TERMINAL_IS_SCREEN_CONTAINER (container), NULL);
+ g_return_val_if_fail (TERMINAL_IS_SCREEN_CONTAINER (container), NULL);
- return container->priv->screen;
+ return container->priv->screen;
}
/**
@@ -335,9 +338,9 @@ terminal_screen_container_get_screen (TerminalScreenContainer *container)
TerminalScreenContainer *
terminal_screen_container_get_from_screen (TerminalScreen *screen)
{
- g_return_val_if_fail (TERMINAL_IS_SCREEN (screen), NULL);
+ g_return_val_if_fail (TERMINAL_IS_SCREEN (screen), NULL);
- return TERMINAL_SCREEN_CONTAINER (gtk_widget_get_ancestor (GTK_WIDGET (screen), TERMINAL_TYPE_SCREEN_CONTAINER));
+ return TERMINAL_SCREEN_CONTAINER (gtk_widget_get_ancestor (GTK_WIDGET (screen), TERMINAL_TYPE_SCREEN_CONTAINER));
}
/**
@@ -353,42 +356,45 @@ terminal_screen_container_set_policy (TerminalScreenContainer *container,
GtkPolicyType hpolicy G_GNUC_UNUSED,
GtkPolicyType vpolicy)
{
- TerminalScreenContainerPrivate *priv;
- GObject *object;
+ TerminalScreenContainerPrivate *priv;
+ GObject *object;
- g_return_if_fail (TERMINAL_IS_SCREEN_CONTAINER (container));
+ g_return_if_fail (TERMINAL_IS_SCREEN_CONTAINER (container));
- object = G_OBJECT (container);
- priv = container->priv;
+ object = G_OBJECT (container);
+ priv = container->priv;
- g_object_freeze_notify (object);
+ g_object_freeze_notify (object);
- if (priv->hscrollbar_policy != hpolicy) {
- priv->hscrollbar_policy = hpolicy;
- g_object_notify (object, "hscrollbar-policy");
- }
- if (priv->vscrollbar_policy != vpolicy) {
- priv->vscrollbar_policy = vpolicy;
- g_object_notify (object, "vscrollbar-policy");
- }
+ if (priv->hscrollbar_policy != hpolicy)
+ {
+ priv->hscrollbar_policy = hpolicy;
+ g_object_notify (object, "hscrollbar-policy");
+ }
+ if (priv->vscrollbar_policy != vpolicy)
+ {
+ priv->vscrollbar_policy = vpolicy;
+ g_object_notify (object, "vscrollbar-policy");
+ }
#ifdef USE_SCROLLED_WINDOW
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), hpolicy, vpolicy);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), hpolicy, vpolicy);
#else
- switch (vpolicy) {
- case GTK_POLICY_NEVER:
- gtk_widget_hide (priv->vscrollbar);
- break;
- case GTK_POLICY_AUTOMATIC:
- case GTK_POLICY_ALWAYS:
- gtk_widget_show (priv->vscrollbar);
- break;
- default:
- g_assert_not_reached ();
- }
+ switch (vpolicy)
+ {
+ case GTK_POLICY_NEVER:
+ gtk_widget_hide (priv->vscrollbar);
+ break;
+ case GTK_POLICY_AUTOMATIC:
+ case GTK_POLICY_ALWAYS:
+ gtk_widget_show (priv->vscrollbar);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
#endif
- g_object_thaw_notify (object);
+ g_object_thaw_notify (object);
}
/**
@@ -400,10 +406,10 @@ terminal_screen_container_set_policy (TerminalScreenContainer *container,
*/
void
terminal_screen_container_set_placement (TerminalScreenContainer *container,
- GtkCornerType corner)
+ GtkCornerType corner)
{
- g_return_if_fail (TERMINAL_IS_SCREEN_CONTAINER (container));
+ g_return_if_fail (TERMINAL_IS_SCREEN_CONTAINER (container));
- terminal_screen_container_set_placement_internal (container, corner);
- terminal_screen_container_set_placement_set (container, TRUE);
+ terminal_screen_container_set_placement_internal (container, corner);
+ terminal_screen_container_set_placement_set (container, TRUE);
}