~ubuntu-branches/ubuntu/maverick/gwhere/maverick

« back to all changes in this revision

Viewing changes to src/gui/gwstatusbarcallback.c

  • Committer: Bazaar Package Importer
  • Author(s): Bart Martens
  • Date: 2007-01-27 16:01:01 UTC
  • mfrom: (2.1.1 feisty)
  • Revision ID: james.westby@ubuntu.com-20070127160101-u673yo4vke03jg26
Tags: 0.2.3.dfsg.1-2
* debian/rules: Convert gwhere.desktop to UTF-8.  Closes: #405137.
* debian/rules: Replace all "extraibles" with "extraíbles" in
  gwhere.desktop.  Closes: #405138.
* debian/copyright: Updated for year 2007.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "data/gwdata.h"
26
26
#include "tools/gwtools.h"
27
27
 
 
28
#include "gwapplicationmanager.h"
 
29
#include "gwhelper.h"
28
30
#include "gwstatusbar.h"
29
31
 
30
32
 
31
 
gint gw_status_bar_put_msg_catalog ( GtkWindow *w, GtkCTree *ctree, GtkCTreeNode *root, gint num, gdouble size)
32
 
{
33
 
        gchar *catalog_name;
 
33
gint gw_status_bar_put_msg_catalog ( GtkWindow *w, GtkCTree *ctree, GtkCTreeNode *root, gint num, gdouble size) {
 
34
        GWDBContext *context = gw_am_get_current_catalog_context ( );
 
35
        GWCatalogPlugin *plugin = (GWCatalogPlugin*)gw_db_context_get_plugin ( context);
 
36
        GWDBCatalog *catalog = NULL;
34
37
        gchar *msg1, *msg2;
 
38
        gchar *tmp = NULL;
35
39
        gint result = -1;
36
 
        gchar *text_utf8[1];
37
40
 
38
41
 
39
42
#ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT
40
43
        g_print ( "*** GW - %s (%d) :: %s() : total size is %e\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, size);
41
44
#endif
42
45
 
43
 
        if ( w != NULL )
44
 
        {
45
 
                if ( catalog_file_info_get_title ( gtk_ctree_node_get_row_data ( ctree, root))!=NULL && strlen ( catalog_file_info_get_title ( gtk_ctree_node_get_row_data ( ctree, root))) > 0 ) {
46
 
                        catalog_name = catalog_file_info_get_title ( gtk_ctree_node_get_row_data ( ctree, root));
47
 
                } else {
48
 
                        catalog_name = catalog_file_info_get_name ( gtk_ctree_node_get_row_data ( ctree, root));
49
 
                }
50
 
 
51
 
                text_utf8[0] = NULL;
52
 
                msg1 = g_strdup_printf ( _( " %s [ %s ], total disks : %d"), catalog_name, catalog_file_info_get_full_name ( gtk_ctree_node_get_row_data ( ctree, root)), num);
53
 
                msg2 = g_strdup_printf ( _( " Listed Items : %d (total size : %s)"), num, (text_utf8[0] = gw_d_byte_to_str_format ( size)));
54
 
 
55
 
                if ( text_utf8[0] != NULL ) {
56
 
                        g_free ( text_utf8[0]);
57
 
                }
 
46
        if ( w != NULL ) {
 
47
                catalog = plugin->gw_db_catalog_get_db_catalog ( context);
 
48
 
 
49
                msg1 = g_strdup_printf ( _( " %s [ %s ], total disks : %d"), gw_helper_db_catalog_get_usefull_name ( catalog), gw_helper_db_catalog_get_full_name ( catalog), num);
 
50
                msg2 = g_strdup_printf ( _( " Listed Items : %d (total size : %s)"), num, (tmp = gw_d_byte_to_str_format ( size)));
 
51
                if ( tmp != NULL ) g_free ( tmp);
58
52
 
59
53
                result = gw_status_bar_put_messages ( w, msg1, msg2);
60
54
 
61
55
                g_free ( msg1);
62
56
                g_free ( msg2);
 
57
                gw_db_catalog_free ( catalog);
 
58
 
 
59
                result = 0;
63
60
        }
64
61
 
 
62
 
65
63
        return result;
66
64
}
67
65
 
68
66
 
69
 
gint gw_status_bar_put_msg_disk ( GtkWindow *w, gchar *name, gchar *type, guint64 capacity, guint64 free, gdouble size, gint num)
70
 
{
 
67
gint gw_status_bar_put_msg_disk ( GtkWindow *w, gchar *name, gchar *type, guint64 capacity, guint64 free, gdouble size, gint num) {
71
68
        gchar *msg1, *msg2;
72
69
        gint result = -1;
73
70
        gchar *text_utf8[2];
77
74
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
78
75
#endif
79
76
 
80
 
        if ( w != NULL )
81
 
        {
 
77
        if ( w != NULL ) {
82
78
                if ( name != NULL && type != NULL) {
83
79
                        text_utf8[0] = NULL;
84
80
                        text_utf8[1] = NULL;
85
81
                        msg1 = g_strdup_printf ( _( " %s [ %s ], capacity : %s, free : %s"), name, type, (text_utf8[0] = gw_ui64_byte_to_str_format ( capacity)), (text_utf8[1] = gw_ui64_byte_to_str_format ( free)));
86
 
                        if ( text_utf8[0] != NULL )
87
 
                        {
 
82
                        if ( text_utf8[0] != NULL ) {
88
83
                                g_free ( text_utf8[0]);
89
84
                        }
90
 
                        if ( text_utf8[1] != NULL )
91
 
                        {
 
85
 
 
86
                        if ( text_utf8[1] != NULL ) {
92
87
                                g_free ( text_utf8[1]);
93
88
                        }
94
89
 
95
 
                        if ( num == -1 )
96
 
                        {
 
90
                        if ( num == -1 ) {
97
91
                                msg2 = g_strdup ( _( " Empty disk"));
98
 
                        }
99
 
                        else if ( num == 0 )
100
 
                        {
 
92
                        } else if ( num == 0 ) {
101
93
                                text_utf8[0] = NULL;
102
94
                                msg2 = g_strdup_printf ( _( " Selected Item : %d (total size : %s)"), 1, (text_utf8[0] = gw_d_byte_to_str_format ( size)));
103
 
                                if ( text_utf8[0] != NULL )
104
 
                                {
 
95
                                if ( text_utf8[0] != NULL ) {
105
96
                                        g_free ( text_utf8[0]);
106
97
                                }
107
 
                        }
108
 
                        else
109
 
                        {
 
98
                        } else {
110
99
                                text_utf8[0] = NULL;
111
100
                                msg2 = g_strdup_printf ( _( " Listed Items : %d (total size : %s)"), num, (text_utf8[0] = gw_d_byte_to_str_format ( size)));
112
101
                                if ( text_utf8[0] != NULL )
134
123
}
135
124
 
136
125
 
137
 
gint gw_status_bar_put_msg_dir ( GtkWindow *w, gchar *name, gdouble size, gint nb_files, gint nb_subfolders, gint num)
138
 
{
 
126
gint gw_status_bar_put_msg_dir ( GtkWindow *w, gchar *name, gdouble size, gint nb_files, gint nb_subfolders, gint num) {
139
127
        gchar *msg1, *msg2;
140
128
        gint result = -1;
141
129
        gchar *text_utf8[2];
145
133
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
146
134
#endif
147
135
 
148
 
        if ( w != NULL )
149
 
        {
 
136
        if ( w != NULL ) {
150
137
                text_utf8[0] = NULL;
151
138
                msg1 = g_strdup_printf ( _( " Folder \"%s\", %s (files %d, subfolders %d)"), name, (text_utf8[0] = gw_d_byte_to_str_format ( size)), nb_files, nb_subfolders);
152
 
                if ( text_utf8[0] != NULL )
153
 
                {
 
139
                if ( text_utf8[0] != NULL ) {
154
140
                        g_free ( text_utf8[0]);
155
141
                }
156
142
 
157
 
                if ( num == 0 )
158
 
                {
 
143
                if ( num == 0 ) {
159
144
                        text_utf8[0] = NULL;
160
145
                        msg2 = g_strdup_printf ( _( " Selected Item : %d (total size : %s)"), 1, (text_utf8[0] = gw_d_byte_to_str_format ( size)));
161
 
                        if ( text_utf8[0] != NULL )
162
 
                        {
 
146
                        if ( text_utf8[0] != NULL ) {
163
147
                                g_free ( text_utf8[0]);
164
148
                        }
165
 
                }
166
 
                else
167
 
                {
 
149
                } else {
168
150
                        text_utf8[0] = NULL;
169
151
                        msg2 = g_strdup_printf ( _( " Listed Items : %d (total size : %s)"), num, (text_utf8[0] = gw_d_byte_to_str_format ( size)));
170
 
                        if ( text_utf8[0] != NULL )
171
 
                        {
 
152
                        if ( text_utf8[0] != NULL ) {
172
153
                                g_free ( text_utf8[0]);
173
154
                        }
174
155
                }
183
164
}
184
165
 
185
166
 
186
 
gint gw_status_bar_put_msg_file ( GtkWindow *w, gchar *name, gdouble size, gchar *date, gint num)
187
 
{
 
167
gint gw_status_bar_put_msg_file ( GtkWindow *w, gchar *name, gdouble size, gchar *date, gint num) {
188
168
        gchar *msg1, *msg2;
189
169
        gint result = -1;
190
170
        gchar *text_utf8[2];
194
174
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
195
175
#endif
196
176
 
197
 
        if ( w != NULL )
198
 
        {
 
177
        if ( w != NULL ) {
199
178
                text_utf8[0] = NULL;
200
179
                msg1 = g_strdup_printf ( _( " %s, %s, %s"), name, (text_utf8[0] = gw_d_byte_to_str_format ( size)), date);
201
 
                if ( text_utf8[0] != NULL )
202
 
                {
 
180
                if ( text_utf8[0] != NULL ) {
203
181
                        g_free ( text_utf8[0]);
204
182
                }
 
183
 
205
184
                text_utf8[0] = NULL;
206
185
                msg2 = g_strdup_printf ( _( " Selected Item : %d (total size : %s)"), num, (text_utf8[0] = gw_d_byte_to_str_format ( size)));
207
 
                if ( text_utf8[0] != NULL )
208
 
                {
 
186
                if ( text_utf8[0] != NULL ) {
209
187
                        g_free ( text_utf8[0]);
210
188
                }
211
189
 
218
196
}
219
197
 
220
198
 
221
 
gint gw_status_bar_set_catalog_explorer_page ( GtkWindow *w, gint n)
222
 
{
 
199
gint gw_status_bar_set_catalog_explorer_page ( GtkWindow *w, gint n) {
223
200
        gchar *msg = NULL;
224
201
        gint result = -1;
225
202
 
228
205
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
229
206
#endif
230
207
 
231
 
        if ( w != NULL )
232
 
        {
 
208
        if ( w != NULL ) {
233
209
                msg = g_strdup_printf ( _( " Selected Item : %d"), n);
234
210
                result = gw_status_bar_put_messages ( w, _( " Catalog explorer"), msg);
235
211
                g_free ( msg);
239
215
}
240
216
 
241
217
 
242
 
gint gw_status_bar_set_catalog_search_page ( GtkWindow *w, gint n)
243
 
{
 
218
gint gw_status_bar_set_catalog_search_page ( GtkWindow *w, gint n) {
244
219
        gchar *msg = NULL;
245
220
        gint result = -1;
246
221
 
249
224
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
250
225
#endif
251
226
 
252
 
        if ( w != NULL )
253
 
        {
 
227
        if ( w != NULL ) {
254
228
                msg = g_strdup_printf ( _( " Selected Item : %d"), n);
255
229
                result = gw_status_bar_put_messages ( w, _( " Search engine"), msg);
256
230
                g_free ( msg);
260
234
}
261
235
 
262
236
 
263
 
gint gw_status_bar_set_catalog_managment_page ( GtkWindow *w)
264
 
{
 
237
gint gw_status_bar_set_catalog_managment_page ( GtkWindow *w) {
265
238
        gint result = -1;
266
239
 
267
240
 
269
242
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
270
243
#endif
271
244
 
272
 
        if ( w != NULL )
273
 
        {
 
245
        if ( w != NULL ) {
274
246
                result = gw_status_bar_put_messages ( w, _( " Catalog managment"), "");
275
247
        }
276
248