Commit ab0f5be6 authored by Stepan Salenikovich's avatar Stepan Salenikovich

allow main window to be resized smaller

Certain views/widgets were preventing the ability to resize the
main window to a smaller size. They have either been placed in
resizable containers (GtkScrolledWindow or GtkPaned) or their
properties have been modified such that they can be shrunk.

The account view has also been made to look more consistent with
the rest of the application as a result.

The main window has also been given a bigger default size, since
the previous size was forced by certain widgets.

Change-Id: Id8ee182becb1bee58a9fbf66236d795df54fc0f5
Tuleap: #348
parent 066e33b1
......@@ -39,12 +39,12 @@
struct _AccountView
{
GtkBox parent;
GtkPaned parent;
};
struct _AccountViewClass
{
GtkBoxClass parent_class;
GtkPanedClass parent_class;
};
typedef struct _AccountViewPrivate AccountViewPrivate;
......@@ -64,7 +64,7 @@ struct _AccountViewPrivate
QMetaObject::Connection protocol_selection_changed;
};
G_DEFINE_TYPE_WITH_PRIVATE(AccountView, account_view, GTK_TYPE_BOX);
G_DEFINE_TYPE_WITH_PRIVATE(AccountView, account_view, GTK_TYPE_PANED);
#define ACCOUNT_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ACCOUNT_VIEW_TYPE, AccountViewPrivate))
......@@ -139,6 +139,8 @@ account_selection_changed(GtkTreeSelection *selection, AccountView *view)
/* create account notebook */
priv->current_account_notebook = gtk_notebook_new();
gtk_notebook_set_scrollable(GTK_NOTEBOOK(priv->current_account_notebook), TRUE);
gtk_notebook_set_show_border(GTK_NOTEBOOK(priv->current_account_notebook), FALSE);
gtk_box_pack_start(GTK_BOX(hbox_account), priv->current_account_notebook, TRUE, TRUE, 0);
/* customize account view based on account */
......@@ -393,10 +395,16 @@ account_view_init(AccountView *view)
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(C_("Account alias (name) column", "Alias"), renderer, "text", 1, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(priv->treeview_account_list), column);
g_object_set(G_OBJECT(renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
gtk_tree_view_column_set_expand(column, TRUE);
// set a min width so most of the account name is visible
g_object_set(G_OBJECT(renderer), "width", 75, NULL);
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(C_("Account status column", "Status"), renderer, "text", 3, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(priv->treeview_account_list), column);
g_object_set(G_OBJECT(renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
gtk_tree_view_column_set_expand(column, TRUE);
/* the registration state is an enum, we want to display it as a string */
gtk_tree_view_column_set_cell_data_func(
......
......@@ -26,12 +26,12 @@
struct _GeneralSettingsView
{
GtkBox parent;
GtkScrolledWindow parent;
};
struct _GeneralSettingsViewClass
{
GtkBoxClass parent_class;
GtkScrolledWindowClass parent_class;
};
typedef struct _GeneralSettingsViewPrivate GeneralSettingsViewPrivate;
......@@ -52,7 +52,7 @@ struct _GeneralSettingsViewPrivate
GtkWidget *button_clear_history;
};
G_DEFINE_TYPE_WITH_PRIVATE(GeneralSettingsView, general_settings_view, GTK_TYPE_BOX);
G_DEFINE_TYPE_WITH_PRIVATE(GeneralSettingsView, general_settings_view, GTK_TYPE_SCROLLED_WINDOW);
#define GENERAL_SETTINGS_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GENERAL_SETTINGS_VIEW_TYPE, GeneralSettingsViewPrivate))
......
......@@ -34,12 +34,12 @@
struct _MediaSettingsView
{
GtkBox parent;
GtkScrolledWindow parent;
};
struct _MediaSettingsViewClass
{
GtkBoxClass parent_class;
GtkScrolledWindowClass parent_class;
};
typedef struct _MediaSettingsViewPrivate MediaSettingsViewPrivate;
......@@ -78,7 +78,7 @@ struct _MediaSettingsViewPrivate
QMetaObject::Connection rate_selection;
};
G_DEFINE_TYPE_WITH_PRIVATE(MediaSettingsView, media_settings_view, GTK_TYPE_BOX);
G_DEFINE_TYPE_WITH_PRIVATE(MediaSettingsView, media_settings_view, GTK_TYPE_SCROLLED_WINDOW);
#define MEDIA_SETTINGS_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MEDIA_SETTINGS_VIEW_TYPE, MediaSettingsViewPrivate))
......@@ -142,6 +142,7 @@ connect_combo_box_qmodel(GtkComboBox *box, QAbstractItemModel *qmodel, QItemSele
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(box), renderer, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(box), renderer,
"text", 0, NULL);
g_object_set(G_OBJECT(renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
/* connect signals to and from the selection model */
connection = QObject::connect(
......
......@@ -27,12 +27,12 @@
struct _RingWelcomeView
{
GtkBox parent;
GtkScrolledWindow parent;
};
struct _RingWelcomeViewClass
{
GtkBoxClass parent_class;
GtkScrolledWindowClass parent_class;
};
typedef struct _RingWelcomeViewPrivate RingWelcomeViewPrivate;
......@@ -42,7 +42,7 @@ struct _RingWelcomeViewPrivate
QMetaObject::Connection ringaccount_updated;
};
G_DEFINE_TYPE_WITH_PRIVATE(RingWelcomeView, ring_welcome_view, GTK_TYPE_BOX);
G_DEFINE_TYPE_WITH_PRIVATE(RingWelcomeView, ring_welcome_view, GTK_TYPE_SCROLLED_WINDOW);
#define RING_WELCOME_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), RING_WELCOME_VIEW_TYPE, RingWelcomeViewPrivate))
......@@ -68,13 +68,15 @@ ring_welcome_view_init(RingWelcomeView *self)
{
RingWelcomeViewPrivate *priv = RING_WELCOME_VIEW_GET_PRIVATE(self);
gtk_orientable_set_orientation(GTK_ORIENTABLE(self), GTK_ORIENTATION_VERTICAL);
gtk_box_set_spacing(GTK_BOX(self), 15);
gtk_box_set_baseline_position(GTK_BOX(self), GTK_BASELINE_POSITION_CENTER);
gtk_widget_set_vexpand(GTK_WIDGET(self), TRUE);
gtk_widget_set_hexpand(GTK_WIDGET(self), FALSE);
gtk_widget_set_valign(GTK_WIDGET(self), GTK_ALIGN_CENTER);
gtk_widget_set_halign(GTK_WIDGET(self), GTK_ALIGN_CENTER);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(self), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
auto box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 15);
gtk_container_add(GTK_CONTAINER(self), box);
gtk_box_set_baseline_position(GTK_BOX(box), GTK_BASELINE_POSITION_CENTER);
gtk_widget_set_vexpand(GTK_WIDGET(box), TRUE);
gtk_widget_set_hexpand(GTK_WIDGET(box), FALSE);
gtk_widget_set_valign(GTK_WIDGET(box), GTK_ALIGN_CENTER);
gtk_widget_set_halign(GTK_WIDGET(box), GTK_ALIGN_CENTER);
/* get logo */
GError *error = NULL;
......@@ -85,7 +87,7 @@ ring_welcome_view_init(RingWelcomeView *self)
g_clear_error(&error);
} else {
auto image_ring_logo = gtk_image_new_from_pixbuf(logo);
gtk_box_pack_start(GTK_BOX(self), image_ring_logo, FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(box), image_ring_logo, FALSE, TRUE, 0);
}
/* welcome text */
......@@ -96,7 +98,7 @@ ring_welcome_view_init(RingWelcomeView *self)
/* the max width chars is to limit how much the text expands */
gtk_label_set_max_width_chars(GTK_LABEL(label_welcome_text), 50);
gtk_label_set_selectable(GTK_LABEL(label_welcome_text), TRUE);
gtk_box_pack_start(GTK_BOX(self), label_welcome_text, FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(box), label_welcome_text, FALSE, TRUE, 0);
/* RingID explanation */
auto label_explanation = gtk_label_new(C_("Do not translate \"RingID\"", "This is your RingID.\nCopy and share it with your friends!"));
......@@ -107,7 +109,7 @@ ring_welcome_view_init(RingWelcomeView *self)
gtk_widget_set_margin_top(label_explanation, 20);
/* we migth need to hide the label if a RING account doesn't exist */
gtk_widget_set_no_show_all(label_explanation, TRUE);
gtk_box_pack_start(GTK_BOX(self), label_explanation, FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(box), label_explanation, FALSE, TRUE, 0);
/* RingID label */
auto label_ringid = gtk_label_new(NULL);
......@@ -115,7 +117,7 @@ ring_welcome_view_init(RingWelcomeView *self)
gtk_widget_override_font(label_ringid, pango_font_description_from_string("monospace 12"));
show_ring_id(GTK_LABEL(label_ringid), get_active_ring_account());
gtk_widget_set_no_show_all(label_ringid, TRUE);
gtk_box_pack_start(GTK_BOX(self), label_ringid, FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(box), label_ringid, FALSE, TRUE, 0);
gtk_label_set_ellipsize(GTK_LABEL(label_ringid), PANGO_ELLIPSIZE_END);
if (get_active_ring_account()) {
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.10"/>
<template class="AccountView" parent="GtkBox">
<template class="AccountView" parent="GtkPaned">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<!-- account list on the left pane -->
<child>
<object class="GtkBox" id="hbox_main">
<object class="GtkBox" id="vbox_account_list">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<!-- account list on left side of the box -->
<property name="orientation">vertical</property>
<!-- list of accounts -->
<child>
<object class="GtkBox" id="vbox_account_list">
<object class="GtkScrolledWindow" id="scrolledwindow_account_list">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">none</property>
<property name="hscrollbar_policy">never</property>
<child>
<object class="GtkTreeView" id="treeview_account_list">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<!-- end list of accounts -->
<!-- add remove accounts -->
<child>
<object class="GtkBox" id="hbox_addremove_account">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<!-- list of accounts -->
<property name="orientation">horizontal</property>
<property name="spacing">5</property>
<property name="halign">GTK_ALIGN_CENTER</property>
<!-- remove account -->
<child>
<object class="GtkScrolledWindow" id="scrolledwindow_account_list">
<object class="GtkButton" id="button_remove_account">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="vscrollbar_policy">never</property>
<property name="hscrollbar_policy">never</property>
<child>
<object class="GtkTreeView" id="treeview_account_list">
<object class="GtkLabel" id="label_remove_account">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;&amp;#8722;&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<!-- end list of accounts -->
<!-- add remove accounts -->
<!-- end remove account -->
<!-- add account and type -->
<child>
<object class="GtkBox" id="hbox_addremove_account">
<object class="GtkBox" id="hbox_add_account">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">horizontal</property>
<property name="spacing">5</property>
<property name="halign">GTK_ALIGN_END</property>
<!-- remove account -->
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkButton" id="button_remove_account">
<object class="GtkButton" id="button_add_account">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkLabel" id="label_remove_account">
<object class="GtkLabel" id="label_add_account">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;&amp;#8722;&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;+&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
</child>
<!-- end remove account -->
<!-- add account and type -->
<child>
<object class="GtkBox" id="hbox_add_account">
<object class="GtkComboBox" id="combobox_account_type">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">horizontal</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkButton" id="button_add_account">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkLabel" id="label_add_account">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;+&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkComboBox" id="combobox_account_type">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">0</property>
</object>
</child>
<property name="active">0</property>
</object>
</child>
<!-- end add account type -->
</object>
</child>
<!-- end add remove accounts -->
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<!-- end of account list on left side of box -->
<!-- individual account view -->
<child>
<object class="GtkStack" id="stack_account">
<property name="visible">True</property>
<property name="transition-type">GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT</property>
<property name="transition-duration">300</property>
<!-- end add account type -->
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<!-- end individual account view -->
<!-- end add remove accounts -->
</object>
<!-- <packing>
</packing> -->
</child>
<!-- end of account list on the left pane -->
<!-- individual account view -->
<child>
<object class="GtkStack" id="stack_account">
<property name="visible">True</property>
<property name="transition-type">GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT</property>
<property name="transition-duration">300</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
<!-- <packing>
</packing> -->
</child>
</template>
</interface>
......@@ -8,17 +8,15 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<template class="GeneralSettingsView" parent="GtkBox">
<template class="GeneralSettingsView" parent="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">10</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="vbox_main">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<property name="border_width">10</property>
<!-- start ring settings -->
<child>
<object class="GtkFrame" id="frame_ring_settings">
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.10"/>
<template class="MediaSettingsView" parent="GtkBox">
<template class="MediaSettingsView" parent="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">10</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="vbox_main">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<property name="border_width">10</property>
<!-- start audio selection -->
<child>
<object class="GtkFrame" id="frame_audio_selection">
......@@ -80,6 +78,7 @@
<object class="GtkComboBox" id="combobox_manager">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="popup-fixed-width">False</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -90,6 +89,7 @@
<object class="GtkComboBox" id="combobox_ringtone">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="popup-fixed-width">False</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -100,6 +100,7 @@
<object class="GtkComboBox" id="combobox_output">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="popup-fixed-width">False</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -110,6 +111,7 @@
<object class="GtkComboBox" id="combobox_input">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="popup-fixed-width">False</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -207,6 +209,7 @@
<object class="GtkComboBox" id="combobox_device">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="popup-fixed-width">False</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -217,6 +220,7 @@
<object class="GtkComboBox" id="combobox_channel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="popup-fixed-width">False</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -227,6 +231,7 @@
<object class="GtkComboBox" id="combobox_resolution">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="popup-fixed-width">False</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -237,6 +242,7 @@
<object class="GtkComboBox" id="combobox_framerate">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="popup-fixed-width">False</property>
</object>
<packing>
<property name="left_attach">1</property>
......
......@@ -5,8 +5,8 @@
<template class="RingMainWindow" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="show_menubar">False</property>
<property name="default-width">600</property>
<property name="default-height">300</property>
<property name="default-width">700</property>
<property name="default-height">450</property>
<!-- header definition -->
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
......
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