[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22314 - in gnunet-gtk: contrib src/setup
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22314 - in gnunet-gtk: contrib src/setup |
Date: |
Tue, 26 Jun 2012 21:22:39 +0200 |
Author: grothoff
Date: 2012-06-26 21:22:39 +0200 (Tue, 26 Jun 2012)
New Revision: 22314
Added:
gnunet-gtk/contrib/gnunet_setup_qr_save_as_dialog.glade
Modified:
gnunet-gtk/contrib/Makefile.am
gnunet-gtk/src/setup/gnunet-setup-gns.c
Log:
-adding support for saving gns record qr code images
Modified: gnunet-gtk/contrib/Makefile.am
===================================================================
--- gnunet-gtk/contrib/Makefile.am 2012-06-26 19:07:46 UTC (rev 22313)
+++ gnunet-gtk/contrib/Makefile.am 2012-06-26 19:22:39 UTC (rev 22314)
@@ -40,14 +40,12 @@
gnunet_fs_gtk_select_pseudonym_dialog.glade \
gnunet_fs_gtk_unindex.glade \
gnunet_fs_gtk_progress_dialog.glade \
- gnunet_gns_gtk_about_window.glade \
- gnunet_gns_gtk_main_window.glade \
- gnunet_gns_gtk_zone_open.glade \
gnunet_gtk_status_bar_menu.glade \
gnunet_peerinfo_gtk_about_window.glade \
gnunet_peerinfo_gtk_main_window.glade \
gnunet_statistics_gtk_about_window.glade \
gnunet_statistics_gtk_main_window.glade \
+ gnunet_setup_qr_save_as_dialog.glade \
gnunet_setup_gtk_main_window.glade
install-data-local:
Added: gnunet-gtk/contrib/gnunet_setup_qr_save_as_dialog.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_setup_qr_save_as_dialog.glade
(rev 0)
+++ gnunet-gtk/contrib/gnunet_setup_qr_save_as_dialog.glade 2012-06-26
19:22:39 UTC (rev 22314)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="2.24"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkFileChooserDialog" id="GNUNET_setup_qr_save_as_dialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="modal">True</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="icon_name">document-save-as</property>
+ <property name="type_hint">dialog</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="action">save</property>
+ <signal name="response"
handler="GNUNET_setup_qr_save_as_dialog_response_cb" swapped="no"/>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="GNUNET_setup_qr_save_as_dialog_dialog-vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox"
id="GNUNET_setup_qr_save_as_dialog_dialog-action_area">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton"
id="GNUNET_setup_qr_save_as_dialog_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton"
id="GNUNET_setup_qr_save_as_dialog_confirm_button">
+ <property name="label">gtk-save-as</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget
response="-6">GNUNET_setup_qr_save_as_dialog_cancel_button</action-widget>
+ <action-widget
response="-5">GNUNET_setup_qr_save_as_dialog_confirm_button</action-widget>
+ </action-widgets>
+ </object>
+</interface>
Modified: gnunet-gtk/src/setup/gnunet-setup-gns.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-gns.c 2012-06-26 19:07:46 UTC (rev
22313)
+++ gnunet-gtk/src/setup/gnunet-setup-gns.c 2012-06-26 19:22:39 UTC (rev
22314)
@@ -1300,6 +1300,44 @@
/**
+ * Function called upon completion of the qr-code 'save as' dialog.
+ *
+ * @param dialog the dialog
+ * @param response_id reason for the dialog closing
+ * @param user_data the 'GtkBuilder' we used to create the dialog
+ */
+void
+GNUNET_setup_qr_save_as_dialog_response_cb (GtkDialog *dialog,
+ gint response_id,
+ gpointer user_data)
+{
+ GtkBuilder *builder = user_data;
+ GtkImage *image;
+ GdkPixbuf *pb;
+ char *filename;
+
+ if (GTK_RESPONSE_OK != response_id)
+ {
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_object_unref (G_OBJECT (builder));
+ return;
+ }
+ filename =
+ GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (dialog));
+ image = GTK_IMAGE (GNUNET_SETUP_get_object ("GNUNET_setup_gns_qr_image"));
+ pb = gtk_image_get_pixbuf (image);
+
+ gdk_pixbuf_save (pb,
+ filename,
+ "png",
+ NULL, NULL);
+ g_free (filename);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_object_unref (G_OBJECT (builder));
+}
+
+
+/**
* User clicked on 'save as' to extract the QR code. Open 'save as'
* dialog to get the desired filename and file type.
*/
@@ -1307,7 +1345,20 @@
GNUNET_setup_gns_qr_saveas_button_clicked_cb (GtkButton *button,
gpointer user_data)
{
- GNUNET_break (0); // FIXME: not implemented
+ GtkBuilder *builder;
+ GtkWindow *dialog;
+
+ builder =
+ GNUNET_GTK_get_new_builder ("gnunet_setup_qr_save_as_dialog.glade",
+ NULL);
+ if (NULL == builder)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ dialog = GTK_WINDOW (gtk_builder_get_object
+ (builder, "GNUNET_setup_qr_save_as_dialog"));
+ gtk_window_present (dialog);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22314 - in gnunet-gtk: contrib src/setup,
gnunet <=