diff options
-rw-r--r-- | libempathy-gtk/empathy-individual-widget.c | 39 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-widget.ui | 20 |
2 files changed, 56 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c index 172f9e262..de7fbf489 100644 --- a/libempathy-gtk/empathy-individual-widget.c +++ b/libempathy-gtk/empathy-individual-widget.c @@ -88,6 +88,8 @@ typedef struct { /* Individual */ GtkWidget *hbox_presence; + GtkWidget *scrolled_window_individual; + GtkWidget *viewport_individual; GtkWidget *vbox_individual; /* Location */ @@ -1787,6 +1789,8 @@ empathy_individual_widget_init (EmpathyIndividualWidget *self) filename = empathy_file_lookup ("empathy-individual-widget.ui", "libempathy-gtk"); gui = empathy_builder_get_file (filename, + "scrolled_window_individual", &priv->scrolled_window_individual, + "viewport_individual", &priv->viewport_individual, "vbox_individual_widget", &vbox_individual_widget, "vbox_individual", &priv->vbox_individual, "vbox_location", &priv->vbox_location, @@ -1817,6 +1821,40 @@ empathy_individual_widget_init (EmpathyIndividualWidget *self) } static void +constructed (GObject *object) +{ + GObjectClass *klass = G_OBJECT_CLASS (empathy_individual_widget_parent_class); + EmpathyIndividualWidgetPriv *priv = GET_PRIV (object); + GtkScrolledWindow *scrolled_window = + GTK_SCROLLED_WINDOW (priv->scrolled_window_individual); + + /* Allow scrolling of the list of Personas if we're showing Personas. */ + if (priv->flags & EMPATHY_INDIVIDUAL_WIDGET_SHOW_PERSONAS) + { + gtk_scrolled_window_set_shadow_type (scrolled_window, GTK_SHADOW_IN); + gtk_scrolled_window_set_policy (scrolled_window, + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + + gtk_container_set_border_width (GTK_CONTAINER (priv->viewport_individual), + 6); + gtk_widget_set_size_request (GTK_WIDGET (scrolled_window), -1, 100); + } + else + { + gtk_scrolled_window_set_shadow_type (scrolled_window, GTK_SHADOW_NONE); + gtk_scrolled_window_set_policy (scrolled_window, + GTK_POLICY_NEVER, GTK_POLICY_NEVER); + + gtk_container_set_border_width (GTK_CONTAINER (priv->viewport_individual), + 0); + } + + /* Chain up */ + if (klass->constructed != NULL) + klass->constructed (object); +} + +static void get_property (GObject *object, guint param_id, GValue *value, @@ -1884,6 +1922,7 @@ empathy_individual_widget_class_init (EmpathyIndividualWidgetClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->constructed = constructed; object_class->get_property = get_property; object_class->set_property = set_property; object_class->dispose = dispose; diff --git a/libempathy-gtk/empathy-individual-widget.ui b/libempathy-gtk/empathy-individual-widget.ui index d7f482696..75edd86ba 100644 --- a/libempathy-gtk/empathy-individual-widget.ui +++ b/libempathy-gtk/empathy-individual-widget.ui @@ -5,11 +5,25 @@ <object class="GtkVBox" id="vbox_individual_widget"> <property name="spacing">6</property> <child> - <object class="GtkVBox" id="vbox_individual"> + <object class="GtkScrolledWindow" id="scrolled_window_individual"> + <property name="hscrollbar-policy">never</property> + <property name="vscrollbar-policy">never</property><!-- Modified in code when necessary --> + <property name="shadow-type">none</property><!-- Modified in code when necessary --> <property name="visible">True</property> - <property name="spacing">6</property> <child> - <placeholder/> + <object class="GtkViewport" id="viewport_individual"> + <property name="shadow-type">none</property> + <property name="visible">True</property> + <child> + <object class="GtkVBox" id="vbox_individual"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <placeholder/> + </child> + </object> + </child> + </object> </child> </object> <packing> |