Commit eaae0a6b authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Add a new keybinding signal, move_viewport. (gtk_text_view_move_viewport):

2003-07-18  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtktextview.c (gtk_text_view_class_init): Add a new keybinding signal, move_viewport.
	(gtk_text_view_move_viewport): New function which implements the move_viewport functionality.
	(gtk_text_view_move_cursor_internal): If the cursor is not visible, move the viewport. (#78669)

	* gtk/gtkenums.h (GtkScrollStep): New enumeration, used for move_viewport argument.

	* gtk/gtkstatusbar.c (gtk_statusbar_class_init): Add a has_resize_grip property.  (#111779)

	* gtk/gtkwindow.h:
	* gtk/gtkwindow.c (gtk_window_set_default_icon): New method.  (#95816)

	* gtk/gtkmessagedialog.h:
	* gtk/gtkmessagedialog.c (gtk_message_dialog_add_buttons): New method.
	(#65501, Sebastian Rittau)
parent 1a7bac8d
2003-07-18 Matthias Clasen <maclas@gmx.de>
* gtk/gtktextview.c (gtk_text_view_class_init): Add a new keybinding signal, move_viewport.
(gtk_text_view_move_viewport): New function which implements the move_viewport functionality.
(gtk_text_view_move_cursor_internal): If the cursor is not visible, move the viewport. (#78669)
* gtk/gtkenums.h (GtkScrollStep): New enumeration, used for move_viewport argument.
* gtk/gtkstatusbar.c (gtk_statusbar_class_init): Add a has_resize_grip property. (#111779)
* gtk/gtkwindow.h:
* gtk/gtkwindow.c (gtk_window_set_default_icon): New method. (#95816)
* gtk/gtkmessagedialog.h:
* gtk/gtkmessagedialog.c (gtk_message_dialog_add_buttons): New method.
(#65501, Sebastian Rittau)
Fri Jul 18 20:06:57 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktextview.c (changed_handler): use
......
2003-07-18 Matthias Clasen <maclas@gmx.de>
* gtk/gtktextview.c (gtk_text_view_class_init): Add a new keybinding signal, move_viewport.
(gtk_text_view_move_viewport): New function which implements the move_viewport functionality.
(gtk_text_view_move_cursor_internal): If the cursor is not visible, move the viewport. (#78669)
* gtk/gtkenums.h (GtkScrollStep): New enumeration, used for move_viewport argument.
* gtk/gtkstatusbar.c (gtk_statusbar_class_init): Add a has_resize_grip property. (#111779)
* gtk/gtkwindow.h:
* gtk/gtkwindow.c (gtk_window_set_default_icon): New method. (#95816)
* gtk/gtkmessagedialog.h:
* gtk/gtkmessagedialog.c (gtk_message_dialog_add_buttons): New method.
(#65501, Sebastian Rittau)
Fri Jul 18 20:06:57 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktextview.c (changed_handler): use
......
2003-07-18 Matthias Clasen <maclas@gmx.de>
* gtk/gtktextview.c (gtk_text_view_class_init): Add a new keybinding signal, move_viewport.
(gtk_text_view_move_viewport): New function which implements the move_viewport functionality.
(gtk_text_view_move_cursor_internal): If the cursor is not visible, move the viewport. (#78669)
* gtk/gtkenums.h (GtkScrollStep): New enumeration, used for move_viewport argument.
* gtk/gtkstatusbar.c (gtk_statusbar_class_init): Add a has_resize_grip property. (#111779)
* gtk/gtkwindow.h:
* gtk/gtkwindow.c (gtk_window_set_default_icon): New method. (#95816)
* gtk/gtkmessagedialog.h:
* gtk/gtkmessagedialog.c (gtk_message_dialog_add_buttons): New method.
(#65501, Sebastian Rittau)
Fri Jul 18 20:06:57 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktextview.c (changed_handler): use
......
2003-07-18 Matthias Clasen <maclas@gmx.de>
* gtk/gtktextview.c (gtk_text_view_class_init): Add a new keybinding signal, move_viewport.
(gtk_text_view_move_viewport): New function which implements the move_viewport functionality.
(gtk_text_view_move_cursor_internal): If the cursor is not visible, move the viewport. (#78669)
* gtk/gtkenums.h (GtkScrollStep): New enumeration, used for move_viewport argument.
* gtk/gtkstatusbar.c (gtk_statusbar_class_init): Add a has_resize_grip property. (#111779)
* gtk/gtkwindow.h:
* gtk/gtkwindow.c (gtk_window_set_default_icon): New method. (#95816)
* gtk/gtkmessagedialog.h:
* gtk/gtkmessagedialog.c (gtk_message_dialog_add_buttons): New method.
(#65501, Sebastian Rittau)
Fri Jul 18 20:06:57 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktextview.c (changed_handler): use
......
2003-07-18 Matthias Clasen <maclas@gmx.de>
* gtk/gtktextview.c (gtk_text_view_class_init): Add a new keybinding signal, move_viewport.
(gtk_text_view_move_viewport): New function which implements the move_viewport functionality.
(gtk_text_view_move_cursor_internal): If the cursor is not visible, move the viewport. (#78669)
* gtk/gtkenums.h (GtkScrollStep): New enumeration, used for move_viewport argument.
* gtk/gtkstatusbar.c (gtk_statusbar_class_init): Add a has_resize_grip property. (#111779)
* gtk/gtkwindow.h:
* gtk/gtkwindow.c (gtk_window_set_default_icon): New method. (#95816)
* gtk/gtkmessagedialog.h:
* gtk/gtkmessagedialog.c (gtk_message_dialog_add_buttons): New method.
(#65501, Sebastian Rittau)
Fri Jul 18 20:06:57 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktextview.c (changed_handler): use
......
2003-07-18 Matthias Clasen <maclas@gmx.de>
* gtk/gtk-sections.txt: Add gtk_message_dialog_new_with_markup() and gtk_window_set_default_icon().
2003-07-15 Matthias Clasen <maclas@gmx.de>
* gtk/tmpl/gtkseparatortoolitem.sgml:
......
......@@ -1689,6 +1689,7 @@ GtkMessageDialog
GtkMessageType
GtkButtonsType
gtk_message_dialog_new
gtk_message_dialog_new_with_markup
<SUBSECTION Standard>
GTK_MESSAGE_DIALOG
GTK_IS_MESSAGE_DIALOG
......@@ -3984,6 +3985,7 @@ gtk_window_parse_geometry
gtk_window_reshow_with_initial_size
gtk_window_resize
gtk_window_set_default_icon_list
gtk_window_set_default_icon
gtk_window_set_default_icon_from_file
gtk_window_set_icon
gtk_window_set_icon_list
......
......@@ -193,7 +193,8 @@ typedef enum
GTK_CENTIMETERS
} GtkMetricType;
typedef enum {
typedef enum
{
GTK_MOVEMENT_LOGICAL_POSITIONS, /* move by forw/back graphemes */
GTK_MOVEMENT_VISUAL_POSITIONS, /* move by left/right graphemes */
GTK_MOVEMENT_WORDS, /* move by forward/back words */
......@@ -206,6 +207,16 @@ typedef enum {
GTK_MOVEMENT_HORIZONTAL_PAGES /* move horizontally by pages */
} GtkMovementStep;
typedef enum
{
GTK_SCROLL_STEPS,
GTK_SCROLL_PAGES,
GTK_SCROLL_ENDS,
GTK_SCROLL_HORIZONTAL_STEPS,
GTK_SCROLL_HORIZONTAL_PAGES,
GTK_SCROLL_HORIZONTAL_ENDS
} GtkScrollStep;
/* Orientation for toolbars, etc. */
typedef enum
{
......
......@@ -18,7 +18,7 @@
*/
/*
* Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
* Modified by the GTK+ Team and others 1997-2003. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
......@@ -302,7 +302,10 @@ gtk_message_dialog_new (GtkWindow *parent,
GtkDialog *dialog;
gchar* msg = 0;
va_list args;
g_return_val_if_fail (parent == NULL || GTK_IS_WINDOW (parent), NULL);
g_return_val_if_fail (message_format != NULL, NULL);
widget = g_object_new (GTK_TYPE_MESSAGE_DIALOG,
"message_type", type,
"buttons", buttons,
......@@ -344,6 +347,79 @@ gtk_message_dialog_new (GtkWindow *parent,
return widget;
}
/**
* gtk_message_dialog_new_with_markup:
* @parent: transient parent, or %NULL for none
* @flags: flags
* @type: type of message
* @buttons: set of buttons to use
* @message_format: printf()-style format string, or %NULL
* @Varargs: arguments for @message_format
*
* Creates a new message dialog, which is a simple dialog with an icon
* indicating the dialog type (error, warning, etc.) and some text which
* is marked up with the <link linkend="PangoMarkupFormat">Pango text markup language</link>.
* When the user clicks a button a "response" signal is emitted with
* response IDs from #GtkResponseType. See #GtkDialog for more details.
*
* Please note that if you have strings in the printf() arguments
* passed to this function, you might need to protect against
* them being interpreted as markup. You can do this using
* g_markup_escape_text() as in the following example:
* <informalexample><programlisting>
* const gchar *error_text =
* "&lt;span weight=\"bold\" size=\"larger\"&gt;"
* "Could not open document '%s'."
* "&lt;/span&gt;\n\n"
* "You do not have appropriate permission to access this file.";
* gchar *tmp;
* GtkWidget *dialog;
*
* tmp = g_markup_escape_text (filename, -1);
* dialog = gtk_message_dialog_new_with_markup (main_application_window,
* GTK_DIALOG_DESTROY_WITH_PARENT,
* GTK_MESSAGE_ERROR,
* GTK_BUTTONS_CLOSE,
* error_text, tmp);
* g_free (tmp);
* </programlisting></informalexample>
*
* Return value: a new #GtkMessageDialog
*
* Since: 2.4
**/
GtkWidget*
gtk_message_dialog_new_with_markup (GtkWindow *parent,
GtkDialogFlags flags,
GtkMessageType type,
GtkButtonsType buttons,
const gchar *message_format,
...)
{
GtkWidget *widget;
gchar* msg = 0;
va_list args;
g_return_val_if_fail (parent == NULL || GTK_IS_WINDOW (parent), NULL);
g_return_val_if_fail (message_format != NULL, NULL);
widget = gtk_message_dialog_new (parent, flags, type, buttons, "");
if (message_format)
{
va_start (args, message_format);
msg = g_strdup_vprintf(message_format, args);
va_end (args);
gtk_label_set_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (widget)->label),
msg);
g_free (msg);
}
return widget;
}
static void
gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog,
GtkButtonsType buttons)
......
......@@ -18,7 +18,7 @@
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* Modified by the GTK+ Team and others 1997-2003. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
......@@ -91,6 +91,13 @@ GtkWidget* gtk_message_dialog_new (GtkWindow *parent,
GtkButtonsType buttons,
const gchar *message_format,
...) G_GNUC_PRINTF (5, 6);
GtkWidget* gtk_message_dialog_new_with_markup (GtkWindow *parent,
GtkDialogFlags flags,
GtkMessageType type,
GtkButtonsType buttons,
const gchar *message_format,
...) G_GNUC_PRINTF (5, 6);
......
......@@ -48,6 +48,12 @@ enum
SIGNAL_LAST
};
enum
{
PROP_ZERO,
PROP_HAS_RESIZE_GRIP
};
static void gtk_statusbar_class_init (GtkStatusbarClass *class);
static void gtk_statusbar_init (GtkStatusbar *statusbar);
static void gtk_statusbar_destroy (GtkObject *object);
......@@ -70,6 +76,14 @@ static void gtk_statusbar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_statusbar_create_window (GtkStatusbar *statusbar);
static void gtk_statusbar_destroy_window (GtkStatusbar *statusbar);
static void gtk_statusbar_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_statusbar_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static GtkContainerClass *parent_class;
static guint statusbar_signals[SIGNAL_LAST] = { 0 };
......@@ -104,16 +118,21 @@ gtk_statusbar_get_type (void)
static void
gtk_statusbar_class_init (GtkStatusbarClass *class)
{
GObjectClass *gobject_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
gobject_class = (GObjectClass *) class;
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
container_class = (GtkContainerClass *) class;
parent_class = g_type_class_peek_parent (class);
gobject_class->set_property = gtk_statusbar_set_property;
gobject_class->get_property = gtk_statusbar_get_property;
object_class->destroy = gtk_statusbar_destroy;
widget_class->realize = gtk_statusbar_realize;
......@@ -135,6 +154,20 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
class->text_pushed = gtk_statusbar_update;
class->text_popped = gtk_statusbar_update;
/**
* GtkStatusbar:has-resize-grip:
*
* Whether the statusbar has a grip for resizing the toplevel window.
*
* Since: 2.4
*/
g_object_class_install_property (gobject_class,
PROP_HAS_RESIZE_GRIP,
g_param_spec_boolean ("has_resize_grip",
_("Has Resize Grip"),
_("Whether the statusbar has a grip for resizing the toplevel"),
TRUE,
G_PARAM_READWRITE));
statusbar_signals[SIGNAL_TEXT_PUSHED] =
g_signal_new ("text_pushed",
G_OBJECT_CLASS_TYPE (class),
......@@ -379,6 +412,8 @@ gtk_statusbar_set_has_resize_grip (GtkStatusbar *statusbar,
else if (!statusbar->has_resize_grip && statusbar->grip_window != NULL)
gtk_statusbar_destroy_window (statusbar);
}
g_object_notify (G_OBJECT (statusbar), "has_resize_grip");
}
}
......@@ -421,6 +456,44 @@ gtk_statusbar_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gtk_statusbar_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkStatusbar *statusbar = GTK_STATUSBAR (object);
switch (prop_id)
{
case PROP_HAS_RESIZE_GRIP:
gtk_statusbar_set_has_resize_grip (statusbar, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_statusbar_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkStatusbar *statusbar = GTK_STATUSBAR (object);
switch (prop_id)
{
case PROP_HAS_RESIZE_GRIP:
g_value_set_boolean (value, statusbar->has_resize_grip);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static GdkWindowEdge
get_grip_edge (GtkStatusbar *statusbar)
{
......
......@@ -117,6 +117,7 @@ enum
PASTE_CLIPBOARD,
TOGGLE_OVERWRITE,
MOVE_FOCUS,
MOVE_VIEWPORT,
SELECT_ALL,
LAST_SIGNAL
};
......@@ -239,6 +240,9 @@ static void gtk_text_view_move_cursor (GtkTextView *text_view,
static void gtk_text_view_page_horizontally (GtkTextView *text_view,
gint count,
gboolean extend_selection);
static void gtk_text_view_move_viewport (GtkTextView *text_view,
GtkScrollStep step,
gint count);
static void gtk_text_view_set_anchor (GtkTextView *text_view);
static void gtk_text_view_scroll_pages (GtkTextView *text_view,
gint count,
......@@ -688,6 +692,17 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
G_TYPE_INT,
G_TYPE_BOOLEAN);
signals[MOVE_VIEWPORT] =
_gtk_binding_signal_new ("move_viewport",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_CALLBACK (gtk_text_view_move_viewport),
NULL, NULL,
_gtk_marshal_VOID__ENUM_INT,
G_TYPE_NONE, 2,
GTK_TYPE_SCROLL_STEP,
G_TYPE_INT);
signals[SET_ANCHOR] =
g_signal_new ("set_anchor",
G_OBJECT_CLASS_TYPE (gobject_class),
......@@ -4497,6 +4512,44 @@ gtk_text_view_move_cursor_internal (GtkTextView *text_view,
gint cursor_x_pos = 0;
if (!text_view->cursor_visible)
{
GtkScrollStep scroll_step;
switch (step)
{
case GTK_MOVEMENT_LOGICAL_POSITIONS:
case GTK_MOVEMENT_VISUAL_POSITIONS:
case GTK_MOVEMENT_WORDS:
scroll_step = GTK_SCROLL_HORIZONTAL_STEPS;
break;
case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
scroll_step = GTK_SCROLL_HORIZONTAL_ENDS;
break;
case GTK_MOVEMENT_DISPLAY_LINES:
case GTK_MOVEMENT_PARAGRAPHS:
case GTK_MOVEMENT_PARAGRAPH_ENDS:
scroll_step = GTK_SCROLL_STEPS;
break;
case GTK_MOVEMENT_PAGES:
scroll_step = GTK_SCROLL_PAGES;
break;
case GTK_MOVEMENT_HORIZONTAL_PAGES:
scroll_step = GTK_SCROLL_HORIZONTAL_PAGES;
break;
case GTK_MOVEMENT_BUFFER_ENDS:
scroll_step = GTK_SCROLL_ENDS;
break;
default:
scroll_step = GTK_SCROLL_PAGES;
break;
}
gtk_text_view_move_viewport (text_view, scroll_step, count);
return;
}
gtk_text_view_reset_im_context (text_view);
if (step == GTK_MOVEMENT_PAGES)
......@@ -4638,6 +4691,54 @@ gtk_text_view_page_horizontally (GtkTextView *text_view,
count, extend_selection);
}
static void
gtk_text_view_move_viewport (GtkTextView *text_view,
GtkScrollStep step,
gint count)
{
GtkAdjustment *adjustment;
gdouble increment;
switch (step)
{
case GTK_SCROLL_STEPS:
case GTK_SCROLL_PAGES:
case GTK_SCROLL_ENDS:
adjustment = get_vadjustment (text_view);
break;
case GTK_SCROLL_HORIZONTAL_STEPS:
case GTK_SCROLL_HORIZONTAL_PAGES:
case GTK_SCROLL_HORIZONTAL_ENDS:
adjustment = get_hadjustment (text_view);
break;
default:
adjustment = get_vadjustment (text_view);
break;
}
switch (step)
{
case GTK_SCROLL_STEPS:
case GTK_SCROLL_HORIZONTAL_STEPS:
increment = adjustment->step_increment;
break;
case GTK_SCROLL_PAGES:
case GTK_SCROLL_HORIZONTAL_PAGES:
increment = adjustment->page_increment;
break;
case GTK_SCROLL_ENDS:
case GTK_SCROLL_HORIZONTAL_ENDS:
increment = adjustment->upper - adjustment->lower;
break;
default:
increment = 0.0;
break;
}
set_adjustment_clamped (adjustment, adjustment->value + count * increment);
}
static void
gtk_text_view_set_anchor (GtkTextView *text_view)
{
......
......@@ -2783,6 +2783,25 @@ gtk_window_set_default_icon_list (GList *list)
g_list_free (toplevels);
}
/**
* gtk_window_set_default_icon:
* @pixbuf: the icon
*
* Sets an icon to be used as fallback for windows that haven't
* had gtk_window_set_icon() called on them from a pixbuf.
*
* Since: 2.4
**/
void
gtk_window_set_default_icon (GdkPixbuf *pixbuf)
{
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
GList *list = g_list_prepend (NULL, pixbuf);
gtk_window_set_default_icon_list (list);
g_list_free (list);
}
/**
* gtk_window_set_default_icon_from_file:
* @filename: location of icon file
......@@ -2804,10 +2823,7 @@ gtk_window_set_default_icon_from_file (const gchar *filename,
if (pixbuf)
{
GList *list = g_list_prepend (NULL, pixbuf);
gtk_window_set_default_icon_list (list);
g_list_free (list);
gtk_window_set_default_icon (pixbuf);
g_object_unref (pixbuf);
return TRUE;
......@@ -3791,7 +3807,10 @@ gtk_window_realize (GtkWidget *widget)
gdk_window_set_type_hint (widget->window, window->type_hint);
if (gtk_window_get_skip_pager_hint (window))
{
g_print ("setting skip pager when realizing\n");
gdk_window_set_skip_pager_hint (widget->window, TRUE);
}
if (gtk_window_get_skip_taskbar_hint (window))
gdk_window_set_skip_taskbar_hint (widget->window, TRUE);
......
......@@ -252,6 +252,7 @@ gboolean gtk_window_set_icon_from_file (GtkWindow *window,
GdkPixbuf* gtk_window_get_icon (GtkWindow *window);
void gtk_window_set_default_icon_list (GList *list);
GList* gtk_window_get_default_icon_list (void);
void gtk_window_set_default_icon (GdkPixbuf *icon);
gboolean gtk_window_set_default_icon_from_file (const gchar *filename,
GError **err);
......
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