/dev/twasilczyk/screenshot: 3e4a306e3005: screencap: hint box
Tomasz Wasilczyk
twasilczyk at pidgin.im
Tue Apr 29 06:58:26 EDT 2014
Changeset: 3e4a306e3005af6d3cf236b9d344a8bfaccd0bf6
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-04-29 12:58 +0200
Branch: default
URL: https://hg.pidgin.im/dev/twasilczyk/screenshot/rev/3e4a306e3005
Description:
screencap: hint box
diffstat:
pidgin/plugins/screencap.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diffs (55 lines):
diff --git a/pidgin/plugins/screencap.c b/pidgin/plugins/screencap.c
--- a/pidgin/plugins/screencap.c
+++ b/pidgin/plugins/screencap.c
@@ -27,6 +27,7 @@
#include "debug.h"
#include "version.h"
+#include "gtk3compat.h"
#include "gtkconv.h"
#include "gtkplugin.h"
#include "gtkwebviewtoolbar.h"
@@ -152,7 +153,12 @@ scrncap_do_screenshot_cb(gpointer _webvi
PidginWebView *webview = PIDGIN_WEBVIEW(_webview);
GdkPixbuf *screenshot, *screenshot_d;
int width, height;
+ GtkFixed *cont;
GtkWidget *image;
+ GtkWidget *hint;
+ gchar *hint_msg;
+ GtkRequisition hint_size;
+ GtkWidget *hint_box;
shooting_timeout = 0;
@@ -179,11 +185,29 @@ scrncap_do_screenshot_cb(gpointer _webvi
G_CALLBACK(scrncap_crop_window_focusout), NULL);
g_object_set_data(G_OBJECT(crop_window), "screenshot", screenshot);
+ cont = GTK_FIXED(gtk_fixed_new());
+ gtk_container_add(GTK_CONTAINER(crop_window), GTK_WIDGET(cont));
+
screenshot_d = gdk_pixbuf_copy(screenshot);
scrncap_pixbuf_darken(screenshot_d);
image = gtk_image_new_from_pixbuf(screenshot_d);
g_object_unref(screenshot_d);
- gtk_container_add(GTK_CONTAINER(crop_window), image);
+ gtk_fixed_put(cont, image, 0, 0);
+
+ hint = gtk_label_new(NULL);
+ hint_msg = g_strdup_printf("<span size='x-large'>%s</span>",
+ _("Select the region to send and press Enter button to confirm "
+ "or press Escape button to cancel"));
+ gtk_label_set_markup(GTK_LABEL(hint), hint_msg);
+ g_free(hint_msg);
+ gtk_misc_set_padding(GTK_MISC(hint), 10, 7);
+ hint_box = gtk_event_box_new();
+ gtk_container_add(GTK_CONTAINER(hint_box), hint);
+ gtk_widget_get_preferred_size(hint, NULL, &hint_size);
+ gtk_fixed_put(cont, hint_box,
+ width / 2 - hint_size.width / 2 - 10,
+ height / 2 - hint_size.height / 2 - 7);
+ g_object_set_data(G_OBJECT(crop_window), "hint-box", hint_box);
gtk_widget_show_all(GTK_WIDGET(crop_window));
More information about the Commits
mailing list