[Xfce4-commits] [apps/xfce4-screenshooter] 01/10: Improved imgur dialog (Bug #14973)

noreply at xfce.org noreply at xfce.org
Mon Dec 17 00:04:35 CET 2018


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-screenshooter.

commit 1a4ebe1ee23a12f5996187ec6060ab71963ffd11
Author: Arthur Jansen <arthurj155 at gmail.com>
Date:   Sat Dec 15 15:19:37 2018 +0100

    Improved imgur dialog (Bug #14973)
---
 .gitignore                        |   3 +
 Makefile.am                       |   9 +-
 lib/screenshooter-imgur-dialog.c  | 256 +++++++++++++++++
 lib/screenshooter-imgur-dialog.h  |  22 ++
 lib/screenshooter-imgur-dialog.ui | 591 ++++++++++++++++++++++++++++++++++++++
 lib/screenshooter-imgur.c         |   7 +-
 lib/screenshooter-job-callbacks.c | 197 +------------
 lib/screenshooter-job-callbacks.h |   1 +
 lib/screenshooter-job.c           |   8 +-
 lib/screenshooter-job.h           |   3 +-
 lib/screenshooter-marshal.list    |   1 +
 11 files changed, 898 insertions(+), 200 deletions(-)

diff --git a/.gitignore b/.gitignore
index 09b11a8..c68a716 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,3 +39,6 @@ Makefile
 /src/xfce4-screenshooter.desktop*
 /stamp-h1
 src/xfce4-screenshooter.appdata.xml
+
+# UI header files generated using exo-csource
+lib/*_ui.h
diff --git a/Makefile.am b/Makefile.am
index 5120a2f..4fa5149 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,7 +33,8 @@ lib_libscreenshooter_la_SOURCES =	\
 	lib/screenshooter-job-callbacks.c lib/screenshooter-job-callbacks.h \
 	lib/screenshooter-simple-job.c lib/screenshooter-simple-job.h \
 	lib/screenshooter-utils.c lib/screenshooter-utils.h \
-	lib/screenshooter-imgur.c lib/screenshooter-imgur.h
+	lib/screenshooter-imgur.c lib/screenshooter-imgur.h \
+	lib/screenshooter-imgur-dialog.c lib/screenshooter-imgur-dialog.h
 
 lib_libscreenshooter_la_CFLAGS = \
 	-I$(top_srcdir) \
@@ -62,7 +63,8 @@ lib_libscreenshooter_la_LIBADD = \
 	@XFIXES_LIBS@
 
 lib_libscreenshooter_built_sources = \
-	lib/screenshooter-marshal.c lib/screenshooter-marshal.h
+	lib/screenshooter-marshal.c lib/screenshooter-marshal.h \
+	lib/screenshooter-imgur-dialog_ui.h
 
 #Autogenerated sources for the library
 BUILT_SOURCES =	$(lib_libscreenshooter_built_sources)
@@ -83,6 +85,9 @@ lib/screenshooter-marshal.c: lib/screenshooter-marshal.list Makefile
 		&& glib-genmarshal --prefix=_screenshooter_marshal --body $(top_srcdir)/lib/screenshooter-marshal.list >>$@ \
 	)
 
+lib/screenshooter-imgur-dialog_ui.h: lib/screenshooter-imgur-dialog.ui
+	$(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=screenshooter_imgur_dialog_ui $< >$@
+
 # Main application
 src_xfce4_screenshooter_CFLAGS = \
 	-I$(top_srcdir)/lib/ \
diff --git a/lib/screenshooter-imgur-dialog.c b/lib/screenshooter-imgur-dialog.c
new file mode 100644
index 0000000..4ea0c6f
--- /dev/null
+++ b/lib/screenshooter-imgur-dialog.c
@@ -0,0 +1,256 @@
+#include "screenshooter-imgur-dialog.h"
+#include "screenshooter-imgur-dialog_ui.h"
+#include <libxfce4ui/libxfce4ui.h>
+
+struct _ScreenshooterImgurDialog
+{
+  GObject parent;
+  GtkDialog *window;
+  GtkEntry *link_entry;
+
+  const gchar *image_url, *thumbnail_url, *small_thumbnail_url;
+  const gchar *delete_link;
+  GtkRadioButton *embed_html_toggle, *embed_bb_code_toggle;
+  GtkRadioButton *embed_tiny_toggle, *embed_medium_toggle, *embed_full_toggle;
+  GtkRadioButton *embed_link_full_size_toggle;
+  GtkTextView *embed_text_view;
+};
+
+G_DEFINE_TYPE (ScreenshooterImgurDialog, screenshooter_imgur_dialog, G_TYPE_OBJECT)
+
+void cb_link_toggle_full (GtkToggleButton *button, gpointer user_data);
+void cb_link_toggle_medium (GtkToggleButton *button, gpointer user_data);
+void cb_link_toggle_tiny (GtkToggleButton *button, gpointer user_data);
+
+void cb_link_copy (GtkWidget *widget, gpointer user_data);
+void cb_link_view_in_browser (GtkWidget *widget, gpointer user_data);
+
+void cb_generate_embed_text (GtkWidget *widget, gpointer user_data);
+void cb_embed_text_copy (GtkWidget *widget, gpointer user_data);
+
+void cb_delete_link_copy (GtkWidget *widget, gpointer user_data);
+void cb_delete_link_view (GtkWidget *widget, gpointer user_data);
+
+void screenshooter_imgur_dialog_init (ScreenshooterImgurDialog *self)
+{
+  g_object_ref_sink (self);
+}
+
+static void screenshooter_imgur_dialog_class_init (ScreenshooterImgurDialogClass *klass)
+{
+}
+
+ScreenshooterImgurDialog *screenshooter_imgur_dialog_new (const gchar *upload_name,
+                                                          const gchar *delete_hash)
+{
+  g_return_if_fail (upload_name != NULL);
+
+  ScreenshooterImgurDialog *self = g_object_new (SCREENSHOOTER_TYPE_IMGUR_DIALOG, NULL);
+
+  self->image_url = g_strdup_printf ("https://imgur.com/%s.png", upload_name);
+  self->thumbnail_url = g_strdup_printf ("https://imgur.com/%sl.png", upload_name);
+  self->small_thumbnail_url = g_strdup_printf ("https://imgur.com/%ss.png", upload_name);
+  self->delete_link = g_strdup_printf ("https://imgur.com/delete/%s", delete_hash);
+
+  GtkBuilder* builder = gtk_builder_new ();
+  gtk_builder_add_from_string (builder, screenshooter_imgur_dialog_ui, screenshooter_imgur_dialog_ui_length, NULL);
+  //self->window = GTK_DIALOG (gtk_builder_get_object (builder, "imgur_dialog"));
+  // Setup window
+  self->window = xfce_titled_dialog_new_with_buttons (_("Screenshot"),
+                                                      NULL,
+                                                      GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                      "gtk-close",
+                                                      GTK_RESPONSE_CLOSE);
+  xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (self->window), _("Your uploaded image"));
+  gtk_window_set_icon_name (GTK_WINDOW (self->window), "applets-screenshooter");
+  gtk_window_set_default_size (GTK_WINDOW (self->window), 0, 0);
+
+  // Add notebook widget to window
+  GtkWidget* notebook = GTK_WIDGET (gtk_builder_get_object (builder, "dialog-notebook"));
+  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (self->window)), notebook);
+
+  self->link_entry = GTK_ENTRY (gtk_builder_get_object (builder, "link_entry"));
+  self->embed_text_view = GTK_TEXT_VIEW (gtk_builder_get_object (builder, "embed_text_view"));
+  gtk_entry_set_text (self->link_entry, self->image_url);
+
+  // Image tab
+
+  GtkRadioButton *link_full_toggle = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "link_full_toggle"));
+  GtkRadioButton *link_medium_toggle = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "link_medium_toggle"));
+  GtkRadioButton *link_tiny_toggle = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "link_tiny_toggle"));
+
+  g_signal_connect (link_full_toggle, "toggled", (GCallback) cb_link_toggle_full, (gpointer) self);
+  g_signal_connect (link_medium_toggle, "toggled", (GCallback) cb_link_toggle_medium, (gpointer) self);
+  g_signal_connect (link_tiny_toggle, "toggled", (GCallback) cb_link_toggle_tiny, (gpointer) self);
+
+  GtkButton *link_copy_button = GTK_BUTTON (gtk_builder_get_object (builder, "link_copy_button"));
+  GtkButton *link_view_button = GTK_BUTTON (gtk_builder_get_object (builder, "link_view_button"));
+  GtkButton *embed_copy_button = GTK_BUTTON (gtk_builder_get_object (builder, "embed_copy_button"));
+
+  g_signal_connect (link_copy_button, "clicked", (GCallback) cb_link_copy, (gpointer) self);
+  g_signal_connect (link_view_button, "clicked", (GCallback) cb_link_view_in_browser, (gpointer) self);
+  g_signal_connect (embed_copy_button, "clicked", (GCallback) cb_embed_text_copy, (gpointer) self);
+
+  // Embed tab
+
+  self->embed_html_toggle = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "embed_html_toggle"));
+  self->embed_bb_code_toggle = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "embed_bb_code_toggle"));
+  self->embed_tiny_toggle = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "embed_tiny_toggle"));
+  self->embed_medium_toggle = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "embed_medium_toggle"));
+  self->embed_full_toggle = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "embed_full_toggle"));
+  self->embed_link_full_size_toggle = GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "embed_link_full_size_toggle"));
+
+  // Regenerate the embed text when any togglebutton on the embed tab is toggled
+  g_signal_connect (self->embed_html_toggle, "toggled", (GCallback) cb_generate_embed_text, (gpointer) self);
+  g_signal_connect (self->embed_bb_code_toggle, "toggled", (GCallback) cb_generate_embed_text, (gpointer) self);
+  g_signal_connect (self->embed_tiny_toggle, "toggled", (GCallback) cb_generate_embed_text, (gpointer) self);
+  g_signal_connect (self->embed_medium_toggle, "toggled", (GCallback) cb_generate_embed_text, (gpointer) self);
+  g_signal_connect (self->embed_full_toggle, "toggled", (GCallback) cb_generate_embed_text, (gpointer) self);
+  g_signal_connect (self->embed_link_full_size_toggle, "toggled", (GCallback) cb_generate_embed_text, (gpointer) self);
+  // Generate default embed text
+  cb_generate_embed_text (NULL, (gpointer) self);
+
+  // Deletion link tab
+
+  GtkEntry *delete_link_entry = GTK_ENTRY (gtk_builder_get_object (builder, "delete_link_entry"));
+  gtk_entry_set_text (delete_link_entry, self->delete_link);
+
+  GtkButton *delete_link_copy_button = GTK_BUTTON (gtk_builder_get_object (builder, "delete_link_copy_button"));
+  GtkButton *delete_link_view_button = GTK_BUTTON (gtk_builder_get_object (builder, "delete_link_view_button"));
+
+  g_signal_connect (delete_link_copy_button, "clicked", G_CALLBACK (cb_delete_link_copy), self);
+  g_signal_connect (delete_link_view_button, "clicked", G_CALLBACK (cb_delete_link_view), self);
+
+  return self;
+}
+
+void screenshooter_imgur_dialog_run (ScreenshooterImgurDialog *self)
+{
+  g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (self));
+
+  gtk_widget_show_all (gtk_dialog_get_content_area (self->window));
+  gtk_dialog_run (self->window);
+}
+
+// Callbacks
+
+void cb_link_toggle_full (GtkToggleButton *button, gpointer user_data)
+{
+  g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
+
+  ScreenshooterImgurDialog *dialog = SCREENSHOOTER_IMGUR_DIALOG (user_data);
+  if (gtk_toggle_button_get_active (button))
+    gtk_entry_set_text (dialog->link_entry, dialog->image_url);
+}
+
+void cb_link_toggle_medium (GtkToggleButton *button, gpointer user_data)
+{
+  g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
+
+  ScreenshooterImgurDialog *dialog = SCREENSHOOTER_IMGUR_DIALOG (user_data);
+  if (gtk_toggle_button_get_active (button))
+    gtk_entry_set_text (dialog->link_entry, dialog->thumbnail_url);
+}
+
+void cb_link_toggle_tiny (GtkToggleButton *button, gpointer user_data)
+{
+  g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
+
+  ScreenshooterImgurDialog *dialog = SCREENSHOOTER_IMGUR_DIALOG (user_data);
+  if (gtk_toggle_button_get_active (button))
+    gtk_entry_set_text (dialog->link_entry, dialog->small_thumbnail_url);
+}
+
+void cb_link_copy (GtkWidget *widget, gpointer user_data)
+{
+  g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
+
+  ScreenshooterImgurDialog *dialog = SCREENSHOOTER_IMGUR_DIALOG (user_data);
+  const gchar *text = gtk_entry_get_text (dialog->link_entry);
+  guint16 len = gtk_entry_get_text_length (dialog->link_entry);
+  GtkClipboard *clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+  gtk_clipboard_set_text (clipboard, text, len);
+}
+
+void cb_link_view_in_browser (GtkWidget *widget, gpointer user_data)
+{
+  g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
+  ScreenshooterImgurDialog *dialog = SCREENSHOOTER_IMGUR_DIALOG (user_data);
+  const gchar *link = gtk_entry_get_text (dialog->link_entry);
+  exo_execute_preferred_application ("WebBrowser", link, NULL, NULL, NULL);
+}
+
+void cb_generate_embed_text (GtkWidget* widget, gpointer user_data)
+{
+  g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
+
+  ScreenshooterImgurDialog *dialog = SCREENSHOOTER_IMGUR_DIALOG (user_data);
+
+  const gchar *link = NULL;
+  gboolean link_to_full_size = gtk_toggle_button_get_active (dialog->embed_link_full_size_toggle);
+
+  if (gtk_toggle_button_get_active (dialog->embed_full_toggle))
+    link = dialog->image_url;
+  else if (gtk_toggle_button_get_active (dialog->embed_medium_toggle))
+    link = dialog->thumbnail_url;
+  else if (gtk_toggle_button_get_active (dialog->embed_tiny_toggle))
+    link = dialog->small_thumbnail_url;
+  else
+    g_return_if_reached ();
+
+  g_return_if_fail (link != NULL);
+
+  const gchar *text = NULL;
+
+  if (gtk_toggle_button_get_active (dialog->embed_html_toggle))
+    if (link_to_full_size)
+      text = g_markup_printf_escaped ("<a href=\"%s\">\n  <img src=\"%s\" />\n</a>", dialog->image_url, link);
+    else
+      text = g_markup_printf_escaped ("<img src=\"%s\" />", link);
+  else if (gtk_toggle_button_get_active (dialog->embed_bb_code_toggle))
+    if (link_to_full_size)
+      text = g_strdup_printf ("[url=%s]\n  [img]%s[/img]\n[/url]", dialog->image_url, link);
+    else
+      text = g_strdup_printf ("[img]%s[/img]", link);
+  else
+    g_return_if_reached ();
+
+  g_return_if_fail (text != NULL);
+
+  gtk_text_buffer_set_text (gtk_text_view_get_buffer (dialog->embed_text_view), text, strlen(text));
+  g_free(text);
+}
+
+void cb_embed_text_copy (GtkWidget* widget, gpointer user_data)
+{
+  g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
+
+  ScreenshooterImgurDialog *dialog = SCREENSHOOTER_IMGUR_DIALOG (user_data);
+
+  GtkTextIter start, end;
+  GtkTextBuffer *buffer = gtk_text_view_get_buffer (dialog->embed_text_view);
+  gtk_text_buffer_get_bounds (buffer, &start, &end);
+
+  const gchar *text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
+  guint16 len = strlen(text);
+
+  GtkClipboard *clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+  gtk_clipboard_set_text (clipboard, text, len);
+}
+
+void cb_delete_link_copy (GtkWidget *widget, gpointer user_data)
+{
+  g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
+
+  ScreenshooterImgurDialog *dialog = SCREENSHOOTER_IMGUR_DIALOG (user_data);
+  GtkClipboard *clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+  gtk_clipboard_set_text (clipboard, dialog->delete_link, strlen (dialog->delete_link));
+}
+
+void cb_delete_link_view (GtkWidget *widget, gpointer user_data)
+{
+  g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
+
+  ScreenshooterImgurDialog *dialog = SCREENSHOOTER_IMGUR_DIALOG (user_data);
+  exo_execute_preferred_application ("WebBrowser", dialog->delete_link, NULL, NULL, NULL);
+}
\ No newline at end of file
diff --git a/lib/screenshooter-imgur-dialog.h b/lib/screenshooter-imgur-dialog.h
new file mode 100644
index 0000000..6dce910
--- /dev/null
+++ b/lib/screenshooter-imgur-dialog.h
@@ -0,0 +1,22 @@
+#ifndef IMGUR_DIALOG_H
+#define IMGUR_DIALOG_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define SCREENSHOOTER_TYPE_IMGUR_DIALOG screenshooter_imgur_dialog_get_type ()
+G_DECLARE_FINAL_TYPE (ScreenshooterImgurDialog, screenshooter_imgur_dialog, SCREENSHOOTER, IMGUR_DIALOG, GObject)
+
+ScreenshooterImgurDialog *screenshooter_imgur_dialog_new (const gchar *upload_name,
+                                                          const gchar *delete_hash);
+void screenshooter_imgur_dialog_run ();
+
+G_END_DECLS
+
+#endif
\ No newline at end of file
diff --git a/lib/screenshooter-imgur-dialog.ui b/lib/screenshooter-imgur-dialog.ui
new file mode 100644
index 0000000..6deaa1b
--- /dev/null
+++ b/lib/screenshooter-imgur-dialog.ui
@@ -0,0 +1,591 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface>
+  <requires lib="gtk+" version="3.20"/>
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-copy</property>
+  </object>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">web-browser</property>
+  </object>
+  <object class="GtkImage" id="image3">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-copy</property>
+  </object>
+  <object class="GtkImage" id="image4">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-copy</property>
+  </object>
+  <object class="GtkImage" id="image6">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">web-browser</property>
+  </object>
+  <object class="GtkNotebook" id="dialog-notebook">
+    <property name="visible">True</property>
+    <property name="can_focus">True</property>
+    <child>
+      <object class="GtkGrid">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="margin_left">10</property>
+        <property name="margin_right">10</property>
+        <property name="margin_top">10</property>
+        <property name="margin_bottom">10</property>
+        <property name="row_spacing">10</property>
+        <property name="column_spacing">20</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="label" translatable="yes">Size</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="label" translatable="yes">Link</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">8</property>
+            <child>
+              <object class="GtkRadioButton" id="link_tiny_toggle">
+                <property name="label" translatable="yes">Tiny</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">False</property>
+                <property name="group">link_full_toggle</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="link_medium_toggle">
+                <property name="label" translatable="yes">Medium</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">False</property>
+                <property name="group">link_full_toggle</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="link_full_toggle">
+                <property name="label" translatable="yes">Full</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="spacing">8</property>
+            <child>
+              <object class="GtkEntry" id="link_entry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="editable">False</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="link_copy_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="tooltip_text" translatable="yes">Copy</property>
+                <property name="image">image1</property>
+                <property name="always_show_image">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="link_view_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="tooltip_text" translatable="yes">View in browser</property>
+                <property name="image">image2</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <child type="tab">
+      <object class="GtkLabel">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Image</property>
+      </object>
+      <packing>
+        <property name="tab_fill">False</property>
+        <property name="reorderable">True</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkGrid">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="margin_left">10</property>
+        <property name="margin_right">10</property>
+        <property name="margin_top">10</property>
+        <property name="margin_bottom">10</property>
+        <property name="row_spacing">10</property>
+        <property name="column_spacing">20</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="label" translatable="yes">Syntax</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">8</property>
+            <child>
+              <object class="GtkRadioButton" id="embed_html_toggle">
+                <property name="label" translatable="yes">HTML</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="embed_bb_code_toggle">
+                <property name="label" translatable="yes">BBCODE</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">False</property>
+                <property name="group">embed_html_toggle</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="label" translatable="yes">Code</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="spacing">8</property>
+            <child>
+              <object class="GtkScrolledWindow">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTextView" id="embed_text_view">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="editable">False</property>
+                    <property name="monospace">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="embed_copy_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="tooltip_text" translatable="yes">Copy</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="image">image3</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="label" translatable="yes">Size</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">8</property>
+            <child>
+              <object class="GtkRadioButton" id="embed_tiny_toggle">
+                <property name="label" translatable="yes">Tiny</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="draw_indicator">False</property>
+                <property name="group">embed_full_toggle</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="embed_medium_toggle">
+                <property name="label" translatable="yes">Medium</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="draw_indicator">False</property>
+                <property name="group">embed_full_toggle</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="embed_full_toggle">
+                <property name="label" translatable="yes">Full</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="label" translatable="yes">Type</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">8</property>
+            <child>
+              <object class="GtkRadioButton">
+                <property name="label" translatable="yes">Direct image</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">False</property>
+                <property name="group">embed_link_full_size_toggle</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="embed_link_full_size_toggle">
+                <property name="label" translatable="yes">Link to full size</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child type="tab">
+      <object class="GtkLabel">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Embed into code</property>
+      </object>
+      <packing>
+        <property name="position">1</property>
+        <property name="tab_fill">False</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="margin_left">10</property>
+        <property name="margin_right">10</property>
+        <property name="margin_top">10</property>
+        <property name="margin_bottom">10</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">10</property>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">20</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Delete</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">8</property>
+                <child>
+                  <object class="GtkEntry" id="delete_link_entry">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="editable">False</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="delete_link_copy_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes">Copy</property>
+                    <property name="image">image4</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="delete_link_view_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes">View in browser</property>
+                    <property name="image">image6</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">This link only shows up once. Make sure to save it if you think you might be deleting this image. We don't currently support linking images to Imgur accounts.</property>
+            <property name="wrap">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child type="tab">
+      <object class="GtkLabel">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Deletion link</property>
+      </object>
+      <packing>
+        <property name="position">2</property>
+        <property name="tab_fill">False</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/lib/screenshooter-imgur.c b/lib/screenshooter-imgur.c
index a58ea30..16ba77d 100644
--- a/lib/screenshooter-imgur.c
+++ b/lib/screenshooter-imgur.c
@@ -34,6 +34,7 @@ imgur_upload_job (ScreenshooterJob *job, GArray *param_values, GError **error)
 {
   const gchar *image_path, *title;
   gchar *online_file_name = NULL;
+  gchar *delete_hash = NULL;
   const gchar* proxy_uri;
   SoupURI *soup_proxy_uri;
 #if DEBUG > 0
@@ -128,15 +129,19 @@ imgur_upload_job (ScreenshooterJob *job, GArray *param_values, GError **error)
 
   root_node = xmlDocGetRootElement(doc);
   for (child_node = root_node->children; child_node; child_node = child_node->next)
+  {
     if (xmlStrEqual(child_node->name, (const xmlChar *) "id"))
        online_file_name = xmlNodeGetContent(child_node);
+    else if (xmlStrEqual (child_node->name, (const xmlChar *) "deletehash"))
+      delete_hash = xmlNodeGetContent (child_node);
+  }
   TRACE("found picture id %s\n", online_file_name);
   xmlFreeDoc(doc);
   soup_buffer_free (buf);
   g_object_unref (session);
   g_object_unref (msg);
 
-  screenshooter_job_image_uploaded (job, online_file_name);
+  screenshooter_job_image_uploaded (job, online_file_name, delete_hash);
 
   return TRUE;
 }
diff --git a/lib/screenshooter-job-callbacks.c b/lib/screenshooter-job-callbacks.c
index 30a91a7..c4220b7 100644
--- a/lib/screenshooter-job-callbacks.c
+++ b/lib/screenshooter-job-callbacks.c
@@ -18,6 +18,7 @@
  */
 
 #include "screenshooter-job-callbacks.h"
+#include "screenshooter-imgur-dialog.h"
 
 /* Create and return a dialog with a spinner and a translated title
  * will be used during upload jobs
@@ -352,201 +353,13 @@ cb_ask_for_information (ScreenshooterJob *job,
 
 void cb_image_uploaded (ScreenshooterJob  *job,
                         gchar             *upload_name,
+                        gchar             *delete_hash,
                         gchar            **last_user)
 {
-  GtkWidget *dialog;
-  GtkWidget *main_alignment, *vbox;
-  GtkWidget *link_label;
-  GtkWidget *image_link, *thumbnail_link, *small_thumbnail_link;
-  GtkWidget *example_label, *html_label, *bb_label;
-  GtkWidget *html_code_view, *bb_code_view;
-  GtkWidget *html_frame, *bb_frame;
-  GtkWidget *links_alignment, *code_alignment;
-  GtkWidget *links_box, *code_box;
-
-  GtkTextBuffer *html_buffer, *bb_buffer;
-
-  const gchar *image_url, *thumbnail_url, *small_thumbnail_url;
-  const gchar *image_markup, *thumbnail_markup, *small_thumbnail_markup;
-  const gchar *html_code, *bb_code;
-  gchar *title;
-  gchar *last_user_temp;
-
   g_return_if_fail (upload_name != NULL);
+  g_return_if_fail (delete_hash != NULL);
 
-  title = _("My screenshot on Imgur");
-  image_url = g_strdup_printf ("https://i.imgur.com/%s.png", upload_name);
-  thumbnail_url =
-    g_strdup_printf ("https://imgur.com/%sl.png", upload_name);
-  small_thumbnail_url =
-    g_strdup_printf ("https://imgur.com/%ss.png", upload_name);
-
-  image_markup =
-    g_markup_printf_escaped (_("<a href=\"%s\">Full size image</a>"), image_url);
-  thumbnail_markup =
-    g_markup_printf_escaped (_("<a href=\"%s\">Large thumbnail</a>"), thumbnail_url);
-  small_thumbnail_markup =
-    g_markup_printf_escaped (_("<a href=\"%s\">Small thumbnail</a>"), small_thumbnail_url);
-  html_code =
-    g_markup_printf_escaped ("<a href=\"%s\">\n  <img src=\"%s\" />\n</a>",
-                     image_url, thumbnail_url);
-  bb_code =
-    g_strdup_printf ("[url=%s]\n  [img]%s[/img]\n[/url]", image_url, thumbnail_url);
-
-  /* Dialog */
-  dialog =
-    xfce_titled_dialog_new_with_buttons (title,
-                                         NULL,
-                                         GTK_DIALOG_DESTROY_WITH_PARENT,
-                                         "gtk-close",
-                                         GTK_RESPONSE_CLOSE,
-                                         NULL);
-
-  gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
-  gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 0);
-  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 12);
-  gtk_window_set_icon_name (GTK_WINDOW (dialog), "applications-internet");
-  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
-
-  /* Create the main alignment for the dialog */
-  main_alignment = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
-  gtk_widget_set_hexpand (main_alignment, TRUE);
-  gtk_widget_set_vexpand (main_alignment, TRUE);
-  gtk_widget_set_margin_top (main_alignment, 6);
-  gtk_widget_set_margin_bottom (main_alignment, 0);
-  gtk_widget_set_margin_start (main_alignment, 10);
-  gtk_widget_set_margin_end (main_alignment, 10);
-  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_alignment, TRUE, TRUE, 0);
-
-  /* Create the main box for the dialog */
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
-  gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
-  gtk_container_add (GTK_CONTAINER (main_alignment), vbox);
-
-  /* Links bold label */
-  link_label = gtk_label_new ("");
-  gtk_label_set_markup (GTK_LABEL (link_label),
-                        _("<span weight=\"bold\" stretch=\"semiexpanded\">"
-                          "Links</span>"));
-  gtk_widget_set_halign (link_label, GTK_ALIGN_START);
-  gtk_widget_set_valign (link_label, GTK_ALIGN_START);
-  gtk_container_add (GTK_CONTAINER (vbox), link_label);
-
-  /* Links alignment */
-  links_alignment = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
-  gtk_widget_set_hexpand (links_alignment, TRUE);
-  gtk_widget_set_vexpand (links_alignment, TRUE);
-  gtk_widget_set_margin_top (links_alignment, 0);
-  gtk_widget_set_margin_bottom (links_alignment, 0);
-  gtk_widget_set_margin_start (links_alignment, 12);
-  gtk_widget_set_margin_end (links_alignment, 0);
-  gtk_container_add (GTK_CONTAINER (vbox), links_alignment);
-
-  /* Links box */
-  links_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
-  gtk_container_set_border_width (GTK_CONTAINER (links_box), 0);
-  gtk_container_add (GTK_CONTAINER (links_alignment), links_box);
-
-  /* Create the image link */
-  image_link = gtk_label_new (NULL);
-  gtk_label_set_markup (GTK_LABEL (image_link), image_markup);
-  gtk_widget_set_halign (image_link, GTK_ALIGN_START);
-  gtk_widget_set_valign (image_link, GTK_ALIGN_START);
-  gtk_widget_set_tooltip_text (image_link, image_url);
-  gtk_container_add (GTK_CONTAINER (links_box), image_link);
-
-  /* Create the thumbnail link */
-  thumbnail_link = gtk_label_new (NULL);
-  gtk_label_set_markup (GTK_LABEL (thumbnail_link), thumbnail_markup);
-  gtk_widget_set_halign (thumbnail_link, GTK_ALIGN_START);
-  gtk_widget_set_valign (thumbnail_link, GTK_ALIGN_START);
-  gtk_widget_set_tooltip_text (thumbnail_link, thumbnail_url);
-  gtk_container_add (GTK_CONTAINER (links_box), thumbnail_link);
-
-  /* Create the small thumbnail link */
-  small_thumbnail_link = gtk_label_new (NULL);
-  gtk_label_set_markup (GTK_LABEL (small_thumbnail_link), small_thumbnail_markup);
-  gtk_widget_set_halign (small_thumbnail_link, GTK_ALIGN_START);
-  gtk_widget_set_valign (small_thumbnail_link, GTK_ALIGN_START);
-  gtk_widget_set_tooltip_text (small_thumbnail_link, small_thumbnail_url);
-  gtk_container_add (GTK_CONTAINER (links_box), small_thumbnail_link);
-
-  /* Examples bold label */
-  example_label = gtk_label_new ("");
-  gtk_label_set_markup (GTK_LABEL (example_label),
-                        _("<span weight=\"bold\" stretch=\"semiexpanded\">"
-                          "Code for a thumbnail pointing to the full size image</span>"));
-  gtk_widget_set_halign (example_label, GTK_ALIGN_START);
-  gtk_widget_set_valign (example_label, GTK_ALIGN_START);
-  gtk_container_add (GTK_CONTAINER (vbox), example_label);
-
-  /* Code alignment */
-  code_alignment = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
-  gtk_widget_set_hexpand (code_alignment, TRUE);
-  gtk_widget_set_vexpand (code_alignment, TRUE);
-  gtk_widget_set_margin_top (code_alignment, 0);
-  gtk_widget_set_margin_bottom (code_alignment, 0);
-  gtk_widget_set_margin_start (code_alignment, 12);
-  gtk_widget_set_margin_end (code_alignment, 0);
-  gtk_container_add (GTK_CONTAINER (vbox), code_alignment);
-
-  /* Links box */
-  code_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
-  gtk_container_set_border_width (GTK_CONTAINER (code_box), 0);
-  gtk_container_add (GTK_CONTAINER (code_alignment), code_box);
-
-  /* HTML title */
-  html_label = gtk_label_new (_("HTML"));
-  gtk_widget_set_halign (html_label, GTK_ALIGN_START);
-  gtk_widget_set_valign (html_label, GTK_ALIGN_START);
-  gtk_container_add (GTK_CONTAINER (code_box), html_label);
-
-  /* HTML frame */
-  html_frame = gtk_frame_new (NULL);
-  gtk_frame_set_shadow_type (GTK_FRAME (html_frame), GTK_SHADOW_IN);
-  gtk_container_add (GTK_CONTAINER (code_box), html_frame);
-
-  /* HTML code text view */
-  html_buffer = gtk_text_buffer_new (NULL);
-  gtk_text_buffer_set_text (html_buffer, html_code, -1);
-
-  html_code_view = gtk_text_view_new_with_buffer (html_buffer);
-  gtk_text_view_set_left_margin (GTK_TEXT_VIEW (html_code_view),
-                                 10);
-  gtk_text_view_set_editable (GTK_TEXT_VIEW (html_code_view),
-                              FALSE);
-  gtk_container_add (GTK_CONTAINER (html_frame), html_code_view);
-
-  /* BB title */
-  bb_label = gtk_label_new (_("BBCode for forums"));
-  gtk_widget_set_halign (bb_label, GTK_ALIGN_START);
-  gtk_widget_set_valign (bb_label, GTK_ALIGN_START);
-  gtk_container_add (GTK_CONTAINER (code_box), bb_label);
-
-  /* BB frame */
-  bb_frame = gtk_frame_new (NULL);
-  gtk_frame_set_shadow_type (GTK_FRAME (bb_frame), GTK_SHADOW_IN);
-  gtk_container_add (GTK_CONTAINER (code_box), bb_frame);
-
-  /* BBcode text view */
-  bb_buffer = gtk_text_buffer_new (NULL);
-  gtk_text_buffer_set_text (bb_buffer, bb_code, -1);
-
-  bb_code_view = gtk_text_view_new_with_buffer (bb_buffer);
-  gtk_text_view_set_left_margin (GTK_TEXT_VIEW (bb_code_view),
-                                 10);
-  gtk_text_view_set_editable (GTK_TEXT_VIEW (bb_code_view),
-                              FALSE);
-  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (bb_code_view),
-                               GTK_WRAP_CHAR);
-  gtk_container_add (GTK_CONTAINER (bb_frame), bb_code_view);
-
-  /* Show the dialog and run it */
-  gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
-  gtk_dialog_run (GTK_DIALOG (dialog));
-  gtk_widget_destroy (dialog);
-
-  g_object_unref (html_buffer);
-  g_object_unref (bb_buffer);
+  ScreenshooterImgurDialog* dialog = screenshooter_imgur_dialog_new (upload_name, delete_hash);
+  screenshooter_imgur_dialog_run (dialog);
 }
 
diff --git a/lib/screenshooter-job-callbacks.h b/lib/screenshooter-job-callbacks.h
index b7daf71..f9c7495 100644
--- a/lib/screenshooter-job-callbacks.h
+++ b/lib/screenshooter-job-callbacks.h
@@ -52,6 +52,7 @@ cb_update_info                     (ExoJob            *job,
 void
 cb_image_uploaded                  (ScreenshooterJob  *job,
                                     gchar             *upload_name,
+                                    gchar             *delete_hash,
                                     gchar            **last_user);
 void
 cb_ask_for_information             (ScreenshooterJob  *job,
diff --git a/lib/screenshooter-job.c b/lib/screenshooter-job.c
index 8dca9a3..a855d4a 100644
--- a/lib/screenshooter-job.c
+++ b/lib/screenshooter-job.c
@@ -121,9 +121,9 @@ screenshooter_job_class_init (ScreenshooterJobClass *klass)
     g_signal_new ("image-uploaded",
                   G_TYPE_FROM_CLASS (klass), G_SIGNAL_NO_HOOKS,
                   0, NULL, NULL,
-                  _screenshooter_marshal_VOID__STRING,
+                  _screenshooter_marshal_VOID__STRING_STRING,
                   G_TYPE_NONE,
-                  1, G_TYPE_STRING);
+                  2, G_TYPE_STRING, G_TYPE_STRING);
 }
 
 
@@ -188,10 +188,10 @@ void screenshooter_job_ask_info (ScreenshooterJob *job,
 
 
 void
-screenshooter_job_image_uploaded (ScreenshooterJob *job, const gchar *file_name)
+screenshooter_job_image_uploaded (ScreenshooterJob *job, const gchar *file_name, const gchar *delete_hash)
 {
   g_return_if_fail (SCREENSHOOTER_IS_JOB (job));
 
   TRACE ("Emit image-uploaded signal.");
-  exo_job_emit (EXO_JOB (job), job_signals[IMAGE_UPLOADED], 0, file_name);
+  exo_job_emit (EXO_JOB (job), job_signals[IMAGE_UPLOADED], 0, file_name, delete_hash);
 }
diff --git a/lib/screenshooter-job.h b/lib/screenshooter-job.h
index ecb3543..d77d2af 100644
--- a/lib/screenshooter-job.h
+++ b/lib/screenshooter-job.h
@@ -69,7 +69,8 @@ void  screenshooter_job_ask_info       (ScreenshooterJob *job,
 
 
 void  screenshooter_job_image_uploaded (ScreenshooterJob *job,
-                                        const gchar      *file_name);
+                                        const gchar      *file_name,
+                                        const gchar      *delete_hash);
 
 G_END_DECLS
 
diff --git a/lib/screenshooter-marshal.list b/lib/screenshooter-marshal.list
index c62b28c..d7f4e10 100644
--- a/lib/screenshooter-marshal.list
+++ b/lib/screenshooter-marshal.list
@@ -1,2 +1,3 @@
 VOID:STRING
 VOID:POINTER,STRING
+VOID:STRING,STRING

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list