diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-04 14:17:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-04 14:17:19 +0000 |
commit | f489add0e45f7783db181a3cd5be396b24e15d9f (patch) | |
tree | 39a116fb43542fe495600bd252b71cc7b0df0507 /src/fs | |
parent | dc530a3e229702cb1ee314a2774c924744b452fe (diff) | |
download | gnunet-gtk-f489add0e45f7783db181a3cd5be396b24e15d9f.tar.gz gnunet-gtk-f489add0e45f7783db181a3cd5be396b24e15d9f.zip |
modernizing use of Gtk3 APIs
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/gnunet-fs-gtk.c | 3 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_main-window-connection.c | 11 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_publish-dialog.c | 15 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_publish-edit-dialog.c | 30 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_unindex.c | 9 |
5 files changed, 25 insertions, 43 deletions
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c index f9c2f858..1cd8c70a 100644 --- a/src/fs/gnunet-fs-gtk.c +++ b/src/fs/gnunet-fs-gtk.c | |||
@@ -764,7 +764,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
764 | } | 764 | } |
765 | 765 | ||
766 | /* Allow multiple selection in metadata view; */ | 766 | /* Allow multiple selection in metadata view; */ |
767 | /* FIXME-GTK3: this can be done within (modern versions of) glade */ | 767 | /* FIXME-GTK3: this can be done within (modern versions of) glade |
768 | (However, this needs GTK >= 3.2, we currently target 3.0) */ | ||
768 | gtk_tree_selection_set_mode (gtk_tree_view_get_selection (main_context.md_treeview), | 769 | gtk_tree_selection_set_mode (gtk_tree_view_get_selection (main_context.md_treeview), |
769 | GTK_SELECTION_MULTIPLE); | 770 | GTK_SELECTION_MULTIPLE); |
770 | if (NULL == getenv ("GNUNET_FS_GTK_PLUG")) | 771 | if (NULL == getenv ("GNUNET_FS_GTK_PLUG")) |
diff --git a/src/fs/gnunet-fs-gtk_main-window-connection.c b/src/fs/gnunet-fs-gtk_main-window-connection.c index 9b3e3ed7..af817f2f 100644 --- a/src/fs/gnunet-fs-gtk_main-window-connection.c +++ b/src/fs/gnunet-fs-gtk_main-window-connection.c | |||
@@ -34,12 +34,13 @@ | |||
34 | * @param tooltip new tooltip text | 34 | * @param tooltip new tooltip text |
35 | */ | 35 | */ |
36 | void | 36 | void |
37 | GNUNET_FS_GTK_update_connection_indicator ( | 37 | GNUNET_FS_GTK_update_connection_indicator (struct GNUNET_GTK_MainWindowContext *main_ctx, |
38 | struct GNUNET_GTK_MainWindowContext *main_ctx, | 38 | gboolean connected, |
39 | gboolean connected, const gchar *tooltip) | 39 | const gchar *tooltip) |
40 | { | 40 | { |
41 | gtk_image_set_from_stock (main_ctx->connection_indicator, | 41 | gtk_image_set_from_icon_name (main_ctx->connection_indicator, |
42 | connected ? "gtk-yes" : "gtk-no", GTK_ICON_SIZE_BUTTON); | 42 | connected ? "network-transmit-receive" : "network-offline", |
43 | GTK_ICON_SIZE_BUTTON); | ||
43 | gtk_widget_set_tooltip_text (GTK_WIDGET (main_ctx->connection_indicator), | 44 | gtk_widget_set_tooltip_text (GTK_WIDGET (main_ctx->connection_indicator), |
44 | tooltip); | 45 | tooltip); |
45 | } | 46 | } |
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c index b658afbc..b5d6e690 100644 --- a/src/fs/gnunet-fs-gtk_publish-dialog.c +++ b/src/fs/gnunet-fs-gtk_publish-dialog.c | |||
@@ -557,8 +557,8 @@ update_selectivity_edit (struct MainPublishingDialogContext *ctx) | |||
557 | * @param ts the changed selection | 557 | * @param ts the changed selection |
558 | * @param user_data master publishing dialog context of our window | 558 | * @param user_data master publishing dialog context of our window |
559 | */ | 559 | */ |
560 | static void | 560 | void |
561 | selection_changed_cb (GtkTreeSelection * ts, | 561 | GNUNET_GTK_master_publish_dialog_file_informatino_treeview_selection_changed_cb (GtkTreeSelection * ts, |
562 | gpointer user_data) | 562 | gpointer user_data) |
563 | { | 563 | { |
564 | struct MainPublishingDialogContext *ctx = user_data; | 564 | struct MainPublishingDialogContext *ctx = user_data; |
@@ -899,8 +899,9 @@ GNUNET_GTK_master_publish_dialog_identifier_entry_changed_cb (GtkWidget *widget, | |||
899 | * @param ts the changed selection | 899 | * @param ts the changed selection |
900 | * @param user_data master publishing dialog context of our window | 900 | * @param user_data master publishing dialog context of our window |
901 | */ | 901 | */ |
902 | static void | 902 | void |
903 | identifiers_selection_changed_cb (GtkTreeSelection *ts, gpointer user_data) | 903 | GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_selection_changed_cb (GtkTreeSelection *ts, |
904 | gpointer user_data) | ||
904 | { | 905 | { |
905 | struct MainPublishingDialogContext *ctx = user_data; | 906 | struct MainPublishingDialogContext *ctx = user_data; |
906 | GtkTreeIter iter; | 907 | GtkTreeIter iter; |
@@ -2835,12 +2836,6 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, | |||
2835 | 2836 | ||
2836 | g_signal_connect (ctx->identifiers_expander, "notify::expanded", G_CALLBACK (expander_callback), ctx); | 2837 | g_signal_connect (ctx->identifiers_expander, "notify::expanded", G_CALLBACK (expander_callback), ctx); |
2837 | 2838 | ||
2838 | /* connect signals; FIXME-GTK3: these could be connected with (modern) Glade */ | ||
2839 | g_signal_connect (G_OBJECT (ctx->file_info_selection), "changed", | ||
2840 | G_CALLBACK (selection_changed_cb), ctx); | ||
2841 | g_signal_connect (G_OBJECT (ctx->identifiers_selection), "changed", | ||
2842 | G_CALLBACK (identifiers_selection_changed_cb), ctx); | ||
2843 | |||
2844 | cfg = GNUNET_FS_GTK_get_configuration (); | 2839 | cfg = GNUNET_FS_GTK_get_configuration (); |
2845 | ctx->identity = GNUNET_IDENTITY_connect (cfg, | 2840 | ctx->identity = GNUNET_IDENTITY_connect (cfg, |
2846 | &add_namespace_to_ts, | 2841 | &add_namespace_to_ts, |
diff --git a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c index 196726a1..3f84c820 100644 --- a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c +++ b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c | |||
@@ -353,9 +353,8 @@ GNUNET_GTK_edit_publication_type_combo_changed_cb (GtkComboBox * widget, | |||
353 | * @param ts the tree selection object | 353 | * @param ts the tree selection object |
354 | * @param user_data the 'struct EditPublicationDialogContext' | 354 | * @param user_data the 'struct EditPublicationDialogContext' |
355 | */ | 355 | */ |
356 | /* FIXME-GTK3: connect this signal via glade (modern versions of Glade support this) */ | 356 | void |
357 | static void | 357 | GNUNET_GTK_edit_publication_metadata_treeview_selection_changed_cb (GtkTreeSelection *ts, |
358 | metadata_selection_changed_cb (GtkTreeSelection *ts, | ||
359 | gpointer user_data) | 358 | gpointer user_data) |
360 | { | 359 | { |
361 | struct EditPublicationDialogContext *ctx = user_data; | 360 | struct EditPublicationDialogContext *ctx = user_data; |
@@ -607,9 +606,8 @@ GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb (Gt | |||
607 | * @param ts the tree selection object | 606 | * @param ts the tree selection object |
608 | * @param user_data the 'struct EditPublicationDialogContext' | 607 | * @param user_data the 'struct EditPublicationDialogContext' |
609 | */ | 608 | */ |
610 | /* FIXME-GTK3: connect this signal via glade (modern versions of Glade support this) */ | 609 | void |
611 | static void | 610 | GNUNET_GTK_edit_publication_keyword_list_treeview_selection_changed_cb (GtkTreeSelection *ts, |
612 | keywords_selection_changed_cb (GtkTreeSelection *ts, | ||
613 | gpointer user_data) | 611 | gpointer user_data) |
614 | { | 612 | { |
615 | struct EditPublicationDialogContext *ctx = user_data; | 613 | struct EditPublicationDialogContext *ctx = user_data; |
@@ -1057,7 +1055,7 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
1057 | /* fall back to Gtk mime-detection; this only works on GNU */ | 1055 | /* fall back to Gtk mime-detection; this only works on GNU */ |
1058 | GFileInfo *finfo; | 1056 | GFileInfo *finfo; |
1059 | const char *gmime; | 1057 | const char *gmime; |
1060 | 1058 | ||
1061 | finfo = g_file_query_info (f, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, | 1059 | finfo = g_file_query_info (f, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, |
1062 | 0, NULL, NULL); | 1060 | 0, NULL, NULL); |
1063 | gmime = g_file_info_get_attribute_string (finfo, | 1061 | gmime = g_file_info_get_attribute_string (finfo, |
@@ -1241,11 +1239,11 @@ file_information_import (void *cls, | |||
1241 | * | 1239 | * |
1242 | * @param parent parent window of the dialog | 1240 | * @param parent parent window of the dialog |
1243 | * @param fip information about the file information that is to be edited | 1241 | * @param fip information about the file information that is to be edited |
1244 | * @param is_namespace_edit GNUNET_YES if we are editing a namespace advertisement; | 1242 | * @param is_namespace_edit #GNUNET_YES if we are editing a namespace advertisement; |
1245 | * this means that keywords are required and that a "root" can be | 1243 | * this means that keywords are required and that a "root" can be |
1246 | * entered | 1244 | * entered |
1247 | * @param cb function to call when the dialog is closed | 1245 | * @param cb function to call when the dialog is closed |
1248 | * @param cb_cls closure for 'cb' | 1246 | * @param cb_cls closure for @a cb |
1249 | */ | 1247 | */ |
1250 | void | 1248 | void |
1251 | GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent, | 1249 | GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent, |
@@ -1260,10 +1258,8 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent, | |||
1260 | GtkLabel *index_label; | 1258 | GtkLabel *index_label; |
1261 | GtkLabel *root_label; | 1259 | GtkLabel *root_label; |
1262 | struct EditPublicationDialogContext *ctx; | 1260 | struct EditPublicationDialogContext *ctx; |
1263 | GtkTreeSelection *meta_selection; | ||
1264 | GtkTreeSelection *keywords_selection; | ||
1265 | 1261 | ||
1266 | ctx = GNUNET_malloc (sizeof (struct EditPublicationDialogContext)); | 1262 | ctx = GNUNET_new (struct EditPublicationDialogContext); |
1267 | ctx->fip = fip; | 1263 | ctx->fip = fip; |
1268 | ctx->preview_changed = GNUNET_NO; | 1264 | ctx->preview_changed = GNUNET_NO; |
1269 | ctx->allow_no_keywords = is_namespace_edit ? GNUNET_NO : GNUNET_YES; | 1265 | ctx->allow_no_keywords = is_namespace_edit ? GNUNET_NO : GNUNET_YES; |
@@ -1273,7 +1269,7 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent, | |||
1273 | ctx->meta_combo_selected_type_id = -1; | 1269 | ctx->meta_combo_selected_type_id = -1; |
1274 | ctx->builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_edit_publication.glade", ctx); | 1270 | ctx->builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_edit_publication.glade", ctx); |
1275 | 1271 | ||
1276 | if (ctx->builder == NULL) | 1272 | if (NULL == ctx->builder) |
1277 | { | 1273 | { |
1278 | GNUNET_free (ctx); | 1274 | GNUNET_free (ctx); |
1279 | return; | 1275 | return; |
@@ -1365,14 +1361,6 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent, | |||
1365 | gtk_widget_set_visible (GTK_WIDGET (root_label), | 1361 | gtk_widget_set_visible (GTK_WIDGET (root_label), |
1366 | is_namespace_edit ? TRUE : FALSE); | 1362 | is_namespace_edit ? TRUE : FALSE); |
1367 | 1363 | ||
1368 | /* FIXME-GTK3: these signal handlers can be set by (modern) versions of Glade */ | ||
1369 | keywords_selection = gtk_tree_view_get_selection (ctx->keywords_treeview); | ||
1370 | g_signal_connect (G_OBJECT (keywords_selection), "changed", | ||
1371 | G_CALLBACK (keywords_selection_changed_cb), ctx); | ||
1372 | meta_selection = gtk_tree_view_get_selection (ctx->meta_treeview); | ||
1373 | g_signal_connect (G_OBJECT (meta_selection), "changed", | ||
1374 | G_CALLBACK (metadata_selection_changed_cb), ctx); | ||
1375 | |||
1376 | /* import meta data and options */ | 1364 | /* import meta data and options */ |
1377 | GNUNET_FS_file_information_inspect (fip, &file_information_import, ctx); | 1365 | GNUNET_FS_file_information_inspect (fip, &file_information_import, ctx); |
1378 | 1366 | ||
diff --git a/src/fs/gnunet-fs-gtk_unindex.c b/src/fs/gnunet-fs-gtk_unindex.c index d7efdf8e..9977e5a6 100644 --- a/src/fs/gnunet-fs-gtk_unindex.c +++ b/src/fs/gnunet-fs-gtk_unindex.c | |||
@@ -279,8 +279,8 @@ GNUNET_FS_GTK_unindex_close_button_clicked_cb (GtkWidget * dummy, | |||
279 | * @param ts the changed selection | 279 | * @param ts the changed selection |
280 | * @param user_data our unindex context | 280 | * @param user_data our unindex context |
281 | */ | 281 | */ |
282 | static void | 282 | void |
283 | selection_changed_cb (GtkTreeSelection * ts, | 283 | GNUNET_FS_GTK_unindex_treeview_selection_changed_cb (GtkTreeSelection *ts, |
284 | gpointer user_data) | 284 | gpointer user_data) |
285 | { | 285 | { |
286 | struct UnindexDialogContext *udc = user_data; | 286 | struct UnindexDialogContext *udc = user_data; |
@@ -394,7 +394,7 @@ GNUNET_GTK_main_menu_unindex_activate_cb (GtkWidget * dummy, | |||
394 | gtk_window_present (GTK_WINDOW (master_udc->dialog)); | 394 | gtk_window_present (GTK_WINDOW (master_udc->dialog)); |
395 | return; | 395 | return; |
396 | } | 396 | } |
397 | udc = GNUNET_malloc (sizeof (struct UnindexDialogContext)); | 397 | udc = GNUNET_new (struct UnindexDialogContext); |
398 | udc->builder = | 398 | udc->builder = |
399 | GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_unindex.glade", udc); | 399 | GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_unindex.glade", udc); |
400 | if (NULL == udc->builder) | 400 | if (NULL == udc->builder) |
@@ -418,9 +418,6 @@ GNUNET_GTK_main_menu_unindex_activate_cb (GtkWidget * dummy, | |||
418 | toplevel = gtk_widget_get_toplevel (dummy); | 418 | toplevel = gtk_widget_get_toplevel (dummy); |
419 | if (GTK_IS_WINDOW (toplevel)) | 419 | if (GTK_IS_WINDOW (toplevel)) |
420 | gtk_window_set_transient_for (GTK_WINDOW (udc->dialog), GTK_WINDOW (toplevel)); | 420 | gtk_window_set_transient_for (GTK_WINDOW (udc->dialog), GTK_WINDOW (toplevel)); |
421 | /* connect signals; FIXME-GTK3: these could be connected with (modern) Glade */ | ||
422 | g_signal_connect (G_OBJECT (udc->selection), "changed", | ||
423 | G_CALLBACK (selection_changed_cb), udc); | ||
424 | gtk_window_present (GTK_WINDOW (udc->dialog)); | 421 | gtk_window_present (GTK_WINDOW (udc->dialog)); |
425 | master_udc = udc; | 422 | master_udc = udc; |
426 | } | 423 | } |