Skip to content

Commit

Permalink
Remove zimagez support (Bug #14283)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andreldm committed Apr 18, 2018
1 parent 1054de6 commit 5fe8d89
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 840 deletions.
3 changes: 1 addition & 2 deletions Makefile.am
Expand Up @@ -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) \
Expand Down
4 changes: 2 additions & 2 deletions README
Expand Up @@ -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.

Expand Down
15 changes: 0 additions & 15 deletions lib/screenshooter-actions.c
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion lib/screenshooter-actions.h
Expand Up @@ -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);
Expand Down
23 changes: 0 additions & 23 deletions lib/screenshooter-dialogs.c
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down
3 changes: 1 addition & 2 deletions lib/screenshooter-global.h
Expand Up @@ -33,8 +33,7 @@ enum {
SAVE = 1,
CLIPBOARD = 2,
OPEN = 4,
UPLOAD_ZIMAGEZ = 8,
UPLOAD_IMGUR = 16,
UPLOAD_IMGUR = 8,
};


Expand Down
41 changes: 13 additions & 28 deletions lib/screenshooter-job-callbacks.c
Expand Up @@ -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",
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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 =
Expand Down
5 changes: 3 additions & 2 deletions lib/screenshooter-job.c
Expand Up @@ -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",
Expand Down

0 comments on commit 5fe8d89

Please sign in to comment.