summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnome-extra/gnome-utils/Manifest3
-rw-r--r--gnome-extra/gnome-utils/files/0001-New-feature-uploading-screenshots-to-imgur.com.patch398
-rw-r--r--gnome-extra/gnome-utils/gnome-utils-3.2.1.ebuild76
3 files changed, 477 insertions, 0 deletions
diff --git a/gnome-extra/gnome-utils/Manifest b/gnome-extra/gnome-utils/Manifest
new file mode 100644
index 0000000..da0096c
--- /dev/null
+++ b/gnome-extra/gnome-utils/Manifest
@@ -0,0 +1,3 @@
+AUX 0001-New-feature-uploading-screenshots-to-imgur.com.patch 13173 RMD160 0fbbce42e9d3c95ac57be4fb41e4b866c9321e11 SHA1 9a9a309b08a7ac5e2b6fabcfb62153bf2e43e4e3 SHA256 0b0ac89f3cc8cd5cfde6686b0f51ee6d922ed6d48ad9ea3fd709b3a2e706f01f
+DIST gnome-utils-3.2.1.tar.xz 7273572 RMD160 a0e34b7057c0b77b58f7310ec8a8a3af238071bd SHA1 2f837a420ea73ad1a1cab56656b450e704f2faab SHA256 3ac1942dbf4d9d394e2fcc5f30a4480b1b1e5d44ee0c2d4f61689f4a221ba328
+EBUILD gnome-utils-3.2.1.ebuild 2095 RMD160 20f9254a7db4e63e6e79fe8c5480d51c99d3d11b SHA1 ba6c630ddb8552e976234c371bd7060c5bf3b466 SHA256 7ae9c7a83af42c259f3f81c8415e763dca9d0804caaa06babeb87ed0645be934
diff --git a/gnome-extra/gnome-utils/files/0001-New-feature-uploading-screenshots-to-imgur.com.patch b/gnome-extra/gnome-utils/files/0001-New-feature-uploading-screenshots-to-imgur.com.patch
new file mode 100644
index 0000000..7fb0ec7
--- /dev/null
+++ b/gnome-extra/gnome-utils/files/0001-New-feature-uploading-screenshots-to-imgur.com.patch
@@ -0,0 +1,398 @@
+From 2cc75e214336b858a6e634bb109592dc712f9cd7 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@gentoo.org>
+Date: Sat, 18 Feb 2012 20:03:53 +0530
+Subject: [PATCH] New feature: uploading screenshots to imgur.com
+
+---
+ configure.ac | 9 ++
+ gnome-screenshot/Makefile.am | 6 ++
+ gnome-screenshot/gnome-screenshot.c | 12 +++
+ gnome-screenshot/gnome-screenshot.ui | 18 ++++
+ gnome-screenshot/screenshot-dialog.c | 11 ---
+ gnome-screenshot/screenshot-dialog.h | 12 +++
+ gnome-screenshot/screenshot-share.c | 155 ++++++++++++++++++++++++++++++++++
+ gnome-screenshot/screenshot-share.h | 32 +++++++
+ 8 files changed, 244 insertions(+), 11 deletions(-)
+ create mode 100644 gnome-screenshot/screenshot-share.c
+ create mode 100644 gnome-screenshot/screenshot-share.h
+
+diff --git a/configure.ac b/configure.ac
+index d75bbe2..93b54f0 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -142,6 +142,15 @@ AS_IF([test "x$GCONFTOOL" = "xno"],
+ [AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])]
+ )
+
++# gnome-screenshot checks
++PKG_CHECK_MODULES([LIBSOUP], [libsoup-2.4])
++AC_SUBST(LIBSOUP_CFLAGS)
++AC_SUBST(LIBSOUP_LIBS)
++
++PKG_CHECK_MODULES([JSON_GLIB], [json-glib-1.0 >= 0.14])
++AC_SUBST(JSON_GLIB_CFLAGS)
++AC_SUBST(JSON_GLIB_LIBS)
++
+ # Baobab checks
+ PKG_CHECK_MODULES([LIBGTOP], [libgtop-2.0 >= $LIBGTOP_REQUIRED])
+ AC_SUBST(LIBGTOP_CFLAGS)
+diff --git a/gnome-screenshot/Makefile.am b/gnome-screenshot/Makefile.am
+index d9a11c7..3be0074 100644
+--- a/gnome-screenshot/Makefile.am
++++ b/gnome-screenshot/Makefile.am
+@@ -28,6 +28,8 @@ gnome_screenshot_SOURCES = \
+ screenshot-interactive-dialog.h \
+ screenshot-shadow.c \
+ screenshot-shadow.h \
++ screenshot-share.c \
++ screenshot-share.h \
+ screenshot-utils.c \
+ screenshot-utils.h \
+ $(NULL)
+@@ -36,6 +38,8 @@ gnome_screenshot_CFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(GIO_CFLAGS) \
+ $(LIBCANBERRA_GTK_CFLAGS) \
++ $(LIBSOUP_CFLAGS) \
++ $(JSON_GLIB_CFLAGS) \
+ $(GTHREAD_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(NULL)
+@@ -47,6 +51,8 @@ gnome_screenshot_LDADD = \
+ $(GLIB_LIBS) \
+ $(GIO_LIBS) \
+ $(LIBCANBERRA_GTK_LIBS) \
++ $(LIBSOUP_LIBS) \
++ $(JSON_GLIB_LIBS) \
+ $(GTHREAD_LIBS) \
+ $(GTK_LIBS) \
+ -lm \
+diff --git a/gnome-screenshot/gnome-screenshot.c b/gnome-screenshot/gnome-screenshot.c
+index 3390914..714b2d1 100644
+--- a/gnome-screenshot/gnome-screenshot.c
++++ b/gnome-screenshot/gnome-screenshot.c
+@@ -1,4 +1,5 @@
+ /* gnome-screenshot.c - Take a screenshot of the desktop
++ * vim: set sts=2 sw=2 et :
+ *
+ * Copyright (C) 2001 Jonathan Blandford <jrb@alum.mit.edu>
+ * Copyright (C) 2006 Emmanuele Bassi <ebassi@gnome.org>
+@@ -47,6 +48,7 @@
+ #include "screenshot-filename-builder.h"
+ #include "screenshot-interactive-dialog.h"
+ #include "screenshot-shadow.h"
++#include "screenshot-share.h"
+ #include "screenshot-utils.h"
+ #include "screenshot-dialog.h"
+ #include "cheese-flash.h"
+@@ -260,6 +262,13 @@ screenshot_save_to_clipboard (void)
+ }
+
+ static void
++screenshot_upload (ScreenshotDialog *dialog)
++{
++ /* TODO: Add libsocialweb support and convert 'upload' to 'share' everywhere */
++ screenshot_upload_imgur (dialog);
++}
++
++static void
+ screenshot_dialog_response_cb (GtkDialog *d,
+ gint response_id,
+ ScreenshotDialog *dialog)
+@@ -275,6 +284,9 @@ screenshot_dialog_response_cb (GtkDialog *d,
+ case SCREENSHOT_RESPONSE_COPY:
+ screenshot_save_to_clipboard ();
+ break;
++ case SCREENSHOT_RESPONSE_UPLOAD:
++ screenshot_upload (dialog);
++ break;
+ default:
+ gtk_widget_destroy (GTK_WIDGET (d));
+ gtk_main_quit ();
+diff --git a/gnome-screenshot/gnome-screenshot.ui b/gnome-screenshot/gnome-screenshot.ui
+index 62f1265..6ce9612 100644
+--- a/gnome-screenshot/gnome-screenshot.ui
++++ b/gnome-screenshot/gnome-screenshot.ui
+@@ -42,6 +42,23 @@
+ </packing>
+ </child>
+ <child>
++ <object class="GtkButton" id="upload_button">
++ <property name="visible">True</property>
++ <property name="can_default">True</property>
++ <property name="can_focus">True</property>
++ <property name="use_underline">True</property>
++ <property name="label" translatable="yes">_Upload</property>
++ <property name="relief">GTK_RELIEF_NORMAL</property>
++ <property name="focus_on_click">True</property>
++ </object>
++ <packing>
++ <property name="expand">False</property>
++ <property name="fill">False</property>
++ <property name="position">1</property>
++ <property name="secondary">True</property>
++ </packing>
++ </child>
++ <child>
+ <object class="GtkButton" id="cancel_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+@@ -241,6 +258,7 @@
+ <action-widget response="-6">cancel_button</action-widget>
+ <action-widget response="-5">ok_button</action-widget>
+ <action-widget response="1">copy_button</action-widget>
++ <action-widget response="2">upload_button</action-widget>
+ </action-widgets>
+ </object>
+ </interface>
+diff --git a/gnome-screenshot/screenshot-dialog.c b/gnome-screenshot/screenshot-dialog.c
+index d6d954d..6cb8bba 100644
+--- a/gnome-screenshot/screenshot-dialog.c
++++ b/gnome-screenshot/screenshot-dialog.c
+@@ -36,17 +36,6 @@ static GtkTargetEntry drag_types[] =
+ { "image/png", 0, TYPE_IMAGE_PNG },
+ };
+
+-struct ScreenshotDialog
+-{
+- GtkBuilder *ui;
+- GdkPixbuf *screenshot;
+- GdkPixbuf *preview_image;
+- GtkWidget *save_widget;
+- GtkWidget *filename_entry;
+- gint drag_x;
+- gint drag_y;
+-};
+-
+ static void
+ on_preview_draw (GtkWidget *drawing_area,
+ cairo_t *cr,
+diff --git a/gnome-screenshot/screenshot-dialog.h b/gnome-screenshot/screenshot-dialog.h
+index 7741198..8f2cff7 100644
+--- a/gnome-screenshot/screenshot-dialog.h
++++ b/gnome-screenshot/screenshot-dialog.h
+@@ -22,10 +22,22 @@
+
+ #include <gtk/gtk.h>
+
++struct ScreenshotDialog
++{
++ GtkBuilder *ui;
++ GdkPixbuf *screenshot;
++ GdkPixbuf *preview_image;
++ GtkWidget *save_widget;
++ GtkWidget *filename_entry;
++ gint drag_x;
++ gint drag_y;
++};
++
+ typedef struct ScreenshotDialog ScreenshotDialog;
+
+ /* Keep in sync with the value defined in the UI file */
+ #define SCREENSHOT_RESPONSE_COPY 1
++#define SCREENSHOT_RESPONSE_UPLOAD 2
+
+ ScreenshotDialog *screenshot_dialog_new (GdkPixbuf *screenshot,
+ char *initial_uri);
+diff --git a/gnome-screenshot/screenshot-share.c b/gnome-screenshot/screenshot-share.c
+new file mode 100644
+index 0000000..2442cfa
+--- /dev/null
++++ b/gnome-screenshot/screenshot-share.c
+@@ -0,0 +1,155 @@
++/* screenshot-share.c - online screenshot sharing
++ * vim: set sts=2 sw=2 et :
++ *
++ * Copyright (C) 2012 Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
++ *
++ * 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
++ * 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,
++ */
++
++#include <glib.h>
++#include <gtk/gtk.h>
++#include <libsoup/soup.h>
++#include <json-glib/json-glib.h>
++#include <gdk-pixbuf/gdk-pixbuf.h>
++
++#include "gnome-screenshot.h"
++#include "screenshot-share.h"
++#include "screenshot-dialog.h"
++
++#define IMGUR_API_KEY "b3625162d3418ac51a9ee805b1840452"
++#define IMGUR_UPLOAD_URI "http://api.imgur.com/1/upload.json"
++
++static void imgur_response_cb (SoupSession *session,
++ SoupMessage *msg,
++ gpointer user_data);
++
++static void imgur_wrote_data_cb (SoupMessage *msg,
++ SoupBuffer *chunk,
++ gpointer user_data);
++
++static void screenshot_display_uris (gchar *image_uri,
++ gchar *delete_uri);
++
++
++void
++screenshot_upload_imgur (ScreenshotDialog *dialog)
++{
++ GtkButton *button;
++ SoupSession *session;
++ SoupMessage *msg;
++ gchar *temp;
++ gchar *image_data;
++ gsize image_size;
++ GError *tmp_error;
++
++ tmp_error = NULL;
++ if (!gdk_pixbuf_save_to_buffer (GDK_PIXBUF (dialog->screenshot),
++ &image_data, &image_size,
++ "png", &tmp_error, NULL))
++ goto out;
++
++ button = GTK_BUTTON (gtk_builder_get_object (dialog->ui, "upload_button"));
++
++ temp = g_base64_encode (image_data, image_size);
++ session = soup_session_async_new ();
++ msg = soup_form_request_new (SOUP_METHOD_POST, IMGUR_UPLOAD_URI,
++ "key", IMGUR_API_KEY,
++ "image", temp, NULL);
++ g_signal_connect (msg, "wrote-body-data",
++ G_CALLBACK (imgur_wrote_data_cb),
++ (gpointer)button);
++ soup_session_queue_message (session, msg, imgur_response_cb, NULL);
++ g_free (temp);
++
++out:
++ g_free (image_data);
++}
++
++static void
++imgur_response_cb (SoupSession *session,
++ SoupMessage *msg,
++ gpointer user_data)
++{
++ JsonParser *parser = NULL;
++ JsonNode *node = NULL;
++ GMainLoop *loop;
++ GError *error = NULL;
++ gchar *response;
++ gchar *image_uri;
++ gchar *delete_uri;
++
++ response = g_strdup (msg->response_body->data);
++ if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
++ g_debug ("Got an error from imgur:\n%s\n", response);
++ goto out;
++ }
++
++ parser = json_parser_new ();
++ json_parser_load_from_data (parser, response, -1, &error);
++ if (error)
++ goto out;
++
++ node = json_path_query ("$.rsp.image.imgur_page", json_parser_get_root (parser), &error);
++ if (!node || error)
++ goto out;
++ image_uri = json_node_dup_string (json_array_get_element (json_node_get_array (node), 0));
++ json_node_free (node);
++
++ node = json_path_query ("$.rsp.image.delete_page", json_parser_get_root (parser), &error);
++ if (!node || error)
++ goto out;
++ delete_uri = json_node_dup_string (json_array_get_element (json_node_get_array (node), 0));
++ json_node_free (node);
++
++ screenshot_display_uris (image_uri, delete_uri);
++ g_free (image_uri);
++ g_free (delete_uri);
++
++out:
++ if (error)
++ g_error_free (error);
++ g_free (response);
++ g_object_unref (parser);
++}
++
++static void
++imgur_wrote_data_cb (SoupMessage *msg,
++ SoupBuffer *chunk,
++ gpointer user_data)
++{
++ gchar *upload_percent;
++ static int total_sent;
++ int percent;
++
++ total_sent += (float) chunk->length;
++ percent = (int)nearbyint(100*((float)total_sent) / msg->request_body->length);
++ upload_percent = g_strdup_printf ("Uploading... %i%%", percent);
++
++ gtk_button_set_label (GTK_BUTTON (user_data), upload_percent);
++
++ /* Upload finished? Reset the counter. */
++ if (total_sent == msg->request_body->length)
++ total_sent = 0;
++
++ g_free (upload_percent);
++}
++
++static void
++screenshot_display_uris (gchar *image_uri,
++ gchar *delete_uri)
++{
++ g_app_info_launch_default_for_uri (image_uri, NULL, NULL);
++ g_app_info_launch_default_for_uri (delete_uri, NULL, NULL);
++}
+diff --git a/gnome-screenshot/screenshot-share.h b/gnome-screenshot/screenshot-share.h
+new file mode 100644
+index 0000000..6d39220
+--- /dev/null
++++ b/gnome-screenshot/screenshot-share.h
+@@ -0,0 +1,32 @@
++/* screenshot-share.h - online screenshot sharing
++ * vim: set sts=2 sw=2 et :
++ *
++ * Copyright (C) 2012 Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
++ *
++ * 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
++ * 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,
++ */
++
++#ifndef __SCREENSHOT_SHARE_H__
++#define __SCREENSHOT_SHARE_H__
++
++#include "screenshot-dialog.h"
++
++G_BEGIN_DECLS
++
++void screenshot_upload_imgur (ScreenshotDialog *dialog);
++
++G_END_DECLS
++
++#endif /* __SCREENSHOT_SHARE_H__ */
+--
+1.7.3.4
+
diff --git a/gnome-extra/gnome-utils/gnome-utils-3.2.1.ebuild b/gnome-extra/gnome-utils/gnome-utils-3.2.1.ebuild
new file mode 100644
index 0000000..1f7c7cb
--- /dev/null
+++ b/gnome-extra/gnome-utils/gnome-utils-3.2.1.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/gnome-extra/gnome-utils/gnome-utils-3.2.1.ebuild,v 1.2 2011/12/05 11:29:40 pacho Exp $
+
+EAPI="4"
+GCONF_DEBUG="yes"
+GNOME2_LA_PUNT="yes"
+
+inherit gnome2
+
+DESCRIPTION="Utilities for the Gnome desktop"
+HOMEPAGE="http://www.gnome.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="doc ipv6 test"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux"
+
+# libcanberra 0.26-r2 is needed for gtk+:3 fixes
+COMMON_DEPEND=">=dev-libs/glib-2.29.14:2
+ >=x11-libs/gtk+-3.0.3:3
+ >=gnome-base/gconf-2:2
+ >=gnome-base/gsettings-desktop-schemas-0.1.0
+ >=gnome-base/libgtop-2.12:2
+ >=media-libs/libcanberra-0.26-r2[gtk3]
+ x11-libs/libXext
+ x11-libs/libX11"
+
+DEPEND="${COMMON_DEPEND}
+ x11-proto/xextproto
+ app-text/scrollkeeper
+ >=dev-util/intltool-0.40
+ >=dev-util/pkgconfig-0.9
+ doc? ( >=dev-util/gtk-doc-1.10 )"
+
+# file collisions with g-c-c
+# nautilus is used via dbus
+RDEPEND="${COMMON_DEPEND}
+ >=gnome-base/nautilus-3.0.0
+ !<gnome-base/gnome-control-center-2.90"
+
+pkg_setup() {
+ if ! use debug; then
+ G2CONF="${G2CONF} --enable-debug=minimum"
+ fi
+
+ G2CONF="${G2CONF}
+ $(use_enable ipv6)
+ --enable-zlib
+ --disable-maintainer-flags
+ --disable-static
+ --disable-schemas-install
+ --disable-schemas-compile
+ --disable-scrollkeeper"
+ DOCS="AUTHORS ChangeLog NEWS README THANKS"
+}
+
+src_prepare() {
+ gnome2_src_prepare
+
+ # Remove idiotic -D.*DISABLE_DEPRECATED cflags
+ # This method is kinda prone to breakage. Recheck carefully with next bump.
+ # bug 339074
+ find . -iname 'Makefile.am' -exec \
+ sed -e '/-D[A-Z_]*DISABLE_DEPRECATED/d' -i {} + || die "sed 1 failed"
+ # Do Makefile.in after Makefile.am to avoid automake maintainer-mode
+ find . -iname 'Makefile.in' -exec \
+ sed -e '/-D[A-Z_]*DISABLE_DEPRECATED/d' -i {} + || die "sed 1 failed"
+
+ if ! use test ; then
+ sed -e 's/ tests//' -i logview/Makefile.{am,in} || die "sed 2 failed"
+ fi
+
+ # New feature, upload screenshots to imgur!
+ epatch "${FILESDIR}"/*.patch
+}