[Xfce4-commits] [apps/xfce4-screenshooter] 02/10: Source format
noreply at xfce.org
noreply at xfce.org
Mon Dec 17 00:04:36 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 9e5bce32c68bdb7fcdb87ca61e611fb42d50e387
Author: Andre Miranda <andreldm at xfce.org>
Date: Sun Dec 16 01:02:02 2018 -0300
Source format
---
lib/screenshooter-imgur-dialog.c | 76 ++++++++++++++++++++++++++++++++++++----
lib/screenshooter-imgur-dialog.h | 2 +-
2 files changed, 71 insertions(+), 7 deletions(-)
diff --git a/lib/screenshooter-imgur-dialog.c b/lib/screenshooter-imgur-dialog.c
index 4ea0c6f..c90e316 100644
--- a/lib/screenshooter-imgur-dialog.c
+++ b/lib/screenshooter-imgur-dialog.c
@@ -1,7 +1,33 @@
+/* $Id$
+ *
+ * Copyright © 2018 Arthur Jansen <arthurj155 at gmail.com>
+ * Copyright © 2018 Andre Miranda <andreldm 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.
+ */
+
+
+
#include "screenshooter-imgur-dialog.h"
#include "screenshooter-imgur-dialog_ui.h"
+
+#include <exo/exo.h>
#include <libxfce4ui/libxfce4ui.h>
+
+
struct _ScreenshooterImgurDialog
{
GObject parent;
@@ -16,6 +42,8 @@ struct _ScreenshooterImgurDialog
GtkTextView *embed_text_view;
};
+
+
G_DEFINE_TYPE (ScreenshooterImgurDialog, screenshooter_imgur_dialog, G_TYPE_OBJECT)
void cb_link_toggle_full (GtkToggleButton *button, gpointer user_data);
@@ -36,15 +64,25 @@ 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)
+
+
+static void
+screenshooter_imgur_dialog_class_init (ScreenshooterImgurDialogClass *klass)
{
g_return_if_fail (upload_name != NULL);
+
+
+
+ScreenshooterImgurDialog *
+screenshooter_imgur_dialog_new (const gchar *upload_name,
+ const gchar *delete_hash)
+{
ScreenshooterImgurDialog *self = g_object_new (SCREENSHOOTER_TYPE_IMGUR_DIALOG, NULL);
self->image_url = g_strdup_printf ("https://imgur.com/%s.png", upload_name);
@@ -107,6 +145,7 @@ ScreenshooterImgurDialog *screenshooter_imgur_dialog_new (const gchar *upload_na
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);
@@ -124,7 +163,10 @@ ScreenshooterImgurDialog *screenshooter_imgur_dialog_new (const gchar *upload_na
return self;
}
-void screenshooter_imgur_dialog_run (ScreenshooterImgurDialog *self)
+
+
+void
+screenshooter_imgur_dialog_run (ScreenshooterImgurDialog *self)
{
g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (self));
@@ -132,9 +174,13 @@ void screenshooter_imgur_dialog_run (ScreenshooterImgurDialog *self)
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));
@@ -144,6 +190,8 @@ void cb_link_toggle_full (GtkToggleButton *button, gpointer user_data)
}
void cb_link_toggle_medium (GtkToggleButton *button, gpointer user_data)
+
+
{
g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
@@ -153,6 +201,8 @@ void cb_link_toggle_medium (GtkToggleButton *button, gpointer user_data)
}
void cb_link_toggle_tiny (GtkToggleButton *button, gpointer user_data)
+
+
{
g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
@@ -162,6 +212,8 @@ void cb_link_toggle_tiny (GtkToggleButton *button, gpointer user_data)
}
void cb_link_copy (GtkWidget *widget, gpointer user_data)
+
+
{
g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
@@ -173,14 +225,19 @@ void cb_link_copy (GtkWidget *widget, gpointer user_data)
}
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));
@@ -218,10 +275,13 @@ void cb_generate_embed_text (GtkWidget* widget, gpointer user_data)
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);
+
+ g_free (text);
}
void cb_embed_text_copy (GtkWidget* widget, gpointer user_data)
+
+
{
g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
@@ -239,6 +299,8 @@ void cb_embed_text_copy (GtkWidget* widget, gpointer user_data)
}
void cb_delete_link_copy (GtkWidget *widget, gpointer user_data)
+
+
{
g_return_if_fail (SCREENSHOOTER_IS_IMGUR_DIALOG (user_data));
@@ -248,9 +310,11 @@ void cb_delete_link_copy (GtkWidget *widget, gpointer user_data)
}
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
index 6dce910..1055501 100644
--- a/lib/screenshooter-imgur-dialog.h
+++ b/lib/screenshooter-imgur-dialog.h
@@ -19,4 +19,4 @@ void screenshooter_imgur_dialog_run ();
G_END_DECLS
-#endif
\ No newline at end of file
+#endif
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list