summaryrefslogtreecommitdiff
path: root/src/trg-main-window.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-08 13:35:17 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-08 13:35:17 +0000
commit8828a8bcd4ca9d1c53038af0e5d6138920c42b6b (patch)
treedd1e11331902c721f52d4e0d819a46c409b9c8be /src/trg-main-window.c
parent9d4f57555411c56b3fa8daf5b072eeca82b7a666 (diff)
issue 42 - start in tray argument. fix state selector persisting of selection (was out by 1).
Diffstat (limited to 'src/trg-main-window.c')
-rw-r--r--src/trg-main-window.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/trg-main-window.c b/src/trg-main-window.c
index d752347..1fef6bb 100644
--- a/src/trg-main-window.c
+++ b/src/trg-main-window.c
@@ -208,10 +208,11 @@ struct _TrgMainWindowPrivate {
GtkWidget *filterEntry, *filterEntryClearButton;
gint width, height;
+ gboolean min_on_start;
};
enum {
- PROP_0, PROP_CLIENT
+ PROP_0, PROP_CLIENT, PROP_MINIMISE_ON_START
};
static void trg_main_window_init(TrgMainWindow * self G_GNUC_UNUSED) {
@@ -1112,6 +1113,9 @@ static void trg_main_window_get_property(GObject * object, guint property_id,
case PROP_CLIENT:
g_value_set_pointer(value, priv->client);
break;
+ case PROP_MINIMISE_ON_START:
+ g_value_set_boolean(value, priv->min_on_start);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
}
@@ -1124,6 +1128,9 @@ static void trg_main_window_set_property(GObject * object, guint property_id,
case PROP_CLIENT:
priv->client = g_value_get_pointer(value);
break;
+ case PROP_MINIMISE_ON_START:
+ priv->min_on_start = g_value_get_boolean(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
}
@@ -1744,6 +1751,9 @@ static GObject *trg_main_window_constructor(GType type,
trg_widget_set_visible(priv->notebook,
trg_prefs_get_bool(prefs, TRG_PREFS_KEY_SHOW_NOTEBOOK, TRG_PREFS_GLOBAL));
+ if (tray && priv->min_on_start)
+ gtk_widget_hide(GTK_WIDGET(self));
+
return G_OBJECT(self);
}
@@ -1766,6 +1776,18 @@ static void trg_main_window_class_init(TrgMainWindowClass * klass) {
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
| G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB));
+
+ g_object_class_install_property(
+ object_class,
+ PROP_MINIMISE_ON_START,
+ g_param_spec_boolean(
+ "min-on-start",
+ "Min On Start",
+ "Min On Start",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
+ | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK
+ | G_PARAM_STATIC_BLURB));
}
void auto_connect_if_required(TrgMainWindow * win, TrgClient * tc) {
@@ -1782,6 +1804,6 @@ void auto_connect_if_required(TrgMainWindow * win, TrgClient * tc) {
}
}
-TrgMainWindow *trg_main_window_new(TrgClient * tc) {
- return g_object_new(TRG_TYPE_MAIN_WINDOW, "trg-client", tc, NULL);
+TrgMainWindow *trg_main_window_new(TrgClient * tc, gboolean minonstart) {
+ return g_object_new(TRG_TYPE_MAIN_WINDOW, "trg-client", tc, "min-on-start", minonstart, NULL);
}