Commit d6da6d0f authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

added new signal "activate" and emit it if the user activates an item in

2005-10-28  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimppageselector.[ch]: added new signal "activate"
	and emit it if the user activates an item in the icon view.

	* plug-ins/common/poppler.c
	* plug-ins/common/postscript.c: activate the dialog if the page
	selector emits "activate" as suggested in bug #320080.
parent 572f255c
2005-10-28 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimppageselector.[ch]: added new signal "activate"
and emit it if the user activates an item in the icon view.
* plug-ins/common/poppler.c
* plug-ins/common/postscript.c: activate the dialog if the page
selector emits "activate" as suggested in bug #320080.
2005-10-28 Sven Neumann <sven@gimp.org>
* INSTALL
......
......@@ -40,6 +40,7 @@
enum
{
SELECTION_CHANGED,
ACTIVATE,
LAST_SIGNAL
};
......@@ -100,6 +101,9 @@ static void gimp_page_selector_style_set (GtkWidget *widget,
static void gimp_page_selector_selection_changed (GtkIconView *icon_view,
GimpPageSelector *selector);
static void gimp_page_selector_item_activated (GtkIconView *icon_view,
GtkTreePath *path,
GimpPageSelector *selector);
static gboolean gimp_page_selector_range_focus_out (GtkEntry *entry,
GdkEventFocus *fevent,
GimpPageSelector *selector);
......@@ -166,9 +170,11 @@ gimp_page_selector_class_init (GimpPageSelectorClass *klass)
widget_class->style_set = gimp_page_selector_style_set;
klass->selection_changed = NULL;
klass->activate = NULL;
/**
* GimpPageSelector::selection-changed:
* @widget: the object which received the signal.
*
* This signal is emitted whenever the set of selected pages changes.
*
......@@ -183,6 +189,23 @@ gimp_page_selector_class_init (GimpPageSelectorClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* GimpPageSelector::activate:
* @widget: the object which received the signal.
*
* The "activate" signal on GimpPageSelector is an action signal. It
* is emitted when a user double-clicks an item in the page selection.
*/
selector_signals[ACTIVATE] =
g_signal_new ("activate",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GimpPageSelectorClass, activate),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
widget_class->activate_signal = selector_signals[ACTIVATE];
/**
* GimpPageSelector:n-pages:
*
......@@ -260,6 +283,9 @@ gimp_page_selector_init (GimpPageSelector *selector)
g_signal_connect (priv->view, "selection-changed",
G_CALLBACK (gimp_page_selector_selection_changed),
selector);
g_signal_connect (priv->view, "item-activated",
G_CALLBACK (gimp_page_selector_item_activated),
selector);
/* Count label */
......@@ -1086,8 +1112,7 @@ gimp_page_selector_select_range (GimpPageSelector *selector,
gimp_page_selector_selection_changed,
selector);
gimp_page_selector_selection_changed (GTK_ICON_VIEW (priv->view),
selector);
gimp_page_selector_selection_changed (GTK_ICON_VIEW (priv->view), selector);
}
/**
......@@ -1195,6 +1220,14 @@ gimp_page_selector_selection_changed (GtkIconView *icon_view,
g_signal_emit (selector, selector_signals[SELECTION_CHANGED], 0);
}
static void
gimp_page_selector_item_activated (GtkIconView *icon_view,
GtkTreePath *path,
GimpPageSelector *selector)
{
g_signal_emit (selector, selector_signals[ACTIVATE], 0);
}
static gboolean
gimp_page_selector_range_focus_out (GtkEntry *entry,
GdkEventFocus *fevent,
......
......@@ -47,6 +47,7 @@ struct _GimpPageSelectorClass
GtkVBoxClass parent_class;
void (* selection_changed) (GimpPageSelector *selector);
void (* activate) (GimpPageSelector *selector);
/* Padding for future expansion */
void (* _gimp_reserved1) (void);
......
......@@ -35,6 +35,8 @@
#define LOAD_THUMB_PROC "file-pdf-load-thumb"
#define PLUG_IN_BINARY "poppler"
#define THUMBNAIL_SIZE 128
/* Structs for the load dialog */
typedef struct
......@@ -569,8 +571,8 @@ load_image (PopplerDocument *doc,
static GdkPixbuf *
get_thumbnail (PopplerDocument *doc,
int page_num,
int preferred_size)
gint page_num,
gint preferred_size)
{
PopplerPage *page;
GdkPixbuf *pixbuf;
......@@ -659,7 +661,8 @@ thumbnail_thread (gpointer data)
idle_data->page_no = i;
/* FIXME get preferred size from somewhere? */
idle_data->pixbuf = get_thumbnail (thread_data->document, i, 128);
idle_data->pixbuf = get_thumbnail (thread_data->document, i,
THUMBNAIL_SIZE);
g_idle_add (idle_set_thumbnail, idle_data);
......@@ -743,6 +746,10 @@ load_dialog (PopplerDocument *doc,
g_free (label);
}
g_signal_connect_swapped (selector, "activate",
G_CALLBACK (gtk_window_activate_default),
dialog);
gtk_widget_show (selector);
thread_data.document = doc;
......
......@@ -301,9 +301,10 @@ static void compress_packbits (int nin,
unsigned char *dst);
static guint32 ascii85_buf;
static int ascii85_len = 0;
static int ascii85_linewidth = 0;
static guint32 ascii85_buf = 0;
static gint ascii85_len = 0;
static gint ascii85_linewidth = 0;
static GimpPageSelectorTarget ps_pagemode = GIMP_PAGE_SELECTOR_TARGET_LAYERS;
static void
......@@ -3051,7 +3052,12 @@ load_dialog (const gchar *filename,
page_count);
gimp_page_selector_set_target (GIMP_PAGE_SELECTOR (selector),
ps_pagemode);
gtk_widget_show (selector);
g_signal_connect_swapped (selector, "activate",
G_CALLBACK (gtk_window_activate_default),
dialog);
}
hbox = gtk_hbox_new (TRUE, 12);
......@@ -3183,7 +3189,7 @@ load_dialog (const gchar *filename,
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
if (page_count > 1)
if (selector)
{
range = gimp_page_selector_get_selected_range (GIMP_PAGE_SELECTOR (selector));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment