diff options
-rw-r--r-- | src/hig.c | 7 | ||||
-rw-r--r-- | src/trg-main-window.c | 10 | ||||
-rw-r--r-- | src/trg-persistent-tree-view.c | 2 | ||||
-rw-r--r-- | src/trg-preferences-dialog.c | 4 | ||||
-rw-r--r-- | src/trg-remote-prefs-dialog.c | 4 | ||||
-rw-r--r-- | src/util.c | 24 | ||||
-rw-r--r-- | src/util.h | 2 |
7 files changed, 43 insertions, 10 deletions
@@ -12,6 +12,7 @@ #include <gtk/gtk.h> #include "hig.h" +#include "util.h" GtkWidget *hig_workarea_create(void) { @@ -57,7 +58,7 @@ hig_workarea_add_section_title(GtkWidget * t, static GtkWidget *rowNew(GtkWidget * w) { GtkWidget *a; - GtkWidget *h = gtk_hbox_new(FALSE, 0); + GtkWidget *h = trg_hbox_new(FALSE, 0); /* spacer */ a = gtk_alignment_new(0.0f, 0.0f, 0.0f, 0.0f); @@ -178,8 +179,8 @@ GtkWidget *hig_workarea_add_tall_row(GtkWidget * table, GtkWidget * mnemonic) { GtkWidget *l = gtk_label_new_with_mnemonic(mnemonic_string); - GtkWidget *h = gtk_hbox_new(FALSE, 0); - GtkWidget *v = gtk_vbox_new(FALSE, 0); + GtkWidget *h = trg_hbox_new(FALSE, 0); + GtkWidget *v = trg_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(h), l, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(v), h, FALSE, FALSE, GUI_PAD_SMALL); diff --git a/src/trg-main-window.c b/src/trg-main-window.c index 0f21430..1369b44 100644 --- a/src/trg-main-window.c +++ b/src/trg-main-window.c @@ -2631,14 +2631,14 @@ static GObject *trg_main_window_constructor(GType type, g_signal_connect(priv->torrentTreeView, "row-activated", G_CALLBACK(torrent_tv_onRowActivated), self); - outerVbox = gtk_vbox_new(FALSE, 0); + outerVbox = trg_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(self), outerVbox); priv->menuBar = trg_main_window_menu_bar_new(self); gtk_box_pack_start(GTK_BOX(outerVbox), GTK_WIDGET(priv->menuBar), FALSE, FALSE, 0); - toolbarHbox = gtk_hbox_new(FALSE, 0); + toolbarHbox = trg_hbox_new(FALSE, 0); priv->toolBar = trg_main_window_toolbar_new(self); gtk_box_pack_start(GTK_BOX(toolbarHbox), GTK_WIDGET(priv->toolBar), TRUE, TRUE, 0); @@ -2658,8 +2658,14 @@ static GObject *trg_main_window_constructor(GType type, gtk_box_pack_start(GTK_BOX(outerVbox), GTK_WIDGET(toolbarHbox), FALSE, FALSE, 0); +#if GTK_CHECK_VERSION( 3, 0, 0 ) + priv->hpaned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL); + priv->vpaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); +#else priv->vpaned = gtk_vpaned_new(); priv->hpaned = gtk_hpaned_new(); +#endif + gtk_box_pack_start(GTK_BOX(outerVbox), priv->vpaned, TRUE, TRUE, 0); gtk_paned_pack1(GTK_PANED(priv->vpaned), priv->hpaned, TRUE, TRUE); diff --git a/src/trg-persistent-tree-view.c b/src/trg-persistent-tree-view.c index a799529..bb95164 100644 --- a/src/trg-persistent-tree-view.c +++ b/src/trg-persistent-tree-view.c @@ -373,7 +373,7 @@ static GObject *trg_persistent_tree_view_constructor(GType type, construct_params); priv = GET_PRIVATE(object); - hbox = gtk_hbox_new(FALSE, 0); + hbox = trg_hbox_new(FALSE, 0); w = gtk_button_new_from_stock(GTK_STOCK_ADD); g_signal_connect(w, "clicked", diff --git a/src/trg-preferences-dialog.c b/src/trg-preferences-dialog.c index ca57da2..57391f1 100644 --- a/src/trg-preferences-dialog.c +++ b/src/trg-preferences-dialog.c @@ -763,7 +763,7 @@ static GtkWidget *trg_prefs_serverPage(TrgPreferencesDialog * dlg) priv->profileComboBox = trg_prefs_profile_combo_new(priv->client); profileLabel = gtk_label_new(_("Profile: ")); - profileButtonsHbox = gtk_hbox_new(FALSE, 0); + profileButtonsHbox = trg_hbox_new(FALSE, 0); w = gtk_button_new_from_stock(GTK_STOCK_NEW); g_signal_connect(w, "clicked", G_CALLBACK(add_profile_cb), priv->profileComboBox); @@ -831,7 +831,7 @@ static GtkWidget *trg_prefs_serverPage(TrgPreferencesDialog * dlg) hig_workarea_add_row(t, &row, _("Retries:"), w, NULL); frame = gtk_frame_new(NULL); - frameHbox = gtk_hbox_new(FALSE, 2); + frameHbox = trg_hbox_new(FALSE, 2); gtk_box_pack_start(GTK_BOX(frameHbox), profileLabel, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(frameHbox), priv->profileComboBox, FALSE, FALSE, 4); diff --git a/src/trg-remote-prefs-dialog.c b/src/trg-remote-prefs-dialog.c index 6aaf4e0..acf689b 100644 --- a/src/trg-remote-prefs-dialog.c +++ b/src/trg-remote-prefs-dialog.c @@ -219,7 +219,7 @@ static GtkWidget *trg_rprefs_time_widget_new(GList ** wl, JsonObject * obj, const gchar * key, GtkWidget * alt_time_check) { - GtkWidget *hbox = gtk_hbox_new(FALSE, 0); + GtkWidget *hbox = trg_hbox_new(FALSE, 0); GtkWidget *colonLabel = gtk_label_new(":"); GtkWidget *hourSpin = trg_rprefs_timer_widget_spin_new(23, alt_time_check); @@ -253,7 +253,7 @@ static GtkWidget *trg_rprefs_time_begin_end_new(GList ** wl, JsonObject * obj, GtkWidget * alt_time_check) { - GtkWidget *hbox = gtk_hbox_new(FALSE, 0); + GtkWidget *hbox = trg_hbox_new(FALSE, 0); GtkWidget *begin = trg_rprefs_time_widget_new(wl, obj, SGET_ALT_SPEED_TIME_BEGIN, alt_time_check); @@ -583,3 +583,27 @@ gboolean should_be_minimised(int argc, char *argv[]) return FALSE; } + +GtkWidget *trg_hbox_new(gboolean homogeneous, gint spacing) +{ + GtkWidget *box; +#if GTK_CHECK_VERSION( 3, 0, 0 ) + box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, spacing); + gtk_box_set_homogeneous(GTK_BOX(box), homogeneous); +#else + box = gtk_hbox_new(homogenous, spacing); +#endif + return box; +} + +GtkWidget *trg_vbox_new(gboolean homogeneous, gint spacing) +{ + GtkWidget *box; +#if GTK_CHECK_VERSION( 3, 0, 0 ) + box = gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing); + gtk_box_set_homogeneous(GTK_BOX(box), homogeneous); +#else + box = gtk_vbox_new(homogenous, spacing); +#endif + return box; +} @@ -95,5 +95,7 @@ GtkWidget *gtr_combo_box_new_enum(const char *text_1, ...); gboolean should_be_minimised(int argc, char *argv[]); gboolean is_minimised_arg(const gchar * arg); +GtkWidget *trg_vbox_new(gboolean homogeneous, gint spacing); +GtkWidget *trg_hbox_new(gboolean homogeneous, gint spacing); #endif /* UTIL_H_ */ |