[Xfce4-commits] [apps/xfce4-screenshooter] 01/01: Remove zimagez support (Bug #14283)
noreply at xfce.org
noreply at xfce.org
Wed Apr 18 19:20:05 CEST 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 5fe8d8971ab0895d2e2b3fdf561f3141d9c95a6d
Author: Andre Miranda <andreldm at xfce.org>
Date: Wed Apr 18 14:07:08 2018 -0300
Remove zimagez support (Bug #14283)
Because the service is out since a couple of months.
Instead of supporting every image hosting service out there,
at some point I hope to introduce user custom actions.
Instead of binary plugins, a simpler approach similar
to Thunar Archive Plugin .tap text files should be enough
and user-friendlier.
---
Makefile.am | 3 +-
README | 4 +-
lib/screenshooter-actions.c | 15 -
lib/screenshooter-actions.h | 1 -
lib/screenshooter-dialogs.c | 23 --
lib/screenshooter-global.h | 3 +-
lib/screenshooter-job-callbacks.c | 41 +-
lib/screenshooter-job.c | 5 +-
lib/screenshooter-zimagez.c | 669 ---------------------------------
lib/screenshooter-zimagez.h | 40 --
po/POTFILES.in | 1 -
src/main.c | 34 +-
src/xfce4-screenshooter.appdata.xml.in | 2 +-
xfce4-screenshooter.1 | 52 +--
14 files changed, 53 insertions(+), 840 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 6d738ee..b9b6f29 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,8 +33,7 @@ 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-zimagez.c lib/screenshooter-zimagez.h
+ lib/screenshooter-imgur.c lib/screenshooter-imgur.h
lib_libscreenshooter_la_CFLAGS = \
-I$(top_srcdir) \
diff --git a/README b/README
index e7c4bfd..1f21f07 100644
--- a/README
+++ b/README
@@ -2,8 +2,8 @@ This application allows you to capture the entire screen, the active
window or a selected region. You can set the delay that elapses
before the screenshot is taken and the action that will be done with
the screenshot: save it to a PNG file, copy it to the clipboard, open
-it using another application, or host it on ZimageZ or imgur.com,
-some free online image hosting service.
+it using another application, or host it on imgur.com,
+a free online image hosting service.
A plugin for the Xfce panel is also available.
diff --git a/lib/screenshooter-actions.c b/lib/screenshooter-actions.c
index 8cea9f3..260e546 100644
--- a/lib/screenshooter-actions.c
+++ b/lib/screenshooter-actions.c
@@ -125,21 +125,6 @@ gboolean screenshooter_action_idle (ScreenshotData *sd)
screenshooter_open_screenshot (screenshot_path, sd->app, sd->app_info);
else if (sd->action & UPLOAD_IMGUR)
screenshooter_upload_to_imgur (screenshot_path, sd->title);
- else if (sd->action & UPLOAD_ZIMAGEZ)
- {
- gchar *new_last_user = NULL;
-
- screenshooter_upload_to_zimagez (screenshot_path,
- sd->last_user,
- sd->title,
- &new_last_user);
-
- if (new_last_user)
- {
- g_free (sd->last_user);
- sd->last_user = new_last_user;
- }
- }
}
g_object_unref (temp_dir);
diff --git a/lib/screenshooter-actions.h b/lib/screenshooter-actions.h
index 5dee7c9..c09f9df 100644
--- a/lib/screenshooter-actions.h
+++ b/lib/screenshooter-actions.h
@@ -24,7 +24,6 @@
#include "screenshooter-capture.h"
#include "screenshooter-global.h"
#include "screenshooter-dialogs.h"
-#include "screenshooter-zimagez.h"
#include "screenshooter-imgur.h"
gboolean screenshooter_take_screenshot_idle (ScreenshotData *sd);
diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c
index 0ffd8f0..bc4e5c5 100644
--- a/lib/screenshooter-dialogs.c
+++ b/lib/screenshooter-dialogs.c
@@ -53,9 +53,6 @@ static void
cb_clipboard_toggled (GtkToggleButton *tb,
ScreenshotData *sd);
static void
-cb_zimagez_toggled (GtkToggleButton *tb,
- ScreenshotData *sd);
-static void
cb_imgur_toggled (GtkToggleButton *tb,
ScreenshotData *sd);
static void
@@ -187,12 +184,6 @@ static void cb_clipboard_toggled (GtkToggleButton *tb, ScreenshotData *sd)
-static void cb_zimagez_toggled (GtkToggleButton *tb, ScreenshotData *sd)
-{
- if (gtk_toggle_button_get_active (tb))
- sd->action = UPLOAD_ZIMAGEZ;
-}
-
static void cb_imgur_toggled (GtkToggleButton *tb, ScreenshotData *sd)
{
if (gtk_toggle_button_get_active (tb))
@@ -924,7 +915,6 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
GtkWidget *actions_label, *actions_alignment, *actions_grid;
GtkWidget *save_radio_button;
GtkWidget *clipboard_radio_button, *open_with_radio_button;
- GtkWidget *zimagez_radio_button;
GtkWidget *imgur_radio_button;
GtkListStore *liststore;
@@ -1064,19 +1054,6 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
/* Run the callback functions to grey/ungrey the correct widgets */
cb_toggle_set_sensi (GTK_TOGGLE_BUTTON (open_with_radio_button), combobox);
- /* Upload to zimagez radio button */
- zimagez_radio_button =
- gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (save_radio_button),
- _("Host on ZimageZ"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (zimagez_radio_button),
- (sd->action & UPLOAD_ZIMAGEZ));
- gtk_widget_set_tooltip_text (zimagez_radio_button,
- _("Host the screenshot on ZimageZ, a free online "
- "image hosting service"));
- g_signal_connect (G_OBJECT (zimagez_radio_button), "toggled",
- G_CALLBACK (cb_zimagez_toggled), sd);
- gtk_grid_attach (GTK_GRID (actions_grid), zimagez_radio_button, 0, 3, 1, 1);
-
/* Upload to imgur radio button */
imgur_radio_button =
gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (save_radio_button),
diff --git a/lib/screenshooter-global.h b/lib/screenshooter-global.h
index ce62b47..bf072eb 100644
--- a/lib/screenshooter-global.h
+++ b/lib/screenshooter-global.h
@@ -33,8 +33,7 @@ enum {
SAVE = 1,
CLIPBOARD = 2,
OPEN = 4,
- UPLOAD_ZIMAGEZ = 8,
- UPLOAD_IMGUR = 16,
+ UPLOAD_IMGUR = 8,
};
diff --git a/lib/screenshooter-job-callbacks.c b/lib/screenshooter-job-callbacks.c
index 64aa538..30a91a7 100644
--- a/lib/screenshooter-job-callbacks.c
+++ b/lib/screenshooter-job-callbacks.c
@@ -165,7 +165,7 @@ cb_ask_for_information (ScreenshooterJob *job,
/* Create the information dialog */
dialog =
- xfce_titled_dialog_new_with_buttons (_("Details about the screenshot for ZimageZ"),
+ xfce_titled_dialog_new_with_buttons (_("Details about the screenshot"),
NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
"gtk-cancel",
@@ -219,7 +219,7 @@ cb_ask_for_information (ScreenshooterJob *job,
/* Create the user entry */
user_entry = gtk_entry_new ();
gtk_widget_set_tooltip_text (user_entry,
- _("Your Zimagez user name, if you do not have one yet"
+ _("Your user name, if you do not have one yet"
" please create one on the Web page linked above"));
gtk_entry_set_activates_default (GTK_ENTRY (user_entry), TRUE);
gtk_grid_attach (GTK_GRID (grid), user_entry, 1, 0, 1, 1);
@@ -247,7 +247,7 @@ cb_ask_for_information (ScreenshooterJob *job,
title_entry = gtk_entry_new ();
gtk_widget_set_tooltip_text (title_entry,
_("The title of the screenshot, it will be used when"
- " displaying the screenshot on ZimageZ"));
+ " displaying the screenshot on the image hosting service"));
gtk_entry_set_activates_default (GTK_ENTRY (title_entry), TRUE);
gtk_grid_attach (GTK_GRID (grid), title_entry, 1, 2, 1, 1);
@@ -261,7 +261,7 @@ cb_ask_for_information (ScreenshooterJob *job,
comment_entry = gtk_entry_new ();
gtk_widget_set_tooltip_text (comment_entry,
_("A comment on the screenshot, it will be used when"
- " displaying the screenshot on ZimageZ"));
+ " displaying the screenshot on the image hosting service"));
gtk_entry_set_activates_default (GTK_ENTRY (comment_entry), TRUE);
gtk_grid_attach (GTK_GRID (grid), comment_entry, 1, 3, 1, 1);
@@ -369,33 +369,18 @@ void cb_image_uploaded (ScreenshooterJob *job,
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 *job_type, *title;
+ gchar *title;
gchar *last_user_temp;
g_return_if_fail (upload_name != NULL);
- job_type = g_object_get_data(G_OBJECT (job), "jobtype");
- if (!strcmp(job_type, "imgur")) {
- 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);
- } else {
- g_return_if_fail (last_user == NULL || *last_user == NULL);
- title = _("My screenshot on ZimageZ");
- image_url = g_strdup_printf ("http://www.zimagez.com/zimage/%s.php", upload_name);
- thumbnail_url =
- g_strdup_printf ("http://www.zimagez.com/miniature/%s.php", upload_name);
- small_thumbnail_url =
- g_strdup_printf ("http://www.zimagez.com/avatar/%s.php", upload_name);
- last_user_temp = g_object_get_data (G_OBJECT (job), "user");
-
- if (last_user_temp == NULL)
- last_user_temp = g_strdup ("");
-
- *last_user = g_strdup (last_user_temp);
- }
+
+ 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 =
diff --git a/lib/screenshooter-job.c b/lib/screenshooter-job.c
index 6f8f574..8dca9a3 100644
--- a/lib/screenshooter-job.c
+++ b/lib/screenshooter-job.c
@@ -111,10 +111,11 @@ screenshooter_job_class_init (ScreenshooterJobClass *klass)
/**
* ScreenshooterJob::image-uploaded:
* @job : a #ScreenshooterJob.
- * @file_name : the name of the uploaded image on ZimageZ.com.
+ * @file_name : the name of the uploaded image on the image hosting service.
*
* This signal is emitted when the upload is finished. If it was successful,
- * @file_name contains the name of the file on ZimageZ.com, else it is NULL.
+ * @file_name contains the name of the file on the image hosting service, else
+ * it is NULL.
**/
job_signals[IMAGE_UPLOADED] =
g_signal_new ("image-uploaded",
diff --git a/lib/screenshooter-zimagez.c b/lib/screenshooter-zimagez.c
deleted file mode 100644
index 6dc3927..0000000
--- a/lib/screenshooter-zimagez.c
+++ /dev/null
@@ -1,669 +0,0 @@
-/* $Id$
- *
- * Copyright © 2009-2010 Jérôme Guelfucci <jeromeg at xfce.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- * */
-
-
-/* XML-RPC API for ZimageZ */
-
-/* URL of the API: http://www.zimagez.com/apiXml.php
-
- xmlrpcLogin: Takes the user name and the password (encrypted using rot13 and
- reversed using g_strrev.
- Returns a string containing the ID for the user session if the couple was correct.
- Returns a boolean set to FALSE if the couple was wrong.
-
- xmlrpcLogout: destroys the current user session.
-
- xmlrpcUpload: Takes the file content encoded in base64, the name of the file,
- the title of the picture, a comment and the user session ID.
- Returns the name of the file on the website if the upload was succesful.
- Returns a boolean set to FALSE if the upload failed.
-
- If the returned name is "wii0". The URLs will be:
- * http://www.zimagez.com/zimage/wii0.php for the image.
- * http://www.zimagez.com/miniature/wii0.jpg for the thumbnail.
- * http://www.zimagez.com/avatar/wii0.jpg for the avatar.
-
-*/
-
-#include "screenshooter-zimagez.h"
-#include "screenshooter-job-callbacks.h"
-
-static gboolean do_xmlrpc (SoupSession *session,
- const gchar *uri,
- const gchar *method,
- GError **error,
- GValue *retval,
- ...);
-static gboolean has_empty_field (GtkListStore *liststore);
-static gboolean zimagez_upload_job (ScreenshooterJob *job,
- GArray *param_values,
- GError **error);
-
-
-/* Private */
-
-
-
-static gboolean
-do_xmlrpc (SoupSession *session, const gchar *uri, const gchar *method,
- GError **error, GValue *retval, ...)
-{
- SoupMessage *msg;
- va_list args;
- GArray *params = g_array_sized_new(FALSE, FALSE, sizeof(GValue), 1);
- GError *err = NULL;
- char *body;
- GType type;
- GValue val;
-
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- va_start (args, retval);
-
- //copy soup_value_array_from_args() in here and change datatypes respectivly
- while ((type = va_arg (args, GType)) != G_TYPE_INVALID)
- {
- SOUP_VALUE_SETV (&val, type, args);
- g_array_append_val (params, val);
- }
-
- va_end (args);
-
- body = soup_xmlrpc_build_method_call (method, (GValue*)params->data,
- params->len);
- g_array_unref (params);
-
- if (!body)
- {
- err = g_error_new (SOUP_XMLRPC_FAULT,
- SOUP_XMLRPC_FAULT_APPLICATION_ERROR,
- _("An error occurred while creating the XMLRPC"
- " request."));
- g_propagate_error (error, err);
-
- return FALSE;
- }
-
- msg = soup_message_new ("POST", uri);
- soup_message_set_request (msg, "text/xml", SOUP_MEMORY_TAKE,
- body, strlen (body));
- soup_session_send_message (session, msg);
-
- if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
- {
- TRACE ("Error during the XMLRPC exchange: %d %s\n",
- msg->status_code, msg->reason_phrase);
-
- err = g_error_new (SOUP_XMLRPC_FAULT,
- SOUP_XMLRPC_FAULT_TRANSPORT_ERROR,
- _("An error occurred while transferring the data"
- " to ZimageZ."));
- g_propagate_error (error, err);
- g_object_unref (msg);
-
- return FALSE;
- }
-
- if (!soup_xmlrpc_parse_method_response (msg->response_body->data,
- msg->response_body->length,
- retval, &err))
- {
- if (err)
- {
- TRACE ("Fault when parsing the response: %d %s\n",
- err->code, err->message);
-
- g_propagate_error (error, err);
- }
- else
- {
- TRACE ("Unable to parse the response, and no error...");
-
- err = g_error_new (SOUP_XMLRPC_FAULT,
- SOUP_XMLRPC_FAULT_APPLICATION_ERROR,
- _("An error occurred while parsing the response"
- " from ZimageZ."));
- g_propagate_error (error, err);
- }
-
- g_object_unref (msg);
- return FALSE;
- }
-
- g_object_unref (msg);
-
- return TRUE;
-}
-
-
-
-static gboolean
-has_empty_field (GtkListStore *liststore)
-{
- GtkTreeIter iter;
- gboolean result = FALSE;
-
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (liststore), &iter);
-
- do
- {
- gchar *field = NULL;
-
- gtk_tree_model_get (GTK_TREE_MODEL (liststore), &iter, 1, &field, -1);
- result = result || g_str_equal (field, "");
-
- g_free (field);
-
- }
- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (liststore), &iter));
-
- return result;
-}
-
-
-
-static gboolean
-zimagez_upload_job (ScreenshooterJob *job, GArray *param_values, GError **error)
-{
- const gchar *encoded_data;
- const gchar *image_path;
- const gchar *last_user;
- const gchar *proxy_uri;
- /* For translators: the first wildcard is the date, the second one the time,
- * e.g. "Taken on 12/31/99, at 23:13:48". */
- gchar *comment = screenshooter_get_datetime (_("Taken on %x, at %X"));
- gchar *data = NULL;
- gchar *encoded_password = NULL;
- gchar *file_name = NULL;
- gchar *login_response = NULL;
- gchar *online_file_name = NULL;
- gchar *password = g_strdup ("");
- gchar *title;
- gchar *user;
-
- gsize data_length;
- gboolean response = FALSE;
-
- const gchar *serverurl = "http://www.zimagez.com/apiXml.php";
- const gchar *method_login = "apiXml.xmlrpcLogin";
- const gchar *method_logout = "apiXml.xmlrpcLogout";
- const gchar *method_upload = "apiXml.xmlrpcUpload";
- SoupSession *session;
- SoupURI *soup_proxy_uri;
-
- GError *tmp_error = NULL;
- GtkTreeIter iter;
- GtkListStore *liststore;
- GValue response_value;
-
- g_return_val_if_fail (SCREENSHOOTER_IS_JOB (job), FALSE);
- g_return_val_if_fail (param_values != NULL, FALSE);
- g_return_val_if_fail (param_values->len == 3, FALSE);
- g_return_val_if_fail (G_VALUE_HOLDS_STRING (&g_array_index (param_values, GValue, 0)), FALSE);
- g_return_val_if_fail (G_VALUE_HOLDS_STRING (&g_array_index (param_values, GValue, 1)), FALSE);
- g_return_val_if_fail (G_VALUE_HOLDS_STRING (&g_array_index (param_values, GValue, 2)), FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- g_object_set_data (G_OBJECT (job), "jobtype", "zimagez");
- if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
- {
- g_free (comment);
- g_free (password);
-
- return FALSE;
- }
-
- /* Get the last user */
- last_user = g_value_get_string (&g_array_index (param_values, GValue, 1));
- user = g_strdup (last_user);
-
- if (user == NULL)
- user = g_strdup ("");
-
- if (!g_utf8_validate (user, -1, NULL))
- {
- g_free (user);
- user = g_strdup ("");
- }
-
- g_object_set_data_full (G_OBJECT (job), "user",
- g_strdup (user), (GDestroyNotify) g_free);
-
- /* Get the default title */
- title = g_strdup (g_value_get_string (&g_array_index (param_values, GValue, 2)));
- if (title == NULL)
- title = g_strdup ("");
-
- if (!g_utf8_validate (title, -1, NULL))
- {
- g_free (title);
- title = g_strdup ("");
- }
-
- /* Get the path of the image that is to be uploaded */
- image_path = g_value_get_string (&g_array_index (param_values, GValue, 0));
-
- /* Start the user soup session */
- exo_job_info_message (EXO_JOB (job), _("Initialize the connection..."));
- session = soup_session_new ();
-
- /* Set the proxy URI if any */
- proxy_uri = g_getenv ("http_proxy");
-
- if (proxy_uri != NULL)
- {
- soup_proxy_uri = soup_uri_new (proxy_uri);
- g_object_set (session, "proxy-uri", soup_proxy_uri, NULL);
- soup_uri_free (soup_proxy_uri);
- }
-
- TRACE ("Get the information liststore ready.");
- liststore = gtk_list_store_new (2, G_TYPE_INT, G_TYPE_STRING);
-
- TRACE ("Append the user");
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter,
- 0, USER,
- 1, user,
- -1);
-
- TRACE ("Append the password");
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter,
- 0, PASSWORD,
- 1, password,
- -1);
-
- TRACE ("Append the title");
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter,
- 0, TITLE,
- 1, title,
- -1);
-
- TRACE ("Append the comment");
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter,
- 0, COMMENT,
- 1, comment,
- -1);
-
- TRACE ("Ask the user to fill the information items.");
- screenshooter_job_ask_info (job, liststore,
- _("Please fill the following fields with your "
- "<a href=\"http://www.zimagez.com\">ZimageZ</a> \n"
- "user name, passsword and details about the screenshot."));
-
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (liststore), &iter);
-
- do
- {
- gint field_index;
- gchar *field_value = NULL;
-
- gtk_tree_model_get (GTK_TREE_MODEL (liststore), &iter,
- 0, &field_index,
- 1, &field_value,
- -1);
-
- switch (field_index)
- {
- case USER:
- user = g_strdup (field_value);
- break;
- case PASSWORD:
- password = g_strdup (field_value);
- break;
- case TITLE:
- title = g_strdup (field_value);
- break;
- case COMMENT:
- comment = g_strdup (field_value);
- break;
- default:
- break;
- }
-
- g_free (field_value);
- }
- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (liststore), &iter));
-
- while (!response)
- {
- if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
- {
- soup_session_abort (session);
- g_object_unref (session);
-
- g_free (user);
- g_free (password);
- g_free (title);
- g_free (comment);
- if (encoded_password != NULL)
- g_free (encoded_password);
-
- TRACE ("The upload job was cancelled.");
-
- return FALSE;
- }
-
- exo_job_info_message (EXO_JOB (job), _("Check the user information..."));
-
- /* Test if one of the information fields is empty */
- if (has_empty_field (liststore))
- {
- TRACE ("One of the fields was empty, let the user file it.");
- screenshooter_job_ask_info (job, liststore,
- _("<span weight=\"bold\" foreground=\"darkred\" "
- "stretch=\"semiexpanded\">You must fill all the "
- "fields.</span>"));
- continue;
- }
-
- encoded_password = g_utf8_strreverse (rot13 (password), -1);
-
- TRACE ("User: %s", user);
- TRACE ("Encoded password: %s", encoded_password);
-
- /* Start the user session */
- TRACE ("Call the login method");
-
- exo_job_info_message (EXO_JOB (job), _("Login on ZimageZ..."));
-
- if (!do_xmlrpc (session, serverurl, method_login,
- &tmp_error, &response_value,
- G_TYPE_STRING, user,
- G_TYPE_STRING, encoded_password,
- G_TYPE_INVALID))
- {
- g_propagate_error (error, tmp_error);
- soup_session_abort (session);
- g_object_unref (session);
-
- g_free (password);
- g_free (title);
- g_free (comment);
- g_free (encoded_password);
-
- return FALSE;
- }
-
- TRACE ("Read the login response");
-
- /* If the response is a boolean, there was an error */
- if (G_VALUE_HOLDS_BOOLEAN (&response_value))
- {
- response = g_value_get_boolean (&response_value);
- }
- /* Else we read the string response to get the session ID */
- else if (G_VALUE_HOLDS_STRING (&response_value))
- {
- TRACE ("Read the session ID");
- login_response = g_strdup (g_value_get_string (&response_value));
- response = TRUE;
- }
- /* We received an unexpected reply */
- else
- {
- GError *tmp_err =
- g_error_new (SOUP_XMLRPC_FAULT,
- SOUP_XMLRPC_FAULT_PARSE_ERROR_NOT_WELL_FORMED,
- "%s", _("An unexpected reply from ZimageZ was received."
- " The upload of the screenshot failed."));
- soup_session_abort (session);
- g_object_unref (session);
-
- g_free (user);
- g_free (password);
- g_free (title);
- g_free (comment);
- g_free (encoded_password);
-
- g_propagate_error (error, tmp_err);
-
- return FALSE;
- }
-
- g_value_unset (&response_value);
-
- if (!response)
- {
- /* Login failed, erase the password and ask for the correct on to the
- user */
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (liststore), &iter);
-
- do
- {
- gint field_index;
-
- gtk_tree_model_get (GTK_TREE_MODEL (liststore), &iter, 0, &field_index, -1);
-
- if (field_index == PASSWORD)
- {
- gtk_list_store_set (liststore, &iter, 1, g_strdup (""), -1);
- break;
- }
- }
- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (liststore), &iter));
-
- screenshooter_job_ask_info (job, liststore,
- _("<span weight=\"bold\" foreground=\"darkred\" "
- "stretch=\"semiexpanded\">The user and the "
- "password you entered do not match. "
- "Please retry.</span>"));
-
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (liststore), &iter);
-
- do
- {
- gint field_index;
- gchar *field_value = NULL;
-
- gtk_tree_model_get (GTK_TREE_MODEL (liststore), &iter,
- 0, &field_index,
- 1, &field_value,
- -1);
-
- switch (field_index)
- {
- case USER:
- user = g_strdup (field_value);
- break;
- case PASSWORD:
- password = g_strdup (field_value);
- break;
- case TITLE:
- title = g_strdup (field_value);
- break;
- case COMMENT:
- comment = g_strdup (field_value);
- break;
- default:
- break;
- }
-
- g_free (field_value);
- }
- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (liststore), &iter));
- }
- }
-
- g_object_set_data_full (G_OBJECT (job), "user",
- g_strdup (user), (GDestroyNotify) g_free);
-
- g_free (user);
- g_free (password);
- g_free (encoded_password);
-
- /* Get the contents of the image file and encode it to base64 */
- g_file_get_contents (image_path, &data, &data_length, NULL);
-
- encoded_data = g_base64_encode ((guchar*)data, data_length);
-
- g_free (data);
-
- /* Get the basename of the image path */
- file_name = g_path_get_basename (image_path);
-
- exo_job_info_message (EXO_JOB (job), _("Upload the screenshot..."));
-
- TRACE ("Call the upload method");
- do_xmlrpc (session, serverurl, method_upload,
- &tmp_error, &response_value,
- G_TYPE_STRING, encoded_data,
- G_TYPE_STRING, file_name,
- G_TYPE_STRING, title,
- G_TYPE_STRING, comment,
- G_TYPE_STRING, login_response,
- G_TYPE_INVALID);
-
- g_free (title);
- g_free (comment);
- g_free (file_name);
-
- if (tmp_error)
- {
- soup_session_abort (session);
- g_object_unref (session);
-
- g_propagate_error (error, tmp_error);
-
- return FALSE;
- }
-
- /* If the response is a boolean, there was an error */
- if (G_VALUE_HOLDS_BOOLEAN (&response_value))
- {
- if (!g_value_get_boolean (&response_value))
- {
- GError *tmp_err =
- g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED,
- _("An error occurred while uploading the screenshot."));
-
- soup_session_abort (session);
- g_object_unref (session);
- g_propagate_error (error, tmp_err);
-
- return FALSE;
- }
- }
- /* Else we get the file name */
- else if (G_VALUE_HOLDS_STRING (&response_value))
- {
- TRACE ("The screenshot has been uploaded, get the file name.");
- online_file_name = g_strdup (g_value_get_string (&response_value));
- }
- /* We received un unexpected reply */
- else
- {
- GError *tmp_err =
- g_error_new (SOUP_XMLRPC_FAULT,
- SOUP_XMLRPC_FAULT_PARSE_ERROR_NOT_WELL_FORMED,
- "%s", _("An unexpected reply from ZimageZ was received."
- " The upload of the screenshot failed."));
- soup_session_abort (session);
- g_object_unref (session);
- g_propagate_error (error, tmp_err);
-
- return FALSE;
- }
-
- g_value_unset (&response_value);
-
- /* End the user session */
- exo_job_info_message (EXO_JOB (job), _("Close the session on ZimageZ..."));
-
- TRACE ("Closing the user session");
-
- do_xmlrpc (session, serverurl, method_logout,
- &tmp_error, &response_value,
- G_TYPE_STRING, login_response,
- G_TYPE_INVALID);
-
- if (G_IS_VALUE (&response_value))
- g_value_unset (&response_value);
-
- /* Clean the soup session */
- soup_session_abort (session);
- g_object_unref (session);
- g_free (login_response);
-
- screenshooter_job_image_uploaded (job, online_file_name);
-
- if (tmp_error)
- {
- g_propagate_error (error, tmp_error);
-
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Public */
-
-/**
- * screenshooter_upload_to_zimagez:
- * @image_path: the local path of the image that should be uploaded to
- * ZimageZ.com.
- * @last_user: the last user name used, to pre-fill the user field.
- * @title: a default title, to pre-fill the title field.
- * @new_last_user: address of the string used to store the new user
- * if the upload is succesful.
- *
- * Uploads the image whose path is @image_path: a dialog asks for the user
- * login, password, a title for the image and a comment; then the image is
- * uploaded. The dialog is shown again with a warning is the password did
- * not match the user name. The user can also cancel the upload procedure.
- *
- * If the upload was succesful, @new_last_user points to the user name for
- * which the upload was done.
- *
- **/
-
-void screenshooter_upload_to_zimagez (const gchar *image_path,
- const gchar *last_user,
- const gchar *title,
- gchar **new_last_user)
-{
- ScreenshooterJob *job;
- GtkWidget *dialog, *label;
-
- g_return_if_fail (image_path != NULL);
- g_return_if_fail (new_last_user == NULL || *new_last_user == NULL);
-
- dialog = create_spinner_dialog(_("ZimageZ"), &label);
-
- job = screenshooter_simple_job_launch (zimagez_upload_job, 3,
- G_TYPE_STRING, image_path,
- G_TYPE_STRING, last_user,
- G_TYPE_STRING, title);
-
- /* dismiss the spinner dialog after success or error */
- g_signal_connect_swapped (job, "error", G_CALLBACK (gtk_widget_hide), dialog);
- g_signal_connect_swapped (job, "image-uploaded", G_CALLBACK (gtk_widget_hide), dialog);
-
- g_signal_connect (job, "ask", G_CALLBACK (cb_ask_for_information), NULL);
- g_signal_connect (job, "image-uploaded", G_CALLBACK (cb_image_uploaded), new_last_user);
- g_signal_connect (job, "error", G_CALLBACK (cb_error), NULL);
- g_signal_connect (job, "finished", G_CALLBACK (cb_finished), dialog);
- g_signal_connect (job, "info-message", G_CALLBACK (cb_update_info), label);
-
- gtk_dialog_run (GTK_DIALOG (dialog));
-}
diff --git a/lib/screenshooter-zimagez.h b/lib/screenshooter-zimagez.h
deleted file mode 100644
index 6774c69..0000000
--- a/lib/screenshooter-zimagez.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $Id$
- *
- * Copyright © 2009 Jérôme Guelfucci <jeromeg at xfce.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- * */
-
-#ifndef __HAVE_ZIMAGEZ_H__
-#define __HAVE_ZIMAGEZ_H__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#include <glib/gstdio.h>
-#include <libsoup/soup.h>
-
-#include "screenshooter-utils.h"
-#include "screenshooter-simple-job.h"
-
-void screenshooter_upload_to_zimagez (const gchar *image_path,
- const gchar *last_user,
- const gchar *title,
- gchar **new_last_user);
-
-
-#endif
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 27e4767..8d011be 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,5 @@
lib/screenshooter-dialogs.c
lib/screenshooter-utils.c
-lib/screenshooter-zimagez.c
lib/screenshooter-imgur.c
lib/screenshooter-job-callbacks.c
src/main.c
diff --git a/src/main.c b/src/main.c
index 0a0dd8a..beee718 100644
--- a/src/main.c
+++ b/src/main.c
@@ -33,7 +33,6 @@ gboolean window = FALSE;
gboolean region = FALSE;
gboolean fullscreen = FALSE;
gboolean mouse = FALSE;
-gboolean upload = FALSE;
gboolean clipboard = FALSE;
gboolean upload_imgur = FALSE;
gchar *screenshot_dir = NULL;
@@ -83,11 +82,6 @@ static GOptionEntry entries[] =
NULL
},
{
- "upload", 'u', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &upload,
- N_("Host the screenshot on ZimageZ, a free online image hosting service"),
- NULL
- },
- {
"imgur", 'i', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &upload_imgur,
N_("Host the screenshot on Imgur, a free online image hosting service"),
NULL
@@ -196,32 +190,13 @@ int main (int argc, char **argv)
}
/* Exit if two actions options were given */
- if (upload && (application != NULL))
- {
- g_printerr (conflict_error, "upload", "open");
-
- g_free (sd);
- return EXIT_FAILURE;
- }
- else if (upload && (screenshot_dir != NULL))
- {
- g_printerr (conflict_error, "upload", "save");
-
- g_free (sd);
- return EXIT_FAILURE;
- }
- else if ((application != NULL) && (screenshot_dir != NULL))
+ if ((application != NULL) && (screenshot_dir != NULL))
{
g_printerr (conflict_error, "open", "save");
g_free (sd);
return EXIT_FAILURE;
}
- else if (upload_imgur && upload)
- {
- g_printerr (conflict_error, "upload", "imgur");
- return EXIT_FAILURE;
- }
else if (upload_imgur && (screenshot_dir != NULL))
{
g_printerr (conflict_error, "imgur", "save");
@@ -241,8 +216,6 @@ int main (int argc, char **argv)
g_printerr (ignore_error, "save");
if (upload_imgur && !(fullscreen || window || region))
g_printerr (ignore_error, "imgur");
- if (upload && !(fullscreen || window || region))
- g_printerr (ignore_error, "upload");
if (clipboard && !(fullscreen || window || region))
g_printerr (ignore_error, "clipboard");
if (delay && !(fullscreen || window || region))
@@ -300,11 +273,6 @@ int main (int argc, char **argv)
sd->action = OPEN;
sd->action_specified = TRUE;
}
- else if (upload)
- {
- sd->action = UPLOAD_ZIMAGEZ;
- sd->action_specified = TRUE;
- }
else if (upload_imgur)
{
sd->action = UPLOAD_IMGUR;
diff --git a/src/xfce4-screenshooter.appdata.xml.in b/src/xfce4-screenshooter.appdata.xml.in
index 03d2bee..d0bcfd9 100644
--- a/src/xfce4-screenshooter.appdata.xml.in
+++ b/src/xfce4-screenshooter.appdata.xml.in
@@ -12,7 +12,7 @@
or a selected region. You can set the delay that elapses before the screenshot
is taken and the action that will be done with the screenshot: save it to a PNG
file, copy it to the clipboard, open it using another application, or host it on
- ZimageZ or imgur, free online image hosting services.
+ imgur, a free online image hosting service.
</_p>
</description>
diff --git a/xfce4-screenshooter.1 b/xfce4-screenshooter.1
index 2b85c8f..71f0e9c 100644
--- a/xfce4-screenshooter.1
+++ b/xfce4-screenshooter.1
@@ -1,11 +1,11 @@
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.5.
-.TH XFCE4-SCREENSHOOTER "1" "February 2012" "xfce4-screenshooter 1.8.1" "User Commands"
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
+.TH XFCE4-SCREENSHOOTER "1" "April 2018" "xfce4-screenshooter 1.9.1.gitifelse(, git, xfce4_screenshooter_version_tag()-xfce4_screenshooter_version_build(), xfce4_screenshooter_version_tag())" "User Commands"
.SH NAME
-xfce4-screenshooter \- application to take screenshots
+xfce4-screenshooter \- manual page for xfce4-screenshooter 1.9.1.gitifelse(, git, xfce4_screenshooter_version_tag()-xfce4_screenshooter_version_build(), xfce4_screenshooter_version_tag())
.SH DESCRIPTION
.SS "Usage:"
.IP
-xfce4\-screenshooter [OPTION...]
+xfce4\-screenshooter [OPTION?]
.SS "Help Options:"
.TP
\fB\-h\fR, \fB\-\-help\fR
@@ -18,37 +18,47 @@ Show all help options
Show GTK+ Options
.SS "Application Options:"
.TP
-\fB\-s\fR, \fB\-\-save\fR
-Directory where the screenshot will be saved
-.TP
-\fB\-u\fR, \fB\-\-upload\fR
-Host the screenshot on ZimageZ, a free online image hosting service
-.TP
\fB\-c\fR, \fB\-\-clipboard\fR
Copy the screenshot to the clipboard
.TP
-\fB\-o\fR, \fB\-\-open\fR
-Application to open the screenshot
-.TP
\fB\-d\fR, \fB\-\-delay\fR
Delay in seconds before taking the screenshot
.TP
+\fB\-f\fR, \fB\-\-fullscreen\fR
+Take a screenshot of the entire screen
+.TP
\fB\-m\fR, \fB\-\-mouse\fR
Display the mouse on the screenshot
.TP
-\fB\-f\fR, \fB\-\-fullscreen\fR
-Take a screenshot of the entire screen
+\fB\-o\fR, \fB\-\-open\fR
+Application to open the screenshot
.TP
\fB\-r\fR, \fB\-\-region\fR
-Select a region to be captured by clicking a point of the screen without
-releasing the mouse button, dragging your mouse to the other corner of
-the region, and releasing the mouse button.
+Select a region to be captured by clicking a point of the screen without releasing the mouse button, dragging your mouse to the other corner of the region, and releasing the mouse button.
.TP
-\fB\-w\fR, \fB\-\-window\fR
-Take a screenshot of the active window
+\fB\-s\fR, \fB\-\-save\fR
+Directory where the screenshot will be saved
+.TP
+\fB\-i\fR, \fB\-\-imgur\fR
+Host the screenshot on Imgur, a free online image hosting service
.TP
\fB\-V\fR, \fB\-\-version\fR
Version information
.TP
-\fB\-\-display\fR=\fIDISPLAY\fR
+\fB\-w\fR, \fB\-\-window\fR
+Take a screenshot of the active window
+.TP
+\fB\-\-display\fR=\fI\,DISPLAY\/\fR
X display to use
+.SH "SEE ALSO"
+The full documentation for
+.B xfce4-screenshooter
+is maintained as a Texinfo manual. If the
+.B info
+and
+.B xfce4-screenshooter
+programs are properly installed at your site, the command
+.IP
+.B info xfce4-screenshooter
+.PP
+should give you access to the complete manual.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list