Irreco for N900 (Maemo 5) update. Push for 0.8.* changes.
[irreco.git] / irreco / src / core / irreco_remote_upload_dlg.c
blobe0eb9eeb5bae44289fe173e0cf486dc5150fe73c
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2008 Joni Kokko (t5kojo01@students.oamk.fi)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "irreco_remote_upload_dlg.h"
21 #include "irreco_login_dlg.h"
22 #include "irreco_theme_upload_dlg.h"
23 #include "irreco_webdb_upload_dlg.h"
24 #include "irreco_webdb_cache.h"
26 /** Loader states. */
27 enum
29 LOADER_STATE_INIT,
30 LOADER_STATE_CONFIGURATIONS,
31 LOADER_STATE_THEMES,
32 LOADER_STATE_END
36 /**
37 * @addtogroup IrrecoRemoteUploadDlg
38 * @ingroup Irreco
40 * @todo PURPOCE OF CLASS.
42 * @{
45 /**
46 * @file
47 * Source file of @ref IrrecoRemoteUploadDlg.
51 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
52 /* Prototypes */
53 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
55 void irreco_remote_upload_dlg_comment_size_request(GtkWidget *widget,
56 GtkRequisition *requisition,
57 IrrecoRemoteUploadDlg *self);
59 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
60 /* Construction & Destruction */
61 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
63 /**
64 * @name Construction & Destruction
65 * @{
68 G_DEFINE_TYPE(IrrecoRemoteUploadDlg, irreco_remote_upload_dlg, IRRECO_TYPE_DLG)
70 static void irreco_remote_upload_dlg_dispose(GObject *object)
72 G_OBJECT_CLASS(irreco_remote_upload_dlg_parent_class)->dispose(object);
75 static void irreco_remote_upload_dlg_finalize(GObject *object)
77 G_OBJECT_CLASS(irreco_remote_upload_dlg_parent_class)->finalize(object);
80 static void irreco_remote_upload_dlg_class_init(
81 IrrecoRemoteUploadDlgClass *klass)
83 GObjectClass *object_class = G_OBJECT_CLASS (klass);
86 object_class->dispose = irreco_remote_upload_dlg_dispose;
87 object_class->finalize = irreco_remote_upload_dlg_finalize;
90 static void irreco_remote_upload_dlg_init(IrrecoRemoteUploadDlg *self)
92 GtkWidget *table;
93 GtkWidget *label_category;
94 GtkWidget *label_manufacturer;
95 GtkWidget *label_model;
96 GtkWidget *label_comment;
97 GtkWidget *align;
98 GtkWidget *comment_frame;
99 IRRECO_ENTER
101 self->remote_uploaded = FALSE;
103 /* Build the dialog */
104 gtk_window_set_title(GTK_WINDOW(self), _("Upload Remote"));
105 gtk_window_set_modal(GTK_WINDOW(self), TRUE);
106 gtk_window_set_destroy_with_parent(GTK_WINDOW(self), TRUE);
107 gtk_dialog_set_has_separator(GTK_DIALOG(self), FALSE);
108 gtk_dialog_add_buttons(GTK_DIALOG(self),
109 GTK_STOCK_OK, GTK_RESPONSE_OK,
110 NULL);
112 /* labels */
114 label_category = gtk_label_new("Category: ");
115 label_manufacturer = gtk_label_new("Manufacturer: ");
116 label_model = gtk_label_new("Model: ");
117 label_comment = gtk_label_new("Comment: ");
119 gtk_misc_set_alignment(GTK_MISC(label_category), 0, 0.5);
120 gtk_misc_set_alignment(GTK_MISC(label_manufacturer), 0, 0.5);
121 gtk_misc_set_alignment(GTK_MISC(label_model), 0, 0.5);
122 gtk_misc_set_alignment(GTK_MISC(label_comment), 0, 0.5);
124 /* entries */
126 self->category = gtk_combo_box_entry_new_text();
127 self->manufacturer = gtk_combo_box_entry_new_text();
128 self->model = gtk_entry_new();
130 /* comment textview */
132 self->comment = gtk_text_view_new();
133 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(self->comment),
134 GTK_WRAP_WORD_CHAR);
136 comment_frame = gtk_frame_new(NULL);
137 gtk_container_add(GTK_CONTAINER(comment_frame), self->comment);
139 /* table */
141 table = gtk_table_new(5, 2, FALSE);
143 gtk_table_attach(GTK_TABLE(table), label_category, 0, 1, 0, 1,
144 GTK_FILL, GTK_FILL, 0, 2);
145 gtk_table_attach(GTK_TABLE(table), label_manufacturer, 0, 1, 1, 2,
146 GTK_FILL, GTK_FILL, 0, 2);
147 gtk_table_attach(GTK_TABLE(table), label_model, 0, 1, 2, 3,
148 GTK_FILL, GTK_FILL, 0, 2);
149 gtk_table_attach(GTK_TABLE(table), label_comment, 0, 1, 3, 4,
150 GTK_FILL, GTK_FILL, 0, 2);
151 gtk_table_attach(GTK_TABLE(table), self->category, 1, 2, 0, 1,
152 GTK_FILL, GTK_FILL, 0, 2);
153 gtk_table_attach(GTK_TABLE(table), self->manufacturer, 1, 2, 1, 2,
154 GTK_FILL, GTK_FILL, 0, 2);
155 gtk_table_attach(GTK_TABLE(table), self->model, 1, 2, 2, 3,
156 GTK_FILL, GTK_FILL, 0, 0);
157 gtk_table_attach(GTK_TABLE(table), comment_frame, 0, 2, 4, 5,
158 GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
160 /* scroll */
162 self->scroll = gtk_scrolled_window_new(NULL, NULL);
163 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(self->scroll),
164 GTK_POLICY_NEVER,
165 GTK_POLICY_AUTOMATIC);
166 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(self->scroll),
167 table);
169 /* alignment */
171 align = gtk_alignment_new(0.5, 0.5, 1, 1);
172 gtk_alignment_set_padding(GTK_ALIGNMENT(align), 12, 12, 12, 12);
174 gtk_container_add(GTK_CONTAINER(align), self->scroll);
175 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(self)->vbox),
176 GTK_WIDGET(align));
178 /* Signals */
179 g_signal_connect(G_OBJECT(self->comment), "size-request", G_CALLBACK(
180 irreco_remote_upload_dlg_comment_size_request), self);
182 gtk_widget_set_size_request(GTK_WIDGET(self), -1, 280);
184 gtk_widget_show_all(GTK_WIDGET(self));
186 IRRECO_RETURN
189 IrrecoRemoteUploadDlg* irreco_remote_upload_dlg_new(IrrecoData *irreco_data,
190 GtkWindow *parent)
192 IrrecoRemoteUploadDlg *self;
193 IRRECO_ENTER
195 self = g_object_new(IRRECO_TYPE_REMOTE_UPLOAD_DLG, NULL);
196 irreco_dlg_set_parent(IRRECO_DLG(self), parent);
197 self->irreco_data = irreco_data;
198 IRRECO_RETURN_PTR(self);
202 /** @} */
206 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
207 /* Private Functions */
208 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
211 * @name Private Functions
212 * @{
215 gboolean irreco_remote_upload_dlg_populate_category(IrrecoRemoteUploadDlg *self)
217 IrrecoStringTable *categories = NULL;
218 IrrecoWebdbCache *webdb_cache;
219 IRRECO_ENTER
221 webdb_cache = irreco_data_get_webdb_cache(self->irreco_data, FALSE);
223 /* Get categories */
224 if(irreco_webdb_cache_get_all_categories(webdb_cache, &categories)) {
225 IRRECO_STRING_TABLE_FOREACH_KEY(categories, key)
227 gtk_combo_box_append_text(
228 GTK_COMBO_BOX(self->category), key);
230 IRRECO_STRING_TABLE_FOREACH_END
231 } else {
232 irreco_error_dlg(GTK_WINDOW(self),
233 irreco_webdb_cache_get_error(webdb_cache));
234 IRRECO_RETURN_BOOL(FALSE);
237 if (categories != NULL) irreco_string_table_free(categories);
239 IRRECO_RETURN_BOOL(TRUE);
242 gboolean irreco_remote_upload_dlg_populate_manufacturer(
243 IrrecoRemoteUploadDlg *self)
245 IrrecoStringTable *manufacturers = NULL;
246 IrrecoWebdbCache *webdb_cache;
247 IRRECO_ENTER
249 webdb_cache = irreco_data_get_webdb_cache(self->irreco_data, FALSE);
251 /* Get manufacturers */
252 if(irreco_webdb_cache_get_all_manufacturers(webdb_cache,
253 &manufacturers)) {
254 IRRECO_STRING_TABLE_FOREACH_KEY(manufacturers, key)
256 gtk_combo_box_append_text(
257 GTK_COMBO_BOX(self->manufacturer), key);
259 IRRECO_STRING_TABLE_FOREACH_END
260 } else {
261 irreco_error_dlg(GTK_WINDOW(self),
262 irreco_webdb_cache_get_error(webdb_cache));
263 IRRECO_RETURN_BOOL(FALSE);
266 if (manufacturers != NULL) irreco_string_table_free(manufacturers);
267 IRRECO_RETURN_BOOL(TRUE);
270 gboolean irreco_remote_upload_dlg_send(IrrecoRemoteUploadDlg *self)
272 IrrecoWebdbCache *webdb_cache;
273 IrrecoButtonLayout *layout;
274 gboolean rvalue = FALSE;
275 IRRECO_ENTER
276 webdb_cache = irreco_data_get_webdb_cache(self->irreco_data, FALSE);
277 layout = self->irreco_data->window_manager->current_layout;
279 switch (self->loader_state) {
281 case LOADER_STATE_INIT: {
282 gchar *category = NULL;
283 gchar *manufacturer = NULL;
284 const gchar *model;
285 gchar *comment = NULL;
286 GtkTextIter start;
287 GtkTextIter end;
288 GtkTextBuffer *buffer;
289 GString *path = g_string_new(irreco_get_config_dir("irreco"));
290 gchar *file_data = NULL;
291 gint file_length;
292 IRRECO_DEBUG("LOADER_STATE_INIT");
294 category = gtk_combo_box_get_active_text(
295 GTK_COMBO_BOX(self->category));
297 manufacturer = gtk_combo_box_get_active_text(
298 GTK_COMBO_BOX(self->manufacturer));
300 model = gtk_entry_get_text(GTK_ENTRY(self->model));
302 /* Set new name */
303 if (irreco_string_table_exists(
304 self->irreco_data->irreco_layout_array, model) &&
305 !g_str_equal(layout->name->str, model)) {
306 irreco_error_dlg(GTK_WINDOW(self),
307 _(IRRECO_LAYOUT_NAME_COLLISION));
308 goto end_init;
311 if (!irreco_string_table_change_key(
312 self->irreco_data->irreco_layout_array, layout->name->str,
313 model)) {
314 irreco_error_dlg(GTK_WINDOW(self),
315 "Incompatible model");
316 goto end_init;
319 irreco_config_save_layouts(self->irreco_data);
321 /* comment */
323 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(self->comment));
324 gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(buffer), &start);
325 gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(buffer), &end);
326 comment = gtk_text_buffer_get_text(GTK_TEXT_BUFFER(buffer),
327 &start, &end, FALSE);
329 /* data */
331 g_string_append_printf(path,"/%s",layout->filename->str);
332 file_length = irreco_file_length(path->str);
333 file_data = g_malloc0(file_length);
335 /* check errors */
337 if (!irreco_read_text_file(path->str, file_data, file_length)) {
338 irreco_error_dlg(GTK_WINDOW(self),
339 "Can't open layout file.");
340 goto end_init;
343 if (strlen(category) == 0) {
344 irreco_error_dlg(GTK_WINDOW(self),
345 "Empty category field.");
346 goto end_init;
349 if (strlen(manufacturer) == 0) {
350 irreco_error_dlg(GTK_WINDOW(self),
351 "Empty manufacturer field.");
352 goto end_init;
355 if (strlen(model) == 0) {
356 irreco_error_dlg(GTK_WINDOW(self),
357 "Empty model field.");
358 goto end_init;
361 if (strlen(comment) == 0) {
362 irreco_error_dlg(GTK_WINDOW(self),
363 "Empty comment field.");
364 goto end_init;
367 /* Show login dialog */
369 if (!irreco_show_login_dlg(self->irreco_data, GTK_WINDOW(self),
370 &self->user_name, &self->password)) {
371 IRRECO_DEBUG("Failed login\n");
372 goto end_init;
375 /* create remote to db */
377 self->remote_id = irreco_webdb_cache_create_new_remote(
378 webdb_cache, comment, category,
379 manufacturer, model, layout->filename->str,
380 file_data, self->user_name, self->password);
383 if (self->remote_id != 0) {
384 rvalue = TRUE;
386 end_init:
387 if (category != NULL) g_free(category);
388 if (manufacturer != NULL) g_free(manufacturer);
389 if (comment != NULL) g_free(comment);
390 if (file_data != NULL) g_free(file_data);
391 g_string_free(path, FALSE);
393 if (rvalue == TRUE) {
394 self->loader_state = LOADER_STATE_CONFIGURATIONS;
395 } else {
396 self->loader_state = LOADER_STATE_END;
399 IRRECO_RETURN_BOOL(TRUE);
401 case LOADER_STATE_CONFIGURATIONS: {
402 IrrecoStringTable *devices = NULL;
403 IRRECO_DEBUG("LOADER_STATE_CONFIGURATIONS\n");
405 if (!irreco_layout_get_backends(self->irreco_data,
406 layout->name->str,
407 &devices)) {
408 goto end_configurations;
410 IRRECO_STRING_TABLE_FOREACH(devices, name,
411 IrrecoBackendInstance *, instance) {
412 IrrecoBackendFileContainer *file = NULL;
413 gint id;
414 if (!irreco_backend_instance_export_conf(instance, name,
415 &file)) {
416 self->loader_state = LOADER_STATE_END;
417 IRRECO_DEBUG("exporting error\n");
418 goto end_configurations;
420 id = irreco_webdb_cache_get_config_id(webdb_cache,
421 file->hash->str,
422 file->name->str);
424 if (id == 0) {
425 if (!irreco_show_webdb_upload_dlg(
426 self->irreco_data, GTK_WINDOW(self),
427 file, name, self->user_name,
428 self->password)) {
429 self->loader_state = LOADER_STATE_END;
430 IRRECO_DEBUG("Uploading aborted\n");
431 goto end_configurations;
434 id = irreco_webdb_cache_get_config_id(
435 webdb_cache,
436 file->hash->str,
437 file->name->str);
441 /* Append configuration to remote */
443 if (id != 0) {
444 irreco_webdb_cache_add_configuration_to_remote(
445 webdb_cache, self->remote_id, id,
446 self->user_name, self->password);
449 if (file != NULL) {
450 irreco_backend_file_container_free(file);
451 file = NULL;
454 IRRECO_STRING_TABLE_FOREACH_END
456 self->loader_state = LOADER_STATE_THEMES;
458 end_configurations:
459 if (devices != NULL) irreco_string_table_free(devices);
460 IRRECO_RETURN_BOOL(TRUE);
462 case LOADER_STATE_THEMES: {
463 IrrecoStringTable *themes = NULL;
464 IRRECO_DEBUG("LOADER_STATE_THEMES\n");
466 if (!irreco_layout_get_themes(self->irreco_data,
467 layout->name->str, &themes)) {
468 goto end_themes;
471 IRRECO_STRING_TABLE_FOREACH(themes, name, gchar *, date) {
472 gint id;
473 id = irreco_webdb_cache_get_theme_id_by_name_and_date(
474 webdb_cache, name, date);
476 if (id == 0) {
478 /* Get theme */
480 IrrecoTheme *theme;
481 irreco_string_table_get(
482 self->irreco_data->theme_manager->themes,
483 name, (gpointer*) &theme);
485 /* Upload theme to database */
487 if (!irreco_theme_upload_dlg_run(GTK_WINDOW(self),
488 self->irreco_data,
489 theme,
490 self->user_name,
491 self->password)) {
492 goto end_themes;
495 id = irreco_webdb_cache_get_theme_id_by_name_and_date(
496 webdb_cache, theme->name->str,
497 theme->version->str);
500 /* Append theme to remote */
502 if (id != 0) {
503 irreco_webdb_cache_add_theme_to_remote(webdb_cache,
504 self->remote_id,
506 self->user_name,
507 self->password);
510 IRRECO_STRING_TABLE_FOREACH_END
512 /* Set remote downloadable to TRUE */
514 irreco_webdb_cache_set_remote_downloadable(webdb_cache,
515 self->remote_id,
516 TRUE,
517 self->user_name,
518 self->password);
520 irreco_info_dlg(GTK_WINDOW(self),
521 "Remote uploaded successfully!");
522 self->remote_uploaded = TRUE;
524 /* Clean cache */
525 if (webdb_cache->remote_id_hash != NULL) {
526 g_hash_table_remove_all(webdb_cache->remote_id_hash);
528 if (webdb_cache->remote_categories != NULL) {
529 irreco_string_table_free(
530 webdb_cache->remote_categories);
531 webdb_cache->remote_categories = NULL;
534 end_themes:
535 if (themes != NULL) irreco_string_table_free(themes);
537 self->loader_state = LOADER_STATE_END;
538 IRRECO_RETURN_BOOL(TRUE);
540 case LOADER_STATE_END:
541 IRRECO_DEBUG("LOADER_STATE_END\n");
542 g_source_remove(self->loader_func_id);
544 if (self->remote_uploaded == TRUE) {
545 gtk_dialog_response(GTK_DIALOG(self),
546 GTK_RESPONSE_DELETE_EVENT);
550 IRRECO_RETURN_BOOL(FALSE);
553 /** @} */
557 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
558 /* Public Functions */
559 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
562 * @name Public Functions
563 * @{
566 void irreco_show_remote_upload_dlg(IrrecoData *irreco_data, GtkWindow *parent)
568 IrrecoRemoteUploadDlg *self;
569 gboolean loop = TRUE;
570 IrrecoButtonLayout *layout =
571 irreco_data->window_manager->current_layout;
572 IrrecoStringTable *themes = NULL;
573 gboolean deb_theme_in_layout = FALSE;
574 IrrecoStringTable *devices = NULL;
575 GString* instance_number = g_string_new("");
576 IRRECO_ENTER
578 self = irreco_remote_upload_dlg_new(irreco_data, parent);
580 irreco_remote_upload_dlg_populate_category(self);
581 irreco_remote_upload_dlg_populate_manufacturer(self);
582 gtk_entry_set_text(GTK_ENTRY(self->model),
583 irreco_button_layout_get_name(layout));
585 irreco_layout_get_themes(irreco_data, layout->name->str, &themes);
586 IRRECO_STRING_TABLE_FOREACH_KEY(themes, theme_name)
587 IrrecoTheme *theme;
588 irreco_string_table_get(irreco_data->theme_manager->themes,
589 theme_name, (gpointer *) &theme);
590 if (g_str_equal(theme->source->str, "deb")) {
591 deb_theme_in_layout = TRUE;
593 IRRECO_STRING_TABLE_FOREACH_END
595 if (deb_theme_in_layout) {
596 irreco_error_dlg(GTK_WINDOW(self),
597 "You can't upload remotes with Build In themes "
598 "please check buttons and backgrounds.");
599 goto end;
602 irreco_layout_get_backends(irreco_data, layout->name->str, &devices);
603 IRRECO_STRING_TABLE_FOREACH(devices, name,
604 IrrecoBackendInstance *, instance)
605 if (!(instance->lib->api->flags &
606 IRRECO_BACKEND_CONFIGURATION_EXPORT)) {
607 GString *error_msg = g_string_new("");
608 g_string_printf(error_msg,
609 "\"%s\" backend doesn't support "
610 "exporting its configuration...",
611 instance->name->str);
612 irreco_error_dlg(GTK_WINDOW(self), error_msg->str);
613 g_string_free(error_msg, FALSE);
614 goto end;
617 g_string_printf(instance_number, "%s", instance->name->str);
618 g_string_erase(instance_number, 0, instance->name->len - 1);
619 if (!g_str_equal(instance_number->str, "1")) {
620 GString *error_msg = g_string_new("");
621 g_string_printf(error_msg,
622 "Remote contains commands from\n"
623 "\"%s\"\nYou can't upload remotes where\n"
624 "instance number differs from \"1\"",
625 instance->name->str);
626 irreco_error_dlg(GTK_WINDOW(self), error_msg->str);
627 g_string_free(error_msg, FALSE);
628 goto end;
630 IRRECO_STRING_TABLE_FOREACH_END
632 do {
633 gint response = gtk_dialog_run(GTK_DIALOG(self));
634 switch (response) {
635 case GTK_RESPONSE_DELETE_EVENT:
636 IRRECO_DEBUG("GTK_RESPONSE_DELETE_EVENT\n");
637 loop = FALSE;
638 break;
640 case GTK_RESPONSE_OK:
641 IRRECO_DEBUG("GTK_RESPONSE_OK\n");
642 self->loader_state = LOADER_STATE_INIT;
644 self->loader_func_id = g_idle_add((GSourceFunc)
645 irreco_remote_upload_dlg_send, self);
646 break;
648 } while (loop);
650 end:
651 if (themes != NULL) irreco_string_table_free(themes);
652 if (devices != NULL) irreco_string_table_free(devices);
653 g_string_free(instance_number, FALSE);
654 gtk_widget_destroy(GTK_WIDGET(self));
655 IRRECO_RETURN
658 /** @} */
662 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
663 /* Events and Callbacks */
664 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
667 * @name Events and Callbacks
668 * @{
671 void irreco_remote_upload_dlg_comment_size_request(GtkWidget *widget,
672 GtkRequisition *requisition,
673 IrrecoRemoteUploadDlg *self)
675 GtkAdjustment* vadjustment = gtk_scrolled_window_get_vadjustment(
676 GTK_SCROLLED_WINDOW(self->scroll));
677 IRRECO_ENTER
679 if (requisition->height > self->cursor_position) {
680 vadjustment->value += 27;
681 } else if (requisition->height < self->cursor_position) {
682 vadjustment->value -= 27;
684 self->cursor_position = requisition->height;
686 IRRECO_RETURN
689 /** @} */
691 /** @} */