bzr branch
http://gegoxaren.bato24.eu/bzr/gpump/trunk
|
1
by Gustav Hartvigsson
Initial code. |
1 |
/* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil
|
2 |
* vi: set shiftwidth=2 tabstop=2 expandtab:
|
|
3 |
* :indentSize=2:tabSize=2:noTabs=true:
|
|
4 |
*/
|
|
5 |
||
6 |
#include "GPumpApp.h" |
|
7 |
||
|
3
by Gustav Hartvigsson
Something is wrong with GtkListStore it seems, |
8 |
#define GPUMP_APP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj),\
|
9 |
GPUMP_TYPE_APP, GPumpAppPrivate))
|
|
|
1
by Gustav Hartvigsson
Initial code. |
10 |
|
11 |
G_DEFINE_TYPE (GPumpApp, gpump_app, GTK_TYPE_APPLICATION) |
|
12 |
||
13 |
struct GPumpAppPrivate { |
|
14 |
|
|
15 |
GSettings * ui_settings; |
|
16 |
GSettings * login_settings; |
|
17 |
|
|
18 |
/* Widgets */ |
|
19 |
GtkWidget * window; |
|
20 |
GtkWidget * header_bar; |
|
21 |
GtkWidget * layout; /* GtkBox */ |
|
22 |
GtkWidget * post_list_view; /* GtkTreeView */ |
|
|
3
by Gustav Hartvigsson
Something is wrong with GtkListStore it seems, |
23 |
|
24 |
/* List store */ |
|
|
1
by Gustav Hartvigsson
Initial code. |
25 |
GtkListStore * post_list_store; |
26 |
};
|
|
27 |
||
28 |
/* * Callback and private function declarations *******************************/
|
|
29 |
void gpump_app_class_init (GPumpAppClass * klass); |
|
30 |
void gpump_app_activate (GApplication * application); |
|
31 |
void gpump_app_init (GPumpApp * self); |
|
32 |
||
|
3
by Gustav Hartvigsson
Something is wrong with GtkListStore it seems, |
33 |
typedef enum { |
34 |
GPUPM_APP_MAIN_LIST_COL = 0, |
|
35 |
GPUMP_APP_MAIN_LIST_NUM_COL |
|
36 |
} GPumpAppCols; |
|
37 |
||
|
1
by Gustav Hartvigsson
Initial code. |
38 |
/* * Class functions **********************************************************/
|
39 |
GPumpApp * gpump_app_new (void) { |
|
40 |
GPumpApp * self = g_object_new (GPUMP_TYPE_APP, |
|
41 |
"application-id", "org.gego.gpump", |
|
42 |
"flags",G_APPLICATION_FLAGS_NONE, |
|
43 |
NULL); |
|
44 |
return self; |
|
45 |
}
|
|
46 |
||
47 |
void gpump_app_init (GPumpApp * self) { |
|
|
3
by Gustav Hartvigsson
Something is wrong with GtkListStore it seems, |
48 |
// GPumpAppPrivate * priv = GPUMP_APP_GET_PRIVATE (self); |
49 |
/* Nothing to be done here? */ |
|
|
1
by Gustav Hartvigsson
Initial code. |
50 |
}
|
51 |
||
52 |
void gpump_app_class_init (GPumpAppClass * klass) { |
|
53 |
g_print("GPumpApp class init.\n"); |
|
54 |
|
|
55 |
// GObject * object_class = G_OBJECT_CLASS (klass); |
|
56 |
GApplicationClass * application_class = G_APPLICATION_CLASS (klass); |
|
57 |
|
|
58 |
application_class->activate = gpump_app_activate; |
|
59 |
|
|
60 |
g_type_class_add_private (klass, sizeof(GPumpApp)); |
|
61 |
|
|
62 |
g_print ("GPumpApp class init done.\n"); |
|
63 |
}
|
|
64 |
||
65 |
||
66 |
void gpump_app_activate (GApplication * application) { |
|
67 |
g_print ("GPumpApp activate.\n"); |
|
68 |
|
|
|
3
by Gustav Hartvigsson
Something is wrong with GtkListStore it seems, |
69 |
/* Creating widgets */ |
70 |
GPumpAppPrivate * priv = GPUMP_APP_GET_PRIVATE (application); |
|
71 |
GtkWidget * window = priv->window = |
|
72 |
gtk_application_window_new (GTK_APPLICATION (application)); |
|
73 |
GtkWidget * header_bar = priv->header_bar = gtk_header_bar_new (); |
|
74 |
GtkWidget * layout = priv->layout = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); |
|
75 |
|
|
76 |
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header_bar), TRUE); |
|
77 |
|
|
78 |
GtkListStore * post_list_store = priv->post_list_store = |
|
79 |
gtk_list_store_new ( GPUMP_APP_MAIN_LIST_NUM_COL, GTK_TYPE_WIDGET); |
|
80 |
|
|
81 |
GtkWidget * post_list_view = priv->post_list_view = |
|
82 |
gtk_tree_view_new (); |
|
83 |
|
|
84 |
|
|
85 |
gtk_tree_view_set_model (GTK_TREE_VIEW (post_list_view), GTK_TREE_MODEL(post_list_store)); |
|
86 |
|
|
87 |
/* adding widgets */ |
|
88 |
gtk_window_set_titlebar (GTK_WINDOW (window), header_bar); |
|
89 |
|
|
90 |
gtk_box_pack_start (GTK_BOX (layout), post_list_view, TRUE, TRUE, 1); |
|
91 |
|
|
92 |
gtk_container_add (GTK_CONTAINER (window), layout); |
|
93 |
|
|
94 |
/* Show it! */ |
|
95 |
gtk_widget_show_all (GTK_WIDGET(window)); |
|
|
1
by Gustav Hartvigsson
Initial code. |
96 |
|
97 |
g_print ("done GPumpApp activate.\n"); |
|
98 |
}
|
|
99 |
||
100 |
||
101 |
||
102 |
/* * Callback implemenations **************************************************/
|
|
103 |