Compare commits
103 Commits
path-ops
...
builder-pr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cc3c019e6 | ||
|
|
319aa558a5 | ||
|
|
208769f70f | ||
|
|
c5bffb9fb5 | ||
|
|
c7afa5452b | ||
|
|
c7c6e83779 | ||
|
|
fcb6adaaaa | ||
|
|
9c12b58e32 | ||
|
|
6c8b505f93 | ||
|
|
8b228e7471 | ||
|
|
4ce07f41ca | ||
|
|
1bfd0e5e38 | ||
|
|
b962d37f79 | ||
|
|
c6ecf02a07 | ||
|
|
8b7d4b423c | ||
|
|
83dc126565 | ||
|
|
f2d3d7e710 | ||
|
|
f991428cb9 | ||
|
|
c9cf7b1e08 | ||
|
|
4d865cd7ba | ||
|
|
a55458a84a | ||
|
|
66d8631c23 | ||
|
|
5c1ad88137 | ||
|
|
e230c9c6f0 | ||
|
|
6d24a2c942 | ||
|
|
5222dc0cd1 | ||
|
|
51a72a9c53 | ||
|
|
f609d9cd59 | ||
|
|
3901c6ab91 | ||
|
|
da6f86bd79 | ||
|
|
42fd499af4 | ||
|
|
de5b88477a | ||
|
|
cd49a7f9e9 | ||
|
|
df025fcb88 | ||
|
|
bbb1404bd3 | ||
|
|
af2a172197 | ||
|
|
252b9fc39c | ||
|
|
6fc5e04d7c | ||
|
|
66f1fef083 | ||
|
|
645d4807c3 | ||
|
|
e2c360ada0 | ||
|
|
a463ead739 | ||
|
|
dbe5e57b8e | ||
|
|
99b99d7b23 | ||
|
|
787111a145 | ||
|
|
9a872f059f | ||
|
|
eadc94e0a1 | ||
|
|
f8855e892a | ||
|
|
27d05014e3 | ||
|
|
ebb58b7cbc | ||
|
|
7f6895a4bb | ||
|
|
80ae4c1a69 | ||
|
|
e72df9cd5f | ||
|
|
80ba529fb9 | ||
|
|
fd6b3ef5a0 | ||
|
|
4cd0a39794 | ||
|
|
5fbc510f94 | ||
|
|
600ab5ba5f | ||
|
|
ae92181d02 | ||
|
|
66910ed998 | ||
|
|
5371e4403e | ||
|
|
79375dd7dd | ||
|
|
6889609ab9 | ||
|
|
0bf87281e0 | ||
|
|
bc7bed7517 | ||
|
|
cfac6fd752 | ||
|
|
97c09c827b | ||
|
|
0370672886 | ||
|
|
2d062fedd9 | ||
|
|
c6a68f3de2 | ||
|
|
d6181b2335 | ||
|
|
d74e62886c | ||
|
|
d8505f09eb | ||
|
|
935c6aade0 | ||
|
|
a35c35f849 | ||
|
|
57518a2bb4 | ||
|
|
99a8202015 | ||
|
|
17c903e246 | ||
|
|
4de5d225db | ||
|
|
7741df9963 | ||
|
|
7ef54e9c53 | ||
|
|
12bb700c62 | ||
|
|
e3ba7250f1 | ||
|
|
54842095c3 | ||
|
|
d1aec0c3f1 | ||
|
|
00d5f72d6e | ||
|
|
15d01d4315 | ||
|
|
348e34f221 | ||
|
|
ce7b0656c0 | ||
|
|
fd0d360f9b | ||
|
|
f26cae3838 | ||
|
|
b8468af411 | ||
|
|
9fd7e319f3 | ||
|
|
80a8b59f24 | ||
|
|
b9d4da9cfe | ||
|
|
5bf5b58eb3 | ||
|
|
b2c227e9c5 | ||
|
|
d854228d58 | ||
|
|
a0c09bc2a9 | ||
|
|
aca3b2da58 | ||
|
|
604541863c | ||
|
|
fd9e0dd13a | ||
|
|
42249ce28e |
@@ -167,7 +167,7 @@ macos:
|
||||
needs: []
|
||||
before_script:
|
||||
- bash .gitlab-ci/show-info-osx.sh
|
||||
- pip3 install --user meson==0.56
|
||||
- pip3 install --user meson==0.59
|
||||
- pip3 install --user ninja
|
||||
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
|
||||
- export MESON_FORCE_BACKTRACE=1
|
||||
|
||||
@@ -5,7 +5,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
|
||||
@echo on
|
||||
|
||||
:: FIXME: make warnings fatal
|
||||
pip3 install --upgrade --user meson==0.56.2 || goto :error
|
||||
pip3 install --upgrade --user meson==0.59 || goto :error
|
||||
meson -Dmedia-gstreamer=disabled _build || goto :error
|
||||
ninja -C _build || goto :error
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
/* Clipboard
|
||||
*
|
||||
* GdkClipboard is used for clipboard handling. This demo shows how to
|
||||
* copy and paste text to and from the clipboard.
|
||||
* copy and paste text, images, colors or files to and from the clipboard.
|
||||
*
|
||||
* It also shows how to transfer images via the clipboard or via
|
||||
* drag-and-drop, and how to make clipboard contents persist after
|
||||
* the application exits. Clipboard persistence requires a clipboard
|
||||
* manager to run.
|
||||
* You can also use Drag-And-Drop to copy the data from the source to the
|
||||
* target.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
@@ -14,22 +12,103 @@
|
||||
#include <string.h>
|
||||
#include "demoimage.h"
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static void
|
||||
copy_button_clicked (GtkStack *source_stack,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkClipboard *clipboard;
|
||||
const char *visible_child_name;
|
||||
GtkWidget *visible_child;
|
||||
|
||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (source_stack));
|
||||
|
||||
visible_child = gtk_stack_get_visible_child (source_stack);
|
||||
visible_child_name = gtk_stack_get_visible_child_name (source_stack);
|
||||
|
||||
if (strcmp (visible_child_name, "Text") == 0)
|
||||
{
|
||||
gdk_clipboard_set_text (clipboard, gtk_editable_get_text (GTK_EDITABLE (visible_child)));
|
||||
}
|
||||
else if (strcmp (visible_child_name, "Image") == 0)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
for (child = gtk_widget_get_first_child (visible_child); child; child = gtk_widget_get_next_sibling (child))
|
||||
{
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (child)))
|
||||
{
|
||||
GtkWidget *image = gtk_widget_get_first_child (child);
|
||||
GdkPaintable *paintable = gtk_image_get_paintable (GTK_IMAGE (image));
|
||||
|
||||
if (GDK_IS_TEXTURE (paintable))
|
||||
gdk_clipboard_set (clipboard, GDK_TYPE_TEXTURE, paintable);
|
||||
else
|
||||
gdk_clipboard_set (clipboard, GDK_TYPE_PAINTABLE, paintable);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp (visible_child_name, "Color") == 0)
|
||||
{
|
||||
GdkRGBA color;
|
||||
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (visible_child), &color);
|
||||
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, &color);
|
||||
}
|
||||
else if (strcmp (visible_child_name, "File") == 0)
|
||||
{
|
||||
gdk_clipboard_set (clipboard, G_TYPE_FILE, g_object_get_data (G_OBJECT (visible_child), "file"), NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_print ("TODO");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
copy_button_clicked (GtkWidget *button,
|
||||
gpointer user_data)
|
||||
present_value (GtkStack *dest_stack,
|
||||
const GValue *value)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
GdkClipboard *clipboard;
|
||||
GtkWidget *child;
|
||||
|
||||
entry = GTK_WIDGET (user_data);
|
||||
if (G_VALUE_HOLDS (value, G_TYPE_FILE))
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
/* Get the clipboard object */
|
||||
clipboard = gtk_widget_get_clipboard (entry);
|
||||
gtk_stack_set_visible_child_name (dest_stack, "File");
|
||||
child = gtk_stack_get_visible_child (dest_stack);
|
||||
|
||||
/* Set clipboard text */
|
||||
gdk_clipboard_set_text (clipboard, gtk_editable_get_text (GTK_EDITABLE (entry)));
|
||||
file = g_value_get_object (value);
|
||||
g_object_set (child, "label", g_file_peek_path (file), NULL);
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_RGBA))
|
||||
{
|
||||
GdkRGBA *color;
|
||||
|
||||
gtk_stack_set_visible_child_name (dest_stack, "Color");
|
||||
child = gtk_widget_get_first_child (gtk_stack_get_visible_child (dest_stack));
|
||||
|
||||
color = g_value_get_boxed (value);
|
||||
g_object_set (child, "rgba", color, NULL);
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE) ||
|
||||
G_VALUE_HOLDS (value, GDK_TYPE_PAINTABLE))
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
|
||||
gtk_stack_set_visible_child_name (dest_stack, "Image");
|
||||
child = gtk_stack_get_visible_child (dest_stack);
|
||||
|
||||
paintable = g_value_get_object (value);
|
||||
g_object_set (child, "paintable", paintable, NULL);
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, G_TYPE_STRING))
|
||||
{
|
||||
gtk_stack_set_visible_child_name (dest_stack, "Text");
|
||||
child = gtk_stack_get_visible_child (dest_stack);
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (child), g_value_get_string (value));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -37,149 +116,259 @@ paste_received (GObject *source_object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkStack *dest_stack = user_data;
|
||||
GdkClipboard *clipboard;
|
||||
GtkWidget *entry;
|
||||
char *text;
|
||||
const GValue *value;
|
||||
GError *error = NULL;
|
||||
|
||||
clipboard = GDK_CLIPBOARD (source_object);
|
||||
entry = GTK_WIDGET (user_data);
|
||||
|
||||
/* Get the resulting text of the read operation */
|
||||
text = gdk_clipboard_read_text_finish (clipboard, result, &error);
|
||||
|
||||
if (text)
|
||||
value = gdk_clipboard_read_value_finish (clipboard, result, &error);
|
||||
if (value)
|
||||
{
|
||||
/* Set the entry text */
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), text);
|
||||
g_free (text);
|
||||
present_value (dest_stack, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
/* Show an error about why pasting failed.
|
||||
* Usually you probably want to ignore such failures,
|
||||
* but for demonstration purposes, we show the error.
|
||||
*/
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Could not paste text: %s",
|
||||
error->message);
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), NULL);
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
g_print ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
paste_button_clicked (GtkWidget *button,
|
||||
gpointer user_data)
|
||||
paste_button_clicked (GtkStack *dest_stack,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
GdkClipboard *clipboard;
|
||||
GdkContentFormats *formats;
|
||||
|
||||
entry = GTK_WIDGET (user_data);
|
||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (dest_stack));
|
||||
formats = gdk_clipboard_get_formats (clipboard);
|
||||
|
||||
/* Get the clipboard object */
|
||||
clipboard = gtk_widget_get_clipboard (entry);
|
||||
if (gdk_content_formats_contain_gtype (formats, GDK_TYPE_TEXTURE))
|
||||
gdk_clipboard_read_value_async (clipboard, GDK_TYPE_TEXTURE, 0, NULL, paste_received, dest_stack);
|
||||
else if (gdk_content_formats_contain_gtype (formats, GDK_TYPE_PAINTABLE))
|
||||
gdk_clipboard_read_value_async (clipboard, GDK_TYPE_PAINTABLE, 0, NULL, paste_received, dest_stack);
|
||||
else if (gdk_content_formats_contain_gtype (formats, GDK_TYPE_RGBA))
|
||||
gdk_clipboard_read_value_async (clipboard, GDK_TYPE_RGBA, 0, NULL, paste_received, dest_stack);
|
||||
else if (gdk_content_formats_contain_gtype (formats, G_TYPE_FILE))
|
||||
gdk_clipboard_read_value_async (clipboard, G_TYPE_FILE, 0, NULL, paste_received, dest_stack);
|
||||
else if (gdk_content_formats_contain_gtype (formats, G_TYPE_STRING))
|
||||
gdk_clipboard_read_value_async (clipboard, G_TYPE_STRING, 0, NULL, paste_received, dest_stack);
|
||||
}
|
||||
|
||||
/* Request the contents of the clipboard, contents_received will be
|
||||
called when we do get the contents.
|
||||
*/
|
||||
gdk_clipboard_read_text_async (clipboard, NULL, paste_received, entry);
|
||||
static void
|
||||
update_copy_button_sensitivity (GtkWidget *source_stack)
|
||||
{
|
||||
GtkButton *copy_button;
|
||||
const char *visible_child_name;
|
||||
GtkWidget *visible_child;
|
||||
gboolean sensitive;
|
||||
|
||||
copy_button = GTK_BUTTON (g_object_get_data (G_OBJECT (source_stack), "copy-button"));
|
||||
|
||||
visible_child = gtk_stack_get_visible_child (GTK_STACK (source_stack));
|
||||
visible_child_name = gtk_stack_get_visible_child_name (GTK_STACK (source_stack));
|
||||
if (strcmp (visible_child_name, "Text") == 0)
|
||||
{
|
||||
sensitive = strlen (gtk_editable_get_text (GTK_EDITABLE (visible_child))) > 0;
|
||||
}
|
||||
else if (strcmp (visible_child_name, "Color") == 0 ||
|
||||
strcmp (visible_child_name, "Image") == 0)
|
||||
{
|
||||
sensitive = TRUE;
|
||||
}
|
||||
else if (strcmp (visible_child_name, "File") == 0)
|
||||
{
|
||||
sensitive = g_object_get_data (G_OBJECT (visible_child), "file") != NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
sensitive = FALSE;
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (copy_button), sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
source_changed_cb (GtkButton *copy_button,
|
||||
GParamSpec *pspec,
|
||||
GtkWidget *source_stack)
|
||||
{
|
||||
update_copy_button_sensitivity (source_stack);
|
||||
}
|
||||
|
||||
static void
|
||||
text_changed_cb (GtkButton *copy_button,
|
||||
GParamSpec *pspec,
|
||||
GtkWidget *entry)
|
||||
{
|
||||
update_copy_button_sensitivity (gtk_widget_get_ancestor (entry, GTK_TYPE_STACK));
|
||||
}
|
||||
|
||||
static void
|
||||
file_button_set_file (GtkButton *button,
|
||||
GFile *file)
|
||||
{
|
||||
gtk_label_set_label (GTK_LABEL (gtk_button_get_child (button)), g_file_peek_path (file));
|
||||
g_object_set_data_full (G_OBJECT (button), "file", g_object_ref (file), g_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
file_chooser_response (GtkNativeDialog *dialog,
|
||||
int response,
|
||||
GtkButton *button)
|
||||
{
|
||||
gtk_native_dialog_hide (dialog);
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
file_button_set_file (button, file);
|
||||
g_object_unref (file);
|
||||
|
||||
update_copy_button_sensitivity (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK));
|
||||
}
|
||||
|
||||
gtk_native_dialog_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
open_file_cb (GtkWidget *button)
|
||||
{
|
||||
GtkFileChooserNative *chooser;
|
||||
|
||||
chooser = gtk_file_chooser_native_new ("Choose a file",
|
||||
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Open",
|
||||
"_Cancel");
|
||||
|
||||
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), button);
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
|
||||
}
|
||||
|
||||
static void
|
||||
update_paste_button_sensitivity (GdkClipboard *clipboard,
|
||||
GtkWidget *paste_button)
|
||||
{
|
||||
GdkContentFormats *formats;
|
||||
gboolean sensitive = FALSE;
|
||||
|
||||
formats = gdk_clipboard_get_formats (clipboard);
|
||||
|
||||
if (gdk_content_formats_contain_gtype (formats, G_TYPE_FILE) ||
|
||||
gdk_content_formats_contain_gtype (formats, GDK_TYPE_RGBA) ||
|
||||
gdk_content_formats_contain_gtype (formats, GDK_TYPE_TEXTURE) ||
|
||||
gdk_content_formats_contain_gtype (formats, GDK_TYPE_PAINTABLE) ||
|
||||
gdk_content_formats_contain_gtype (formats, G_TYPE_STRING))
|
||||
sensitive = TRUE;
|
||||
|
||||
gtk_widget_set_sensitive (paste_button, sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
unset_clipboard_handler (gpointer data)
|
||||
{
|
||||
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
|
||||
|
||||
g_signal_handlers_disconnect_by_func (clipboard, update_paste_button_sensitivity, data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_drop (GtkStack *dest_stack,
|
||||
const GValue *value,
|
||||
double x,
|
||||
double y,
|
||||
gpointer data)
|
||||
{
|
||||
present_value (dest_stack, value);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkContentProvider *
|
||||
drag_prepare (GtkDragSource *drag_source,
|
||||
double x,
|
||||
double y,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
button = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (drag_source));
|
||||
|
||||
if (GTK_IS_TOGGLE_BUTTON (button))
|
||||
{
|
||||
GtkWidget *image = gtk_widget_get_first_child (button);
|
||||
GdkPaintable *paintable = gtk_image_get_paintable (GTK_IMAGE (image));
|
||||
|
||||
if (GDK_IS_TEXTURE (paintable))
|
||||
{
|
||||
g_value_init (&value, GDK_TYPE_TEXTURE);
|
||||
g_value_set_object (&value, paintable);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_value_init (&value, GDK_TYPE_PAINTABLE);
|
||||
g_value_set_object (&value, paintable);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GFile *file = g_object_get_data (G_OBJECT (button), "file");
|
||||
|
||||
if (file)
|
||||
{
|
||||
g_value_init (&value, G_TYPE_FILE);
|
||||
g_value_set_object (&value, file);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return gdk_content_provider_new_for_value (&value);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_clipboard (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *vbox, *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *entry, *button;
|
||||
GtkWidget *image;
|
||||
GtkBuilderScope *scope;
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *button;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Clipboard");
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
|
||||
"copy_button_clicked", G_CALLBACK (copy_button_clicked),
|
||||
"paste_button_clicked", G_CALLBACK (paste_button_clicked),
|
||||
"source_changed_cb", G_CALLBACK (source_changed_cb),
|
||||
"text_changed_cb", G_CALLBACK (text_changed_cb),
|
||||
"open_file_cb", G_CALLBACK (open_file_cb),
|
||||
"on_drop", G_CALLBACK (on_drop),
|
||||
"drag_prepare", G_CALLBACK (drag_prepare),
|
||||
NULL);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
gtk_builder_add_from_resource (builder, "/clipboard/clipboard.ui", NULL);
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_margin_start (vbox, 8);
|
||||
gtk_widget_set_margin_end (vbox, 8);
|
||||
gtk_widget_set_margin_top (vbox, 8);
|
||||
gtk_widget_set_margin_bottom (vbox, 8);
|
||||
button = GTK_WIDGET (gtk_builder_get_object (builder, "copy_button"));
|
||||
g_object_set_data (gtk_builder_get_object (builder, "source_stack"), "copy-button", button);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
button = GTK_WIDGET (gtk_builder_get_object (builder, "paste_button"));
|
||||
g_signal_connect (gtk_widget_get_clipboard (button), "changed",
|
||||
G_CALLBACK (update_paste_button_sensitivity), button);
|
||||
g_object_set_data_full (G_OBJECT (button), "clipboard-handler", button, unset_clipboard_handler);
|
||||
|
||||
label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard");
|
||||
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
||||
gtk_widget_set_margin_start (hbox, 8);
|
||||
gtk_widget_set_margin_end (hbox, 8);
|
||||
gtk_widget_set_margin_top (hbox, 8);
|
||||
gtk_widget_set_margin_bottom (hbox, 8);
|
||||
gtk_box_append (GTK_BOX (vbox), hbox);
|
||||
|
||||
/* Create the first entry */
|
||||
entry = gtk_entry_new ();
|
||||
gtk_box_append (GTK_BOX (hbox), entry);
|
||||
|
||||
/* Create the button */
|
||||
button = gtk_button_new_with_mnemonic (_("_Copy"));
|
||||
gtk_box_append (GTK_BOX (hbox), button);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (copy_button_clicked), entry);
|
||||
|
||||
label = gtk_label_new ("\"Paste\" will paste the text from the clipboard to the entry");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
||||
gtk_widget_set_margin_start (hbox, 8);
|
||||
gtk_widget_set_margin_end (hbox, 8);
|
||||
gtk_widget_set_margin_top (hbox, 8);
|
||||
gtk_widget_set_margin_bottom (hbox, 8);
|
||||
gtk_box_append (GTK_BOX (vbox), hbox);
|
||||
|
||||
/* Create the second entry */
|
||||
entry = gtk_entry_new ();
|
||||
gtk_box_append (GTK_BOX (hbox), entry);
|
||||
|
||||
/* Create the button */
|
||||
button = gtk_button_new_with_mnemonic (_("_Paste"));
|
||||
gtk_box_append (GTK_BOX (hbox), button);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (paste_button_clicked), entry);
|
||||
|
||||
label = gtk_label_new ("Images can be transferred via the clipboard, too");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
||||
gtk_widget_set_margin_start (hbox, 8);
|
||||
gtk_widget_set_margin_end (hbox, 8);
|
||||
gtk_widget_set_margin_top (hbox, 8);
|
||||
gtk_widget_set_margin_bottom (hbox, 8);
|
||||
gtk_box_append (GTK_BOX (vbox), hbox);
|
||||
|
||||
/* Create the first image */
|
||||
image = demo_image_new ("dialog-warning");
|
||||
gtk_box_append (GTK_BOX (hbox), image);
|
||||
|
||||
/* Create the second image */
|
||||
image = demo_image_new ("process-stop");
|
||||
gtk_box_append (GTK_BOX (hbox), image);
|
||||
|
||||
/* Create the third image */
|
||||
image = demo_image_new ("weather-clear");
|
||||
gtk_box_append (GTK_BOX (hbox), image);
|
||||
g_object_unref (builder);
|
||||
g_object_unref (scope);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
288
demos/gtk-demo/clipboard.ui
Normal file
288
demos/gtk-demo/clipboard.ui
Normal file
@@ -0,0 +1,288 @@
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="resizable">1</property>
|
||||
<property name="title">Clipboard</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">“Copy” will copy the selected data the clipboard, “Paste” will show the current clipboard contents. You can also drag the data to the bottom.</property>
|
||||
<property name="wrap">1</property>
|
||||
<property name="max-width-chars">40</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkDropDown" id="source_chooser">
|
||||
<property name="valign">center</property>
|
||||
<property name="model">
|
||||
<object class="GtkStringList">
|
||||
<items>
|
||||
<item>Text</item>
|
||||
<item>Color</item>
|
||||
<item>Image</item>
|
||||
<item>File</item>
|
||||
</items>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="source_stack">
|
||||
<signal name="notify::visible-child" handler="source_changed_cb" object="copy_button"/>
|
||||
<property name="vexpand">1</property>
|
||||
<binding name="visible-child-name">
|
||||
<lookup name="string" type="GtkStringObject">
|
||||
<lookup name="selected-item">
|
||||
source_chooser
|
||||
</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">Text</property>
|
||||
<property name="child">
|
||||
<object class="GtkEntry" id="source_text">
|
||||
<property name="valign">center</property>
|
||||
<signal name="notify::text" handler="text_changed_cb" object="copy_button"/>
|
||||
<property name="text">Copy this!</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">Color</property>
|
||||
<property name="child">
|
||||
<object class="GtkColorButton" id="source_color">
|
||||
<property name="valign">center</property>
|
||||
<property name="rgba">purple</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">Image</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="image_rose">
|
||||
<property name="active">1</property>
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<signal name="prepare" handler="drag_prepare"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<style>
|
||||
<class name="large-icons"/>
|
||||
</style>
|
||||
<property name="paintable">resource:///transparent/portland-rose.jpg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="image_floppy">
|
||||
<property name="group">image_rose</property>
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<signal name="prepare" handler="drag_prepare"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<style>
|
||||
<class name="large-icons"/>
|
||||
</style>
|
||||
<property name="paintable">resource:///images/floppybuddy.gif</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="image_logo">
|
||||
<property name="group">image_floppy</property>
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<signal name="prepare" handler="drag_prepare"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<style>
|
||||
<class name="large-icons"/>
|
||||
</style>
|
||||
<property name="paintable">resource:///images/org.gtk.Demo4.svg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">File</property>
|
||||
<property name="child">
|
||||
<object class="GtkButton" id="source_file">
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<property name="propagation-phase">capture</property>
|
||||
<signal name="prepare" handler="drag_prepare"/>
|
||||
</object>
|
||||
</child>
|
||||
<property name="valign">center</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel">
|
||||
<property name="label">—</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="ellipsize">start</property>
|
||||
</object>
|
||||
</property>
|
||||
<signal name="clicked" handler="open_file_cb"/>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="copy_button">
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">_Copy</property>
|
||||
<signal name="clicked" handler="copy_button_clicked" object="source_stack"/>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator">
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkDropTarget">
|
||||
<property name="actions">copy</property>
|
||||
<property name="formats">GdkTexture GdkPaintable GFile GdkRGBA gchararray</property>
|
||||
<signal name="drop" handler="on_drop" object="dest_stack"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="paste_button">
|
||||
<property name="label" translatable="yes">_Paste</property>
|
||||
<signal name="clicked" handler="paste_button_clicked" object="dest_stack"/>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="xalign">0</property>
|
||||
<binding name="label">
|
||||
<lookup name="visible-child-name" type="GtkStack">
|
||||
dest_stack
|
||||
</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="dest_stack">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name"></property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel">
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">Text</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="ellipsize">end</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">Image</property>
|
||||
<property name="child">
|
||||
<object class="GtkImage">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="large-icons"/>
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">Color</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkColorSwatch">
|
||||
<property name="accessible-role">img</property>
|
||||
<property name="can-focus">0</property>
|
||||
<property name="selectable">0</property>
|
||||
<property name="has-menu">0</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">File</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="ellipsize">start</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -15,6 +15,7 @@
|
||||
<file>demo.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/clipboard">
|
||||
<file>clipboard.ui</file>
|
||||
<file>demoimage.c</file>
|
||||
<file>demoimage.h</file>
|
||||
</gresource>
|
||||
|
||||
@@ -16,6 +16,7 @@ SYNOPSIS
|
||||
| **gtk4-builder-tool** enumerate <FILE>
|
||||
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** precompile [OPTIONS...] <FILE>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -83,3 +84,10 @@ to do manual fixups after the initial conversion.
|
||||
``--3to4``
|
||||
|
||||
Transform a GTK 3 UI definition file to the equivalent GTK 4 definitions.
|
||||
|
||||
Precompilation
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
The ``precompile`` command creates a more compact, and faster to load compiled
|
||||
form of the ui file that is understood by GtkBuilder. The output is written
|
||||
to a file with the extension ``.precompiled``.
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
typedef struct _Deserializer Deserializer;
|
||||
|
||||
struct _Deserializer
|
||||
struct _Deserializer
|
||||
{
|
||||
const char * mime_type; /* interned */
|
||||
GType type;
|
||||
@@ -934,25 +934,6 @@ init (void)
|
||||
|
||||
formats = gdk_pixbuf_get_formats ();
|
||||
|
||||
/* Make sure png comes first */
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
char *name;
|
||||
|
||||
name = gdk_pixbuf_format_get_name (fmt);
|
||||
if (g_str_equal (name, "png"))
|
||||
{
|
||||
formats = g_slist_delete_link (formats, f);
|
||||
formats = g_slist_prepend (formats, fmt);
|
||||
|
||||
g_free (name);
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
}
|
||||
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
|
||||
@@ -718,19 +718,33 @@ gdk_content_formats_builder_to_formats (GdkContentFormatsBuilder *builder)
|
||||
|
||||
g_return_val_if_fail (builder != NULL, NULL);
|
||||
|
||||
gtypes = g_new (GType, builder->n_gtypes + 1);
|
||||
i = builder->n_gtypes;
|
||||
gtypes[i--] = G_TYPE_INVALID;
|
||||
/* add backwards because most important type is last in the list */
|
||||
for (l = builder->gtypes; l; l = l->next)
|
||||
gtypes[i--] = GPOINTER_TO_SIZE (l->data);
|
||||
if (builder->n_gtypes > 0)
|
||||
{
|
||||
gtypes = g_new (GType, builder->n_gtypes + 1);
|
||||
i = builder->n_gtypes;
|
||||
gtypes[i--] = G_TYPE_INVALID;
|
||||
/* add backwards because most important type is last in the list */
|
||||
for (l = builder->gtypes; l; l = l->next)
|
||||
gtypes[i--] = GPOINTER_TO_SIZE (l->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtypes = NULL;
|
||||
}
|
||||
|
||||
mime_types = g_new (const char *, builder->n_mime_types + 1);
|
||||
i = builder->n_mime_types;
|
||||
mime_types[i--] = NULL;
|
||||
/* add backwards because most important type is last in the list */
|
||||
for (l = builder->mime_types; l; l = l->next)
|
||||
mime_types[i--] = l->data;
|
||||
if (builder->n_mime_types > 0)
|
||||
{
|
||||
mime_types = g_new (const char *, builder->n_mime_types + 1);
|
||||
i = builder->n_mime_types;
|
||||
mime_types[i--] = NULL;
|
||||
/* add backwards because most important type is last in the list */
|
||||
for (l = builder->mime_types; l; l = l->next)
|
||||
mime_types[i--] = l->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
mime_types = NULL;
|
||||
}
|
||||
|
||||
result = gdk_content_formats_new_take (gtypes, builder->n_gtypes,
|
||||
mime_types, builder->n_mime_types);
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
typedef struct _Serializer Serializer;
|
||||
|
||||
struct _Serializer
|
||||
struct _Serializer
|
||||
{
|
||||
const char * mime_type; /* interned */
|
||||
GType type;
|
||||
@@ -446,7 +446,7 @@ lookup_serializer (const char *mime_type,
|
||||
serializer->type == type)
|
||||
return serializer;
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ pixbuf_serializer (GdkContentSerializer *serializer)
|
||||
const GValue *value;
|
||||
GdkPixbuf *pixbuf;
|
||||
const char *name;
|
||||
|
||||
|
||||
name = gdk_content_serializer_get_user_data (serializer);
|
||||
value = gdk_content_serializer_get_value (serializer);
|
||||
|
||||
@@ -651,7 +651,7 @@ pixbuf_serializer (GdkContentSerializer *serializer)
|
||||
gdk_pixbuf_save_to_stream_async (pixbuf,
|
||||
gdk_content_serializer_get_output_stream (serializer),
|
||||
name,
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
pixbuf_serializer_finish,
|
||||
serializer,
|
||||
g_str_equal (name, "png") ? "compression" : NULL, "2",
|
||||
@@ -823,7 +823,7 @@ file_uri_serializer (GdkContentSerializer *serializer)
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_FILE_LIST))
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
|
||||
for (l = g_value_get_boxed (value); l; l = l->next)
|
||||
{
|
||||
uri = g_file_get_uri (l->data);
|
||||
@@ -867,7 +867,7 @@ file_text_serializer (GdkContentSerializer *serializer)
|
||||
{
|
||||
GString *str;
|
||||
GSList *l;
|
||||
|
||||
|
||||
str = g_string_new (NULL);
|
||||
|
||||
for (l = g_value_get_boxed (value); l; l = l->next)
|
||||
@@ -966,25 +966,6 @@ init (void)
|
||||
|
||||
formats = gdk_pixbuf_get_formats ();
|
||||
|
||||
/* Make sure png comes first */
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
char *name;
|
||||
|
||||
name = gdk_pixbuf_format_get_name (fmt);
|
||||
if (g_str_equal (name, "png"))
|
||||
{
|
||||
formats = g_slist_delete_link (formats, f);
|
||||
formats = g_slist_prepend (formats, fmt);
|
||||
|
||||
g_free (name);
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
}
|
||||
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
|
||||
@@ -132,6 +132,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
* GdkDevice:source: (attributes org.gtk.Property.get=gdk_device_get_source)
|
||||
*
|
||||
* Source type for the device.
|
||||
*
|
||||
* Deprecated: 4.6: Use GdkDeviceTool:tool-type instead
|
||||
*/
|
||||
device_props[PROP_SOURCE] =
|
||||
g_param_spec_enum ("source",
|
||||
@@ -596,6 +598,8 @@ gdk_device_get_has_cursor (GdkDevice *device)
|
||||
* Determines the type of the device.
|
||||
*
|
||||
* Returns: a `GdkInputSource`
|
||||
*
|
||||
* Deprecated: 4.6: Use gdk_device_tool_get_tool_type() instead
|
||||
*/
|
||||
GdkInputSource
|
||||
gdk_device_get_source (GdkDevice *device)
|
||||
|
||||
@@ -92,7 +92,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay * gdk_device_get_display (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSeat * gdk_device_get_seat (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_6_FOR(gdk_device_tool_get_tool_type)
|
||||
GdkDeviceTool * gdk_device_get_device_tool (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -2,3 +2,4 @@ BOOLEAN:BOXED
|
||||
BOOLEAN:OBJECT
|
||||
BOOLEAN:POINTER
|
||||
VOID:POINTER,POINTER,BOOLEAN,BOOLEAN
|
||||
VOID:INT,INT
|
||||
|
||||
@@ -605,11 +605,14 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
_gdk_marshal_VOID__INT_INT,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT);
|
||||
g_signal_set_va_marshaller (signals[LAYOUT],
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
_gdk_marshal_VOID__INT_INTv);
|
||||
|
||||
/**
|
||||
* GdkSurface::render:
|
||||
|
||||
@@ -89,10 +89,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_texture_download (GdkTexture *texture,
|
||||
guchar *data,
|
||||
gsize stride);
|
||||
GDK_AVAILABLE_IN_4_6
|
||||
void gdk_texture_download_float (GdkTexture *texture,
|
||||
float *data,
|
||||
gsize stride);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_texture_save_to_png (GdkTexture *texture,
|
||||
const char *filename);
|
||||
|
||||
@@ -240,7 +240,7 @@ static const FormatData format_data[] = {
|
||||
[GDK_MEMORY_A8R8G8B8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
||||
[GDK_MEMORY_R8G8B8A8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
||||
[GDK_MEMORY_A8B8G8R8] = { GDK_MEMORY_R8G8B8A8, 8, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_UNASSALPHA },
|
||||
[GDK_MEMORY_R8G8B8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0 },
|
||||
[GDK_MEMORY_R8G8B8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0 },
|
||||
[GDK_MEMORY_B8G8R8] = { GDK_MEMORY_R8G8B8, 8, 3, SAMPLEFORMAT_UINT, 0 },
|
||||
[GDK_MEMORY_R16G16B16] = { GDK_MEMORY_R16G16B16, 16, 3, SAMPLEFORMAT_UINT, 0 },
|
||||
[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] = { GDK_MEMORY_R16G16B16A16_PREMULTIPLIED, 16, 4, SAMPLEFORMAT_UINT, EXTRASAMPLE_ASSOCALPHA },
|
||||
@@ -376,6 +376,13 @@ gdk_load_tiff (GBytes *input_bytes,
|
||||
G_GNUC_UNUSED gint64 before = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
tif = tiff_open_read (input_bytes);
|
||||
if (!tif)
|
||||
{
|
||||
g_set_error_literal (error,
|
||||
GDK_TEXTURE_ERROR, GDK_TEXTURE_ERROR_CORRUPT_IMAGE,
|
||||
_("Could not load TIFF data"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TIFFSetDirectory (tif, 0);
|
||||
|
||||
|
||||
@@ -76,11 +76,30 @@ print_atoms (GdkX11Clipboard *cb,
|
||||
});
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_clipboard_default_output_closed (GObject *stream,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!g_output_stream_close_finish (G_OUTPUT_STREAM (stream), result, &error))
|
||||
{
|
||||
GDK_NOTE (CLIPBOARD,
|
||||
g_printerr ("-------: failed to close stream: %s\n",
|
||||
error->message));
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_object_unref (stream);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_clipboard_default_output_done (GObject *clipboard,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GOutputStream *stream = user_data;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!gdk_clipboard_write_finish (GDK_CLIPBOARD (clipboard), result, &error))
|
||||
@@ -90,6 +109,12 @@ gdk_x11_clipboard_default_output_done (GObject *clipboard,
|
||||
GDK_X11_CLIPBOARD (clipboard)->selection, error->message));
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_output_stream_close_async (stream,
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL,
|
||||
gdk_x11_clipboard_default_output_closed,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -103,8 +128,7 @@ gdk_x11_clipboard_default_output_handler (GOutputStream *stream,
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL,
|
||||
gdk_x11_clipboard_default_output_done,
|
||||
NULL);
|
||||
g_object_unref (stream);
|
||||
stream);
|
||||
}
|
||||
|
||||
static GInputStream *
|
||||
|
||||
@@ -1612,11 +1612,30 @@ gdk_x11_drag_set_hotspot (GdkDrag *drag,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_drag_default_output_closed (GObject *stream,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!g_output_stream_close_finish (G_OUTPUT_STREAM (stream), result, &error))
|
||||
{
|
||||
GDK_NOTE (DND,
|
||||
g_printerr ("failed to close stream: %s\n",
|
||||
error->message));
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_object_unref (stream);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_drag_default_output_done (GObject *drag,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GOutputStream *stream = user_data;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!gdk_drag_write_finish (GDK_DRAG (drag), result, &error))
|
||||
@@ -1624,6 +1643,12 @@ gdk_x11_drag_default_output_done (GObject *drag,
|
||||
GDK_DISPLAY_NOTE (gdk_drag_get_display (GDK_DRAG (drag)), DND, g_printerr ("failed to write stream: %s\n", error->message));
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_output_stream_close_async (stream,
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL,
|
||||
gdk_x11_drag_default_output_closed,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1637,8 +1662,7 @@ gdk_x11_drag_default_output_handler (GOutputStream *stream,
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL,
|
||||
gdk_x11_drag_default_output_done,
|
||||
NULL);
|
||||
g_object_unref (stream);
|
||||
stream);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
||||
@@ -57,7 +57,8 @@ struct _GdkX11SelectionOutputStreamPrivate {
|
||||
GTask *pending_task;
|
||||
|
||||
guint incr : 1;
|
||||
guint delete_pending : 1;
|
||||
guint sent_end_of_stream : 1;
|
||||
guint delete_pending : 1; /* owns a reference */
|
||||
};
|
||||
|
||||
struct _GdkX11PendingSelectionNotify
|
||||
@@ -176,12 +177,16 @@ gdk_x11_selection_output_stream_needs_flush_unlocked (GdkX11SelectionOutputStrea
|
||||
{
|
||||
GdkX11SelectionOutputStreamPrivate *priv = gdk_x11_selection_output_stream_get_instance_private (stream);
|
||||
|
||||
if (priv->data->len == 0 && priv->notify == NULL)
|
||||
if (priv->sent_end_of_stream)
|
||||
return FALSE;
|
||||
|
||||
if (g_output_stream_is_closing (G_OUTPUT_STREAM (stream)))
|
||||
if (g_output_stream_is_closing (G_OUTPUT_STREAM (stream)) ||
|
||||
g_output_stream_is_closed (G_OUTPUT_STREAM (stream)))
|
||||
return TRUE;
|
||||
|
||||
if (priv->data->len == 0 && priv->notify == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (priv->flush_requested)
|
||||
return TRUE;
|
||||
|
||||
@@ -284,6 +289,8 @@ gdk_x11_selection_output_stream_perform_flush (GdkX11SelectionOutputStream *stre
|
||||
g_byte_array_remove_range (priv->data, 0, n_elements * element_size);
|
||||
if (priv->data->len < element_size)
|
||||
priv->flush_requested = FALSE;
|
||||
if (!priv->incr || n_elements == 0)
|
||||
priv->sent_end_of_stream = TRUE;
|
||||
}
|
||||
|
||||
if (priv->notify)
|
||||
@@ -292,6 +299,7 @@ gdk_x11_selection_output_stream_perform_flush (GdkX11SelectionOutputStream *stre
|
||||
priv->notify = NULL;
|
||||
}
|
||||
|
||||
g_object_ref (stream);
|
||||
priv->delete_pending = TRUE;
|
||||
g_cond_broadcast (&priv->cond);
|
||||
g_mutex_unlock (&priv->mutex);
|
||||
@@ -494,60 +502,6 @@ gdk_x11_selection_output_stream_flush_finish (GOutputStream *stream,
|
||||
return g_task_propagate_boolean (G_TASK (result), error);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_selection_output_stream_invoke_close (gpointer stream)
|
||||
{
|
||||
GdkX11SelectionOutputStreamPrivate *priv = gdk_x11_selection_output_stream_get_instance_private (stream);
|
||||
|
||||
GDK_X11_DISPLAY (priv->display)->streams = g_slist_remove (GDK_X11_DISPLAY (priv->display)->streams, stream);
|
||||
g_signal_handlers_disconnect_by_func (priv->display,
|
||||
gdk_x11_selection_output_stream_xevent,
|
||||
stream);
|
||||
g_object_unref (stream);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_selection_output_stream_close (GOutputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
g_main_context_invoke (NULL, gdk_x11_selection_output_stream_invoke_close, g_object_ref (stream));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_selection_output_stream_close_async (GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (stream, cancellable, callback, user_data);
|
||||
g_task_set_source_tag (task, gdk_x11_selection_output_stream_close_async);
|
||||
g_task_set_priority (task, io_priority);
|
||||
|
||||
gdk_x11_selection_output_stream_invoke_close (stream);
|
||||
g_task_return_boolean (task, TRUE);
|
||||
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_selection_output_stream_close_finish (GOutputStream *stream,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (g_task_is_valid (result, stream), FALSE);
|
||||
g_return_val_if_fail (g_async_result_is_tagged (result, gdk_x11_selection_output_stream_close_async), FALSE);
|
||||
|
||||
return g_task_propagate_boolean (G_TASK (result), error);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_selection_output_stream_finalize (GObject *object)
|
||||
{
|
||||
@@ -557,6 +511,13 @@ gdk_x11_selection_output_stream_finalize (GObject *object)
|
||||
/* not sending a notify is terrible */
|
||||
g_assert (priv->notify == NULL);
|
||||
|
||||
GDK_DISPLAY_NOTE (priv->display, SELECTION, g_printerr ("%s:%s: finalizing\n",
|
||||
priv->selection, priv->target));
|
||||
GDK_X11_DISPLAY (priv->display)->streams = g_slist_remove (GDK_X11_DISPLAY (priv->display)->streams, stream);
|
||||
g_signal_handlers_disconnect_by_func (priv->display,
|
||||
gdk_x11_selection_output_stream_xevent,
|
||||
stream);
|
||||
|
||||
g_byte_array_unref (priv->data);
|
||||
g_cond_clear (&priv->cond);
|
||||
g_mutex_clear (&priv->mutex);
|
||||
@@ -579,14 +540,11 @@ gdk_x11_selection_output_stream_class_init (GdkX11SelectionOutputStreamClass *kl
|
||||
|
||||
output_stream_class->write_fn = gdk_x11_selection_output_stream_write;
|
||||
output_stream_class->flush = gdk_x11_selection_output_stream_flush;
|
||||
output_stream_class->close_fn = gdk_x11_selection_output_stream_close;
|
||||
|
||||
output_stream_class->write_async = gdk_x11_selection_output_stream_write_async;
|
||||
output_stream_class->write_finish = gdk_x11_selection_output_stream_write_finish;
|
||||
output_stream_class->flush_async = gdk_x11_selection_output_stream_flush_async;
|
||||
output_stream_class->flush_finish = gdk_x11_selection_output_stream_flush_finish;
|
||||
output_stream_class->close_async = gdk_x11_selection_output_stream_close_async;
|
||||
output_stream_class->close_finish = gdk_x11_selection_output_stream_close_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -628,6 +586,7 @@ gdk_x11_selection_output_stream_xevent (GdkDisplay *display,
|
||||
if (gdk_x11_selection_output_stream_needs_flush (stream) &&
|
||||
gdk_x11_selection_output_stream_can_flush (stream))
|
||||
gdk_x11_selection_output_stream_perform_flush (stream);
|
||||
g_object_unref (stream); /* from unsetting the delete_pending */
|
||||
return FALSE;
|
||||
|
||||
default:
|
||||
|
||||
@@ -245,6 +245,47 @@ gsk_rounded_rect_shrink_to_minimum (GskRoundedRect *self)
|
||||
self->corner[1].height + self->corner[2].height);
|
||||
}
|
||||
|
||||
static inline gboolean G_GNUC_PURE
|
||||
node_supports_2d_transform (const GskRenderNode *node)
|
||||
{
|
||||
switch ((int)gsk_render_node_get_node_type (node))
|
||||
{
|
||||
case GSK_COLOR_NODE:
|
||||
case GSK_OPACITY_NODE:
|
||||
case GSK_COLOR_MATRIX_NODE:
|
||||
case GSK_TEXTURE_NODE:
|
||||
case GSK_CROSS_FADE_NODE:
|
||||
case GSK_LINEAR_GRADIENT_NODE:
|
||||
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
|
||||
case GSK_CONIC_GRADIENT_NODE:
|
||||
case GSK_RADIAL_GRADIENT_NODE:
|
||||
case GSK_REPEATING_RADIAL_GRADIENT_NODE:
|
||||
case GSK_DEBUG_NODE:
|
||||
case GSK_TEXT_NODE:
|
||||
case GSK_CAIRO_NODE:
|
||||
case GSK_BLEND_NODE:
|
||||
case GSK_BLUR_NODE:
|
||||
return TRUE;
|
||||
|
||||
case GSK_SHADOW_NODE:
|
||||
return node_supports_2d_transform (gsk_shadow_node_get_child (node));
|
||||
|
||||
case GSK_TRANSFORM_NODE:
|
||||
return node_supports_2d_transform (gsk_transform_node_get_child (node));
|
||||
|
||||
case GSK_CONTAINER_NODE:
|
||||
for (guint i = 0, p = gsk_container_node_get_n_children (node); i < p; i++)
|
||||
{
|
||||
if (!node_supports_2d_transform (gsk_container_node_get_child (node, i)))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static inline gboolean G_GNUC_PURE
|
||||
node_supports_transform (const GskRenderNode *node)
|
||||
{
|
||||
@@ -257,24 +298,26 @@ node_supports_transform (const GskRenderNode *node)
|
||||
|
||||
switch ((int)gsk_render_node_get_node_type (node))
|
||||
{
|
||||
case GSK_COLOR_NODE:
|
||||
case GSK_OPACITY_NODE:
|
||||
case GSK_COLOR_MATRIX_NODE:
|
||||
case GSK_TEXTURE_NODE:
|
||||
case GSK_CROSS_FADE_NODE:
|
||||
case GSK_LINEAR_GRADIENT_NODE:
|
||||
case GSK_DEBUG_NODE:
|
||||
case GSK_TEXT_NODE:
|
||||
return TRUE;
|
||||
case GSK_COLOR_NODE:
|
||||
case GSK_OPACITY_NODE:
|
||||
case GSK_COLOR_MATRIX_NODE:
|
||||
case GSK_TEXTURE_NODE:
|
||||
case GSK_CROSS_FADE_NODE:
|
||||
case GSK_DEBUG_NODE:
|
||||
case GSK_TEXT_NODE:
|
||||
case GSK_CAIRO_NODE:
|
||||
case GSK_BLEND_NODE:
|
||||
case GSK_BLUR_NODE:
|
||||
return TRUE;
|
||||
|
||||
case GSK_SHADOW_NODE:
|
||||
return node_supports_transform (gsk_shadow_node_get_child (node));
|
||||
case GSK_SHADOW_NODE:
|
||||
return node_supports_transform (gsk_shadow_node_get_child (node));
|
||||
|
||||
case GSK_TRANSFORM_NODE:
|
||||
return node_supports_transform (gsk_transform_node_get_child (node));
|
||||
case GSK_TRANSFORM_NODE:
|
||||
return node_supports_transform (gsk_transform_node_get_child (node));
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2017,6 +2060,14 @@ gsk_gl_render_job_visit_transform_node (GskGLRenderJob *job,
|
||||
break;
|
||||
|
||||
case GSK_TRANSFORM_CATEGORY_2D:
|
||||
if (node_supports_2d_transform (child))
|
||||
{
|
||||
gsk_gl_render_job_push_modelview (job, transform);
|
||||
gsk_gl_render_job_visit_node (job, child);
|
||||
gsk_gl_render_job_pop_modelview (job);
|
||||
return;
|
||||
}
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case GSK_TRANSFORM_CATEGORY_3D:
|
||||
case GSK_TRANSFORM_CATEGORY_ANY:
|
||||
case GSK_TRANSFORM_CATEGORY_UNKNOWN:
|
||||
|
||||
@@ -66,7 +66,7 @@ for f in get_files('theme/Default/assets-hc', '.svg'):
|
||||
xml += ' <file preprocess=\'xml-stripblanks\'>theme/Default/assets-hc/{0}</file>\n'.format(f)
|
||||
|
||||
for f in get_files('ui', '.ui'):
|
||||
xml += ' <file>ui/{0}</file>\n'.format(f)
|
||||
xml += ' <file alias="ui/{0}">ui/{0}.precompiled</file>\n'.format(f)
|
||||
|
||||
xml += '\n'
|
||||
|
||||
|
||||
@@ -945,6 +945,7 @@ gtk_action_muxer_register_observer (GtkActionObservable *observable,
|
||||
gboolean enabled;
|
||||
const GVariantType *parameter_type;
|
||||
GVariant *state;
|
||||
gboolean is_duplicate;
|
||||
|
||||
if (!muxer->observed_actions)
|
||||
muxer->observed_actions = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, gtk_action_muxer_free_action);
|
||||
@@ -961,22 +962,26 @@ gtk_action_muxer_register_observer (GtkActionObservable *observable,
|
||||
g_hash_table_insert (muxer->observed_actions, action->fullname, action);
|
||||
}
|
||||
|
||||
is_duplicate = g_slist_find (action->watchers, observer) != NULL;
|
||||
action->watchers = g_slist_prepend (action->watchers, observer);
|
||||
g_object_weak_ref (G_OBJECT (observer), gtk_action_muxer_weak_notify, action);
|
||||
|
||||
if (action_muxer_query_action (muxer, name,
|
||||
&enabled, ¶meter_type,
|
||||
NULL, NULL, &state, TRUE))
|
||||
if (!is_duplicate)
|
||||
{
|
||||
gtk_action_muxer_action_added (muxer, name, parameter_type, enabled, state);
|
||||
g_clear_pointer (&state, g_variant_unref);
|
||||
}
|
||||
if (action_muxer_query_action (muxer, name,
|
||||
&enabled, ¶meter_type,
|
||||
NULL, NULL, &state, TRUE))
|
||||
{
|
||||
gtk_action_muxer_action_added (muxer, name, parameter_type, enabled, state);
|
||||
g_clear_pointer (&state, g_variant_unref);
|
||||
}
|
||||
|
||||
if (muxer->parent)
|
||||
{
|
||||
gtk_action_observable_register_observer (GTK_ACTION_OBSERVABLE (muxer->parent),
|
||||
name,
|
||||
GTK_ACTION_OBSERVER (muxer));
|
||||
if (muxer->parent)
|
||||
{
|
||||
gtk_action_observable_register_observer (GTK_ACTION_OBSERVABLE (muxer->parent),
|
||||
name,
|
||||
GTK_ACTION_OBSERVER (muxer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,100 +27,228 @@
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RECORD_TYPE_ELEMENT,
|
||||
RECORD_TYPE_END_ELEMENT,
|
||||
RECORD_TYPE_TEXT,
|
||||
} RecordTreeType;
|
||||
RECORD_TYPE_ELEMENT,
|
||||
RECORD_TYPE_END_ELEMENT,
|
||||
RECORD_TYPE_TEXT,
|
||||
} RecordDataType;
|
||||
|
||||
typedef struct RecordDataTree RecordDataTree;
|
||||
/* All strings are owned by the string chunk */
|
||||
typedef struct {
|
||||
/* Must be first for g_slice_free_chain() */
|
||||
GList link;
|
||||
|
||||
/* All strings are owned by the string table */
|
||||
struct RecordDataTree {
|
||||
RecordDataTree *parent;
|
||||
RecordTreeType type;
|
||||
const char *string;
|
||||
int len;
|
||||
int count;
|
||||
int offset;
|
||||
int text_offset;
|
||||
gboolean include_len;
|
||||
} RecordDataString;
|
||||
|
||||
typedef struct {
|
||||
RecordDataType type;
|
||||
GList link;
|
||||
} RecordDataNode;
|
||||
|
||||
typedef struct RecordDataElement RecordDataElement;
|
||||
|
||||
struct RecordDataElement {
|
||||
RecordDataNode base;
|
||||
|
||||
RecordDataElement *parent;
|
||||
GQueue children;
|
||||
int n_attributes;
|
||||
const char *data;
|
||||
const char **attributes;
|
||||
const char **values;
|
||||
GList *children;
|
||||
gboolean preserve_whitespace;
|
||||
RecordDataString *name;
|
||||
RecordDataString *attributes[];
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *string;
|
||||
int count;
|
||||
int offset;
|
||||
} RecordDataString;
|
||||
RecordDataNode base;
|
||||
|
||||
static RecordDataTree *
|
||||
record_data_tree_new (RecordDataTree *parent,
|
||||
RecordTreeType type,
|
||||
const char *data)
|
||||
{
|
||||
RecordDataTree *tree = g_slice_new0 (RecordDataTree);
|
||||
|
||||
tree->parent = parent;
|
||||
tree->type = type;
|
||||
tree->data = data;
|
||||
|
||||
if (parent)
|
||||
parent->children = g_list_prepend (parent->children, tree);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
static void
|
||||
record_data_tree_free (RecordDataTree *tree)
|
||||
{
|
||||
g_list_free_full (tree->children, (GDestroyNotify)record_data_tree_free);
|
||||
g_free (tree->attributes);
|
||||
g_free (tree->values);
|
||||
g_slice_free (RecordDataTree, tree);
|
||||
}
|
||||
|
||||
static void
|
||||
record_data_string_free (RecordDataString *s)
|
||||
{
|
||||
g_free (s->string);
|
||||
g_slice_free (RecordDataString, s);
|
||||
}
|
||||
|
||||
static const char *
|
||||
record_data_string_lookup (GHashTable *strings,
|
||||
const char *str,
|
||||
gssize len)
|
||||
{
|
||||
char *copy = NULL;
|
||||
RecordDataString *s;
|
||||
|
||||
if (len >= 0)
|
||||
{
|
||||
/* Ensure str is zero terminated */
|
||||
copy = g_strndup (str, len);
|
||||
str = copy;
|
||||
}
|
||||
|
||||
s = g_hash_table_lookup (strings, str);
|
||||
if (s)
|
||||
{
|
||||
g_free (copy);
|
||||
s->count++;
|
||||
return s->string;
|
||||
}
|
||||
|
||||
s = g_slice_new (RecordDataString);
|
||||
s->string = copy ? copy : g_strdup (str);
|
||||
s->count = 1;
|
||||
|
||||
g_hash_table_insert (strings, s->string, s);
|
||||
return s->string;
|
||||
}
|
||||
RecordDataString *string;
|
||||
} RecordDataText;
|
||||
|
||||
typedef struct {
|
||||
GHashTable *strings;
|
||||
RecordDataTree *root;
|
||||
RecordDataTree *current;
|
||||
GStringChunk *chunks;
|
||||
GQueue string_list;
|
||||
RecordDataElement *root;
|
||||
RecordDataElement *current;
|
||||
} RecordData;
|
||||
|
||||
static gpointer
|
||||
record_data_node_new (RecordDataElement *parent,
|
||||
RecordDataType type,
|
||||
gsize size)
|
||||
{
|
||||
RecordDataNode *node = g_slice_alloc0 (size);
|
||||
|
||||
node->type = type;
|
||||
node->link.data = node;
|
||||
|
||||
if (parent)
|
||||
g_queue_push_tail_link (&parent->children, &node->link);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
text_is_important (const char *name)
|
||||
{
|
||||
const char *elements[] = {
|
||||
"property",
|
||||
"attribute",
|
||||
"col",
|
||||
"action-widget",
|
||||
"item",
|
||||
"mime-type",
|
||||
"pattern",
|
||||
"suffix",
|
||||
"mark",
|
||||
NULL
|
||||
};
|
||||
|
||||
return g_strv_contains (elements, name);
|
||||
}
|
||||
|
||||
static RecordDataElement *
|
||||
record_data_element_new (RecordDataElement *parent,
|
||||
RecordDataString *name,
|
||||
gsize n_attributes)
|
||||
{
|
||||
RecordDataElement *element;
|
||||
|
||||
element = record_data_node_new (parent,
|
||||
RECORD_TYPE_ELEMENT,
|
||||
sizeof (RecordDataElement) +
|
||||
sizeof (RecordDataString) * n_attributes);
|
||||
element->parent = parent;
|
||||
element->name = name;
|
||||
element->preserve_whitespace = name && text_is_important (name->string);
|
||||
element->n_attributes = n_attributes;
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
static void
|
||||
record_data_element_append_text (RecordDataElement *parent,
|
||||
RecordDataString *string)
|
||||
{
|
||||
RecordDataText *text;
|
||||
|
||||
text = record_data_node_new (parent,
|
||||
RECORD_TYPE_TEXT,
|
||||
sizeof (RecordDataText));
|
||||
text->string = string;
|
||||
}
|
||||
|
||||
static void
|
||||
record_data_node_free (RecordDataNode *node)
|
||||
{
|
||||
GList *l, *next;
|
||||
RecordDataText *text;
|
||||
RecordDataElement *element;
|
||||
|
||||
switch (node->type)
|
||||
{
|
||||
case RECORD_TYPE_ELEMENT:
|
||||
element = (RecordDataElement *)node;
|
||||
|
||||
l = element->children.head;
|
||||
while (l)
|
||||
{
|
||||
next = l->next;
|
||||
record_data_node_free (l->data);
|
||||
l = next;
|
||||
}
|
||||
|
||||
g_slice_free1 (sizeof (RecordDataElement) +
|
||||
sizeof (RecordDataString) * element->n_attributes, element);
|
||||
break;
|
||||
case RECORD_TYPE_TEXT:
|
||||
text = (RecordDataText *)node;
|
||||
g_slice_free (RecordDataText, text);
|
||||
break;
|
||||
case RECORD_TYPE_END_ELEMENT:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
record_data_string_equal (gconstpointer _a,
|
||||
gconstpointer _b)
|
||||
{
|
||||
const RecordDataString *a = _a;
|
||||
const RecordDataString *b = _b;
|
||||
|
||||
return a->len == b->len &&
|
||||
memcmp (a->string, b->string, a->len) == 0;
|
||||
}
|
||||
|
||||
/* Copied from g_bytes_hash() */
|
||||
static guint
|
||||
record_data_string_hash (gconstpointer _a)
|
||||
{
|
||||
const RecordDataString *a = _a;
|
||||
const signed char *p, *e;
|
||||
guint32 h = 5381;
|
||||
|
||||
for (p = (signed char *)a->string, e = (signed char *)a->string + a->len; p != e; p++)
|
||||
h = (h << 5) + h + *p;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
static int
|
||||
record_data_string_compare (gconstpointer _a,
|
||||
gconstpointer _b,
|
||||
gpointer user_data)
|
||||
{
|
||||
const RecordDataString *a = _a;
|
||||
const RecordDataString *b = _b;
|
||||
|
||||
return b->count - a->count;
|
||||
}
|
||||
|
||||
static RecordDataString *
|
||||
record_data_string_lookup (RecordData *data,
|
||||
const char *str,
|
||||
gssize len)
|
||||
{
|
||||
RecordDataString *s, tmp;
|
||||
gboolean include_len = len >= 0;
|
||||
|
||||
if (len < 0)
|
||||
len = strlen (str);
|
||||
|
||||
tmp.string = str;
|
||||
tmp.len = len;
|
||||
|
||||
s = g_hash_table_lookup (data->strings, &tmp);
|
||||
if (s)
|
||||
{
|
||||
s->count++;
|
||||
s->include_len |= include_len;
|
||||
return s;
|
||||
}
|
||||
|
||||
s = g_slice_new (RecordDataString);
|
||||
/* The string is zero terminated */
|
||||
s->string = g_string_chunk_insert_len (data->chunks, str, len);
|
||||
s->len = len;
|
||||
s->count = 1;
|
||||
s->include_len = include_len;
|
||||
s->link.data = s;
|
||||
s->link.next = NULL;
|
||||
s->link.prev = NULL;
|
||||
|
||||
g_hash_table_add (data->strings, s);
|
||||
g_queue_push_tail_link (&data->string_list, &s->link);
|
||||
return s;
|
||||
}
|
||||
|
||||
static void
|
||||
record_start_element (GMarkupParseContext *context,
|
||||
const char *element_name,
|
||||
@@ -131,21 +259,20 @@ record_start_element (GMarkupParseContext *context,
|
||||
{
|
||||
gsize n_attrs = g_strv_length ((char **)names);
|
||||
RecordData *data = user_data;
|
||||
RecordDataTree *child;
|
||||
RecordDataElement *child;
|
||||
RecordDataString *name, **attr_names, **attr_values;
|
||||
int i;
|
||||
|
||||
child = record_data_tree_new (data->current, RECORD_TYPE_ELEMENT,
|
||||
record_data_string_lookup (data->strings, element_name, -1));
|
||||
name = record_data_string_lookup (data, element_name, -1);
|
||||
child = record_data_element_new (data->current, name, n_attrs);
|
||||
data->current = child;
|
||||
|
||||
child->n_attributes = n_attrs;
|
||||
child->attributes = g_new (const char *, n_attrs);
|
||||
child->values = g_new (const char *, n_attrs);
|
||||
|
||||
attr_names = &child->attributes[0];
|
||||
attr_values = &child->attributes[n_attrs];
|
||||
for (i = 0; i < n_attrs; i++)
|
||||
{
|
||||
child->attributes[i] = record_data_string_lookup (data->strings, names[i], -1);
|
||||
child->values[i] = record_data_string_lookup (data->strings, values[i], -1);
|
||||
attr_names[i] = record_data_string_lookup (data, names[i], -1);
|
||||
attr_values[i] = record_data_string_lookup (data, values[i], -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +287,23 @@ record_end_element (GMarkupParseContext *context,
|
||||
data->current = data->current->parent;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_whitespace (const char *text,
|
||||
gsize text_len)
|
||||
{
|
||||
const char *end;
|
||||
const char *p;
|
||||
|
||||
end = text + text_len;
|
||||
for (p = text; p < end; p = g_utf8_next_char (p))
|
||||
{
|
||||
if (!g_unichar_isspace (g_utf8_get_char (p)))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
record_text (GMarkupParseContext *context,
|
||||
const char *text,
|
||||
@@ -168,9 +312,16 @@ record_text (GMarkupParseContext *context,
|
||||
GError **error)
|
||||
{
|
||||
RecordData *data = user_data;
|
||||
RecordDataString *string;
|
||||
|
||||
record_data_tree_new (data->current, RECORD_TYPE_TEXT,
|
||||
record_data_string_lookup (data->strings, text, text_len));
|
||||
if (text_len == 0)
|
||||
return;
|
||||
|
||||
if (!data->current->preserve_whitespace && is_whitespace (text, text_len))
|
||||
return;
|
||||
|
||||
string = record_data_string_lookup (data, text, text_len);
|
||||
record_data_element_append_text (data->current, string);
|
||||
}
|
||||
|
||||
static const GMarkupParser record_parser =
|
||||
@@ -182,16 +333,6 @@ static const GMarkupParser record_parser =
|
||||
NULL, // error, fails immediately
|
||||
};
|
||||
|
||||
static int
|
||||
compare_string (gconstpointer _a,
|
||||
gconstpointer _b)
|
||||
{
|
||||
const RecordDataString *a = _a;
|
||||
const RecordDataString *b = _b;
|
||||
|
||||
return b->count - a->count;
|
||||
}
|
||||
|
||||
static void
|
||||
marshal_uint32 (GString *str,
|
||||
guint32 v)
|
||||
@@ -240,54 +381,60 @@ marshal_uint32 (GString *str,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
marshal_string (GString *marshaled,
|
||||
GHashTable *strings,
|
||||
const char *string)
|
||||
static int
|
||||
marshal_uint32_len (guint32 v)
|
||||
{
|
||||
RecordDataString *s;
|
||||
if (v < 128)
|
||||
return 1;
|
||||
|
||||
s = g_hash_table_lookup (strings, string);
|
||||
g_assert (s != NULL);
|
||||
if (v < (1<<14))
|
||||
return 2;
|
||||
|
||||
marshal_uint32 (marshaled, s->offset);
|
||||
if (v < (1<<21))
|
||||
return 3;
|
||||
|
||||
if (v < (1<<28))
|
||||
return 4;
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
static void
|
||||
marshal_tree (GString *marshaled,
|
||||
GHashTable *strings,
|
||||
RecordDataTree *tree)
|
||||
RecordDataNode *node)
|
||||
{
|
||||
GList *l;
|
||||
int i;
|
||||
RecordDataText *text;
|
||||
RecordDataElement *element;
|
||||
RecordDataString **attr_names, **attr_values;
|
||||
|
||||
/* Special case the root */
|
||||
if (tree->parent == NULL)
|
||||
{
|
||||
for (l = g_list_last (tree->children); l != NULL; l = l->prev)
|
||||
marshal_tree (marshaled, strings, l->data);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (tree->type)
|
||||
switch (node->type)
|
||||
{
|
||||
case RECORD_TYPE_ELEMENT:
|
||||
element = (RecordDataElement *)node;
|
||||
|
||||
marshal_uint32 (marshaled, RECORD_TYPE_ELEMENT);
|
||||
marshal_string (marshaled, strings, tree->data);
|
||||
marshal_uint32 (marshaled, tree->n_attributes);
|
||||
for (i = 0; i < tree->n_attributes; i++)
|
||||
marshal_uint32 (marshaled, element->name->offset);
|
||||
marshal_uint32 (marshaled, element->n_attributes);
|
||||
|
||||
attr_names = &element->attributes[0];
|
||||
attr_values = &element->attributes[element->n_attributes];
|
||||
for (i = 0; i < element->n_attributes; i++)
|
||||
{
|
||||
marshal_string (marshaled, strings, tree->attributes[i]);
|
||||
marshal_string (marshaled, strings, tree->values[i]);
|
||||
marshal_uint32 (marshaled, attr_names[i]->offset);
|
||||
marshal_uint32 (marshaled, attr_values[i]->offset);
|
||||
}
|
||||
for (l = g_list_last (tree->children); l != NULL; l = l->prev)
|
||||
marshal_tree (marshaled, strings, l->data);
|
||||
|
||||
for (l = element->children.head; l != NULL; l = l->next)
|
||||
marshal_tree (marshaled, l->data);
|
||||
|
||||
marshal_uint32 (marshaled, RECORD_TYPE_END_ELEMENT);
|
||||
break;
|
||||
case RECORD_TYPE_TEXT:
|
||||
text = (RecordDataText *)node;
|
||||
marshal_uint32 (marshaled, RECORD_TYPE_TEXT);
|
||||
marshal_string (marshaled, strings, tree->data);
|
||||
marshal_uint32 (marshaled, text->string->text_offset);
|
||||
break;
|
||||
case RECORD_TYPE_END_ELEMENT:
|
||||
default:
|
||||
@@ -295,6 +442,17 @@ marshal_tree (GString *marshaled,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
marshal_root (GString *marshaled,
|
||||
RecordDataNode *node)
|
||||
{
|
||||
GList *l;
|
||||
RecordDataElement *element = (RecordDataElement *)node;
|
||||
|
||||
for (l = element->children.head; l != NULL; l = l->next)
|
||||
marshal_tree (marshaled, l->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_buildable_parser_precompile:
|
||||
* @text: chunk of text to parse
|
||||
@@ -313,20 +471,22 @@ _gtk_buildable_parser_precompile (const char *text,
|
||||
{
|
||||
GMarkupParseContext *ctx;
|
||||
RecordData data = { 0 };
|
||||
GList *string_table, *l;
|
||||
GList *l;
|
||||
GString *marshaled;
|
||||
int offset;
|
||||
|
||||
data.strings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify)record_data_string_free);
|
||||
data.root = record_data_tree_new (NULL, RECORD_TYPE_ELEMENT, NULL);
|
||||
data.strings = g_hash_table_new (record_data_string_hash, record_data_string_equal);
|
||||
data.chunks = g_string_chunk_new (512);
|
||||
data.root = record_data_element_new (NULL, NULL, 0);
|
||||
data.current = data.root;
|
||||
|
||||
ctx = g_markup_parse_context_new (&record_parser, G_MARKUP_TREAT_CDATA_AS_TEXT,
|
||||
&data, NULL);
|
||||
ctx = g_markup_parse_context_new (&record_parser, G_MARKUP_TREAT_CDATA_AS_TEXT, &data, NULL);
|
||||
|
||||
if (!g_markup_parse_context_parse (ctx, text, text_len, error))
|
||||
if (!g_markup_parse_context_parse (ctx, text, text_len, error) ||
|
||||
!g_markup_parse_context_end_parse (ctx, error))
|
||||
{
|
||||
record_data_tree_free (data.root);
|
||||
record_data_node_free (&data.root->base);
|
||||
g_string_chunk_free (data.chunks);
|
||||
g_hash_table_destroy (data.strings);
|
||||
g_markup_parse_context_free (ctx);
|
||||
return NULL;
|
||||
@@ -334,34 +494,45 @@ _gtk_buildable_parser_precompile (const char *text,
|
||||
|
||||
g_markup_parse_context_free (ctx);
|
||||
|
||||
string_table = g_hash_table_get_values (data.strings);
|
||||
|
||||
string_table = g_list_sort (string_table, compare_string);
|
||||
g_queue_sort (&data.string_list, record_data_string_compare, NULL);
|
||||
|
||||
offset = 0;
|
||||
for (l = string_table; l != NULL; l = l->next)
|
||||
for (l = data.string_list.head; l != NULL; l = l->next)
|
||||
{
|
||||
RecordDataString *s = l->data;
|
||||
|
||||
if (s->include_len)
|
||||
{
|
||||
s->text_offset = offset;
|
||||
offset += marshal_uint32_len (s->len);
|
||||
}
|
||||
|
||||
s->offset = offset;
|
||||
offset += strlen (s->string) + 1;
|
||||
offset += s->len + 1;
|
||||
}
|
||||
|
||||
marshaled = g_string_new ("");
|
||||
marshaled = g_string_sized_new (4 + offset + 32);
|
||||
/* Magic marker */
|
||||
g_string_append_len (marshaled, "GBU\0", 4);
|
||||
marshal_uint32 (marshaled, offset);
|
||||
|
||||
for (l = string_table; l != NULL; l = l->next)
|
||||
for (l = data.string_list.head; l != NULL; l = l->next)
|
||||
{
|
||||
RecordDataString *s = l->data;
|
||||
g_string_append_len (marshaled, s->string, strlen (s->string) + 1);
|
||||
|
||||
if (s->include_len)
|
||||
marshal_uint32 (marshaled, s->len);
|
||||
|
||||
g_string_append_len (marshaled, s->string, s->len + 1);
|
||||
}
|
||||
|
||||
g_list_free (string_table);
|
||||
marshal_root (marshaled, &data.root->base);
|
||||
|
||||
marshal_tree (marshaled, data.strings, data.root);
|
||||
|
||||
record_data_tree_free (data.root);
|
||||
g_slice_free_chain (RecordDataString,
|
||||
(RecordDataString *)data.string_list.head,
|
||||
link.next);
|
||||
record_data_node_free (&data.root->base);
|
||||
g_string_chunk_free (data.chunks);
|
||||
g_hash_table_destroy (data.strings);
|
||||
|
||||
return g_string_free_to_bytes (marshaled);
|
||||
@@ -412,6 +583,18 @@ demarshal_string (const char **tree,
|
||||
return strings + offset;
|
||||
}
|
||||
|
||||
static const char *
|
||||
demarshal_text (const char **tree,
|
||||
const char *strings,
|
||||
guint32 *len)
|
||||
{
|
||||
guint32 offset = demarshal_uint32 (tree);
|
||||
const char *str = strings + offset;
|
||||
|
||||
*len = demarshal_uint32 (&str);
|
||||
return str;
|
||||
}
|
||||
|
||||
static void
|
||||
propagate_error (GtkBuildableParseContext *context,
|
||||
GError **dest,
|
||||
@@ -489,14 +672,15 @@ replay_text (GtkBuildableParseContext *context,
|
||||
const char *strings,
|
||||
GError **error)
|
||||
{
|
||||
guint32 len;
|
||||
const char *text;
|
||||
GError *tmp_error = NULL;
|
||||
|
||||
text = demarshal_string (tree, strings);
|
||||
text = demarshal_text (tree, strings, &len);
|
||||
|
||||
(*context->internal_callbacks->text) (NULL,
|
||||
text,
|
||||
strlen (text),
|
||||
len,
|
||||
context,
|
||||
&tmp_error);
|
||||
|
||||
|
||||
@@ -296,6 +296,7 @@ gtk_color_button_init (GtkColorButton *button)
|
||||
"accessible-role", GTK_ACCESSIBLE_ROLE_IMG,
|
||||
"selectable", FALSE,
|
||||
"has-menu", FALSE,
|
||||
"can-drag", FALSE,
|
||||
NULL);
|
||||
gtk_widget_set_can_focus (button->swatch, FALSE);
|
||||
gtk_widget_remove_css_class (button->swatch, "activatable");
|
||||
|
||||
@@ -65,6 +65,7 @@ struct _GtkColorSwatch
|
||||
|
||||
GtkWidget *popover;
|
||||
GtkDropTarget *dest;
|
||||
GtkDragSource *source;
|
||||
};
|
||||
|
||||
struct _GtkColorSwatchClass
|
||||
@@ -81,7 +82,8 @@ enum
|
||||
PROP_RGBA,
|
||||
PROP_SELECTABLE,
|
||||
PROP_HAS_MENU,
|
||||
PROP_CAN_DROP
|
||||
PROP_CAN_DROP,
|
||||
PROP_CAN_DRAG
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkColorSwatch, gtk_color_swatch, GTK_TYPE_WIDGET)
|
||||
@@ -429,6 +431,9 @@ swatch_get_property (GObject *object,
|
||||
case PROP_CAN_DROP:
|
||||
g_value_set_boolean (value, swatch->dest != NULL);
|
||||
break;
|
||||
case PROP_CAN_DRAG:
|
||||
g_value_set_boolean (value, swatch->source != NULL);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -457,6 +462,9 @@ swatch_set_property (GObject *object,
|
||||
case PROP_CAN_DROP:
|
||||
gtk_color_swatch_set_can_drop (swatch, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_CAN_DRAG:
|
||||
gtk_color_swatch_set_can_drag (swatch, g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -470,7 +478,7 @@ swatch_finalize (GObject *object)
|
||||
|
||||
g_free (swatch->icon);
|
||||
gtk_widget_unparent (swatch->overlay_widget);
|
||||
|
||||
|
||||
G_OBJECT_CLASS (gtk_color_swatch_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -512,11 +520,14 @@ gtk_color_swatch_class_init (GtkColorSwatchClass *class)
|
||||
g_object_class_install_property (object_class, PROP_CAN_DROP,
|
||||
g_param_spec_boolean ("can-drop", P_("Can Drop"), P_("Whether the swatch should accept drops"),
|
||||
FALSE, GTK_PARAM_READWRITE));
|
||||
g_object_class_install_property (object_class, PROP_CAN_DRAG,
|
||||
g_param_spec_boolean ("can-drag", P_("Can Drag"), P_("Whether the swatch should allow drags"),
|
||||
TRUE, GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkColorSwatch|menu.popup:
|
||||
*
|
||||
* Opens the context menu.
|
||||
* Opens the context menu.
|
||||
*/
|
||||
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, swatch_popup_menu);
|
||||
|
||||
@@ -568,6 +579,8 @@ gtk_color_swatch_init (GtkColorSwatch *swatch)
|
||||
G_CALLBACK (key_controller_key_pressed), swatch);
|
||||
gtk_widget_add_controller (GTK_WIDGET (swatch), controller);
|
||||
|
||||
gtk_color_swatch_set_can_drag (swatch, TRUE);
|
||||
|
||||
gtk_widget_add_css_class (GTK_WIDGET (swatch), "activatable");
|
||||
|
||||
swatch->overlay_widget = g_object_new (GTK_TYPE_IMAGE,
|
||||
@@ -598,18 +611,10 @@ void
|
||||
gtk_color_swatch_set_rgba (GtkColorSwatch *swatch,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
if (!swatch->has_color)
|
||||
{
|
||||
GtkDragSource *source;
|
||||
|
||||
source = gtk_drag_source_new ();
|
||||
g_signal_connect (source, "prepare", G_CALLBACK (gtk_color_swatch_drag_prepare), swatch);
|
||||
|
||||
gtk_widget_add_controller (GTK_WIDGET (swatch), GTK_EVENT_CONTROLLER (source));
|
||||
}
|
||||
|
||||
swatch->has_color = TRUE;
|
||||
swatch->color = *color;
|
||||
if (swatch->source)
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (swatch->source), GTK_PHASE_CAPTURE);
|
||||
|
||||
if (INTENSITY (swatch->color.red, swatch->color.green, swatch->color.blue) > 0.5)
|
||||
{
|
||||
@@ -681,6 +686,30 @@ gtk_color_swatch_set_can_drop (GtkColorSwatch *swatch,
|
||||
g_object_notify (G_OBJECT (swatch), "can-drop");
|
||||
}
|
||||
|
||||
void
|
||||
gtk_color_swatch_set_can_drag (GtkColorSwatch *swatch,
|
||||
gboolean can_drag)
|
||||
{
|
||||
if (can_drag == (swatch->source != NULL))
|
||||
return;
|
||||
|
||||
if (can_drag && !swatch->source)
|
||||
{
|
||||
swatch->source = gtk_drag_source_new ();
|
||||
g_signal_connect (swatch->source, "prepare", G_CALLBACK (gtk_color_swatch_drag_prepare), swatch);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (swatch->source),
|
||||
swatch->has_color ? GTK_PHASE_CAPTURE : GTK_PHASE_NONE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (swatch), GTK_EVENT_CONTROLLER (swatch->source));
|
||||
}
|
||||
if (!can_drag && swatch->source)
|
||||
{
|
||||
gtk_widget_remove_controller (GTK_WIDGET (swatch), GTK_EVENT_CONTROLLER (swatch->source));
|
||||
swatch->source = NULL;
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (swatch), "can-drag");
|
||||
}
|
||||
|
||||
void
|
||||
gtk_color_swatch_set_use_alpha (GtkColorSwatch *swatch,
|
||||
gboolean use_alpha)
|
||||
|
||||
@@ -42,6 +42,8 @@ void gtk_color_swatch_set_hsva (GtkColorSwatch *swatch,
|
||||
double a);
|
||||
void gtk_color_swatch_set_can_drop (GtkColorSwatch *swatch,
|
||||
gboolean can_drop);
|
||||
void gtk_color_swatch_set_can_drag (GtkColorSwatch *swatch,
|
||||
gboolean can_drag);
|
||||
void gtk_color_swatch_set_icon (GtkColorSwatch *swatch,
|
||||
const char *icon);
|
||||
void gtk_color_swatch_set_use_alpha (GtkColorSwatch *swatch,
|
||||
|
||||
@@ -386,6 +386,7 @@ gtk_drag_icon_class_init (GtkDragIconClass *klass)
|
||||
static void
|
||||
gtk_drag_icon_init (GtkDragIcon *self)
|
||||
{
|
||||
gtk_widget_set_can_target (GTK_WIDGET (self), FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -531,15 +532,38 @@ gtk_drag_icon_create_widget_for_value (const GValue *value)
|
||||
{
|
||||
return gtk_label_new (g_value_get_string (value));
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_PAINTABLE))
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
||||
image = gtk_image_new_from_paintable (g_value_get_object (value));
|
||||
gtk_widget_add_css_class (image, "large-icons");
|
||||
|
||||
return image;
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_RGBA))
|
||||
{
|
||||
GtkWidget *swatch;
|
||||
|
||||
swatch = gtk_color_swatch_new ();
|
||||
gtk_color_swatch_set_can_drag (GTK_COLOR_SWATCH (swatch), FALSE);
|
||||
gtk_color_swatch_set_can_drop (GTK_COLOR_SWATCH (swatch), FALSE);
|
||||
gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (swatch), g_value_get_boxed (value));
|
||||
|
||||
return swatch;
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, G_TYPE_FILE))
|
||||
{
|
||||
GFileInfo *info;
|
||||
GtkWidget *image;
|
||||
|
||||
info = g_file_query_info (G_FILE (g_value_get_object (value)), "standard::icon", 0, NULL, NULL);
|
||||
image = gtk_image_new_from_gicon (g_file_info_get_icon (info));
|
||||
gtk_widget_add_css_class (image, "large-icons");
|
||||
g_object_unref (info);
|
||||
|
||||
return image;
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, GTK_TYPE_TEXT_BUFFER))
|
||||
{
|
||||
GtkTextBuffer *buffer = g_value_get_object (value);
|
||||
@@ -568,7 +592,7 @@ gtk_drag_icon_create_widget_for_value (const GValue *value)
|
||||
node = gsk_value_get_render_node (value);
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
gsk_render_node_get_bounds (node, &bounds);
|
||||
paintable = gtk_render_node_paintable_new (node, &bounds);
|
||||
image = gtk_image_new_from_paintable (paintable);
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
* GDK_TYPE_PIXBUF,
|
||||
* }, 2);
|
||||
*
|
||||
* g_signal_connect (target, "drop", G_CALLBACK (on_drop), self);
|
||||
* gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (target));
|
||||
* }
|
||||
* ```
|
||||
@@ -303,7 +304,7 @@ gtk_drop_target_load (GtkDropTarget *self)
|
||||
|
||||
self->cancellable = g_cancellable_new ();
|
||||
|
||||
gdk_drop_read_value_async (self->drop,
|
||||
gdk_drop_read_value_async (self->drop,
|
||||
type,
|
||||
G_PRIORITY_DEFAULT,
|
||||
self->cancellable,
|
||||
@@ -355,13 +356,13 @@ make_action_unique (GdkDragAction actions)
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
|
||||
if (actions & GDK_ACTION_LINK)
|
||||
return GDK_ACTION_LINK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static GdkDragAction
|
||||
gtk_drop_target_enter (GtkDropTarget *self,
|
||||
double x,
|
||||
@@ -370,7 +371,7 @@ gtk_drop_target_enter (GtkDropTarget *self,
|
||||
return make_action_unique (self->actions & gdk_drop_get_actions (self->drop));
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
static GdkDragAction
|
||||
gtk_drop_target_motion (GtkDropTarget *self,
|
||||
double x,
|
||||
double y)
|
||||
@@ -900,7 +901,7 @@ GdkContentFormats *
|
||||
gtk_drop_target_get_formats (GtkDropTarget *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_DROP_TARGET (self), NULL);
|
||||
|
||||
|
||||
return self->formats;
|
||||
}
|
||||
|
||||
@@ -929,7 +930,7 @@ gtk_drop_target_set_gtypes (GtkDropTarget *self,
|
||||
builder = gdk_content_formats_builder_new ();
|
||||
for (i = 0; i < n_types; i++)
|
||||
gdk_content_formats_builder_add_gtype (builder, types[i]);
|
||||
|
||||
|
||||
self->formats = gdk_content_formats_builder_free_to_formats (builder);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FORMATS]);
|
||||
@@ -970,7 +971,7 @@ gtk_drop_target_set_actions (GtkDropTarget *self,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_DROP_TARGET (self));
|
||||
|
||||
|
||||
if (self->actions == actions)
|
||||
return;
|
||||
|
||||
@@ -1007,7 +1008,7 @@ gtk_drop_target_set_preload (GtkDropTarget *self,
|
||||
gboolean preload)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_DROP_TARGET (self));
|
||||
|
||||
|
||||
if (self->preload == preload)
|
||||
return;
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
*
|
||||
* `GtkBuilder` has support for creating expressions. The syntax here can be used where
|
||||
* a `GtkExpression` object is needed like in a `<property>` tag for an expression
|
||||
* property, or in a `<binding>` tag to bind a property to an expression.
|
||||
* property, or in a `<binding name="property">` tag to bind a property to an expression.
|
||||
*
|
||||
* To create an property expression, use the `<lookup>` element. It can have a `type`
|
||||
* attribute to specify the object type, and a `name` attribute to specify the property
|
||||
|
||||
@@ -305,7 +305,7 @@ static void
|
||||
quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
|
||||
{
|
||||
GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (context);
|
||||
GtkWidget* surface_widget = GTK_WIDGET (gdk_surface_get_widget (qc->client_surface));
|
||||
GtkWidget* surface_widget;
|
||||
int sx, sy;
|
||||
double wx, wy;
|
||||
|
||||
@@ -317,6 +317,11 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
|
||||
if (!qc->focused)
|
||||
return;
|
||||
|
||||
surface_widget = GTK_WIDGET (gdk_surface_get_widget (qc->client_surface));
|
||||
|
||||
if (!surface_widget)
|
||||
return;
|
||||
|
||||
gdk_surface_get_origin (qc->client_surface, &sx, &sy);
|
||||
gtk_widget_translate_coordinates(qc->client_widget, surface_widget,
|
||||
area->x, area->y, &wx, &wy);
|
||||
|
||||
@@ -286,7 +286,7 @@ gtk_menu_tracker_item_update_visibility (GtkMenuTrackerItem *self)
|
||||
if (visible != self->is_visible)
|
||||
{
|
||||
self->is_visible = visible;
|
||||
g_object_notify (G_OBJECT (self), "is-visible");
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_IS_VISIBLE]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,9 +300,17 @@ gtk_menu_tracker_item_action_added (GtkActionObserver *observer,
|
||||
{
|
||||
GtkMenuTrackerItem *self = GTK_MENU_TRACKER_ITEM (observer);
|
||||
GVariant *action_target;
|
||||
gboolean old_sensitive;
|
||||
gboolean old_toggled;
|
||||
GtkMenuTrackerItemRole old_role;
|
||||
guint n_changed;
|
||||
|
||||
GTK_NOTE(ACTIONS, g_message ("menutracker: action %s added", action_name));
|
||||
|
||||
old_sensitive = self->sensitive;
|
||||
old_toggled = self->toggled;
|
||||
old_role = self->role;
|
||||
|
||||
action_target = g_menu_item_get_attribute_value (self->item, G_MENU_ATTRIBUTE_TARGET, NULL);
|
||||
|
||||
self->can_activate = (action_target == NULL && parameter_type == NULL) ||
|
||||
@@ -340,18 +348,29 @@ gtk_menu_tracker_item_action_added (GtkActionObserver *observer,
|
||||
self->role = GTK_MENU_TRACKER_ITEM_ROLE_CHECK;
|
||||
}
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (self));
|
||||
/* Avoid freeze/thaw_notify as they are quite expensive in runtime/memory
|
||||
* unless we have more than one property to update. Additionally, only
|
||||
* notify on properties that have changed to avoid extraneous signal
|
||||
* emission. This code can get run a lot!
|
||||
*/
|
||||
n_changed = (old_role != self->role)
|
||||
+ (old_toggled != self->toggled)
|
||||
+ (old_sensitive != self->sensitive);
|
||||
|
||||
if (self->sensitive)
|
||||
if (n_changed > 1)
|
||||
g_object_freeze_notify (G_OBJECT (self));
|
||||
|
||||
if (self->sensitive != old_sensitive)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_SENSITIVE]);
|
||||
|
||||
if (self->toggled)
|
||||
if (self->toggled != old_toggled)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_TOGGLED]);
|
||||
|
||||
if (self->role != GTK_MENU_TRACKER_ITEM_ROLE_NORMAL)
|
||||
if (self->role != old_role)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_ROLE]);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (self));
|
||||
if (n_changed > 1)
|
||||
g_object_thaw_notify (G_OBJECT (self));
|
||||
|
||||
if (action_target)
|
||||
g_variant_unref (action_target);
|
||||
|
||||
@@ -178,7 +178,8 @@ gtk_picture_measure (GtkWidget *widget,
|
||||
double min_width, min_height, nat_width, nat_height;
|
||||
double default_size;
|
||||
|
||||
if (self->paintable == NULL)
|
||||
/* for_size = 0 below is treated as -1, but we want to return zeros. */
|
||||
if (self->paintable == NULL || for_size == 0)
|
||||
{
|
||||
*minimum = 0;
|
||||
*natural = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* gtkprintoperation-unix.c: Print Operation Details for Unix
|
||||
* gtkprintoperation-unix.c: Print Operation Details for Unix
|
||||
* and Unix-like platforms
|
||||
* Copyright (C) 2006, Red Hat, Inc.
|
||||
*
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <glib/gstdio.h>
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
GtkWindow *parent; /* just in case we need to throw error dialogs */
|
||||
GMainLoop *loop;
|
||||
@@ -56,7 +56,7 @@ typedef struct
|
||||
cairo_surface_t *surface;
|
||||
gulong job_status_changed_tag;
|
||||
|
||||
|
||||
|
||||
} GtkPrintOperationUnix;
|
||||
|
||||
typedef struct _PrinterFinder PrinterFinder;
|
||||
@@ -71,18 +71,18 @@ unix_start_page (GtkPrintOperation *op,
|
||||
GtkPrintContext *print_context,
|
||||
GtkPageSetup *page_setup)
|
||||
{
|
||||
GtkPrintOperationUnix *op_unix;
|
||||
GtkPrintOperationUnix *op_unix;
|
||||
GtkPaperSize *paper_size;
|
||||
cairo_surface_type_t type;
|
||||
double w, h;
|
||||
|
||||
op_unix = op->priv->platform_data;
|
||||
|
||||
|
||||
paper_size = gtk_page_setup_get_paper_size (page_setup);
|
||||
|
||||
w = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
|
||||
h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
|
||||
|
||||
|
||||
type = cairo_surface_get_type (op_unix->surface);
|
||||
|
||||
if ((op->priv->manual_number_up < 2) ||
|
||||
@@ -167,11 +167,11 @@ shell_command_substitute_file (const char *cmd,
|
||||
*settings_filename_replaced = FALSE;
|
||||
|
||||
start = inptr = cmd;
|
||||
while ((inptr = strchr (inptr, '%')) != NULL)
|
||||
while ((inptr = strchr (inptr, '%')) != NULL)
|
||||
{
|
||||
g_string_append_len (final, start, inptr - start);
|
||||
inptr++;
|
||||
switch (*inptr)
|
||||
switch (*inptr)
|
||||
{
|
||||
case 'f':
|
||||
g_string_append (final, pdf_filename);
|
||||
@@ -236,11 +236,11 @@ gtk_print_operation_unix_launch_preview (GtkPrintOperation *op,
|
||||
display = gdk_display_get_default ();
|
||||
|
||||
fd = g_file_open_tmp ("settingsXXXXXX.ini", &settings_filename, &error);
|
||||
if (fd < 0)
|
||||
if (fd < 0)
|
||||
goto out;
|
||||
|
||||
key_file = g_key_file_new ();
|
||||
|
||||
|
||||
print_settings = gtk_print_settings_copy (gtk_print_operation_get_print_settings (op));
|
||||
|
||||
if (print_settings != NULL)
|
||||
@@ -345,7 +345,7 @@ gtk_print_operation_unix_launch_preview (GtkPrintOperation *op,
|
||||
|
||||
static void
|
||||
unix_finish_send (GtkPrintJob *job,
|
||||
gpointer user_data,
|
||||
gpointer user_data,
|
||||
const GError *error)
|
||||
{
|
||||
GtkPrintOperation *op = (GtkPrintOperation *) user_data;
|
||||
@@ -370,19 +370,19 @@ unix_end_run (GtkPrintOperation *op,
|
||||
GtkPrintOperationUnix *op_unix = op->priv->platform_data;
|
||||
|
||||
cairo_surface_finish (op_unix->surface);
|
||||
|
||||
|
||||
if (cancelled)
|
||||
return;
|
||||
|
||||
if (wait)
|
||||
op_unix->loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
|
||||
/* TODO: Check for error */
|
||||
if (op_unix->job != NULL)
|
||||
{
|
||||
g_object_ref (op);
|
||||
gtk_print_job_send (op_unix->job,
|
||||
unix_finish_send,
|
||||
unix_finish_send,
|
||||
op, NULL);
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ unix_end_run (GtkPrintOperation *op,
|
||||
}
|
||||
|
||||
static void
|
||||
job_status_changed_cb (GtkPrintJob *job,
|
||||
job_status_changed_cb (GtkPrintJob *job,
|
||||
GtkPrintOperation *op)
|
||||
{
|
||||
_gtk_print_operation_set_status (op, gtk_print_job_get_status (job), NULL);
|
||||
@@ -406,7 +406,7 @@ job_status_changed_cb (GtkPrintJob *job,
|
||||
|
||||
|
||||
static void
|
||||
print_setup_changed_cb (GtkPrintUnixDialog *print_dialog,
|
||||
print_setup_changed_cb (GtkPrintUnixDialog *print_dialog,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -450,13 +450,13 @@ get_print_dialog (GtkPrintOperation *op,
|
||||
priv->print_settings);
|
||||
|
||||
if (priv->default_page_setup)
|
||||
gtk_print_unix_dialog_set_page_setup (GTK_PRINT_UNIX_DIALOG (pd),
|
||||
gtk_print_unix_dialog_set_page_setup (GTK_PRINT_UNIX_DIALOG (pd),
|
||||
priv->default_page_setup);
|
||||
|
||||
gtk_print_unix_dialog_set_embed_page_setup (GTK_PRINT_UNIX_DIALOG (pd),
|
||||
priv->embed_page_setup);
|
||||
|
||||
gtk_print_unix_dialog_set_current_page (GTK_PRINT_UNIX_DIALOG (pd),
|
||||
gtk_print_unix_dialog_set_current_page (GTK_PRINT_UNIX_DIALOG (pd),
|
||||
priv->current_page);
|
||||
|
||||
gtk_print_unix_dialog_set_support_selection (GTK_PRINT_UNIX_DIALOG (pd),
|
||||
@@ -468,10 +468,10 @@ get_print_dialog (GtkPrintOperation *op,
|
||||
g_signal_emit_by_name (op, "create-custom-widget",
|
||||
&priv->custom_widget);
|
||||
|
||||
if (priv->custom_widget)
|
||||
if (priv->custom_widget)
|
||||
{
|
||||
custom_tab_label = priv->custom_tab_label;
|
||||
|
||||
|
||||
if (custom_tab_label == NULL)
|
||||
{
|
||||
custom_tab_label = g_get_application_name ();
|
||||
@@ -480,18 +480,18 @@ get_print_dialog (GtkPrintOperation *op,
|
||||
}
|
||||
|
||||
label = gtk_label_new (custom_tab_label);
|
||||
|
||||
|
||||
gtk_print_unix_dialog_add_custom_tab (GTK_PRINT_UNIX_DIALOG (pd),
|
||||
priv->custom_widget, label);
|
||||
|
||||
g_signal_connect (pd, "notify::selected-printer", (GCallback) print_setup_changed_cb, op);
|
||||
g_signal_connect (pd, "notify::page-setup", (GCallback) print_setup_changed_cb, op);
|
||||
}
|
||||
|
||||
|
||||
return pd;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkPrintOperation *op;
|
||||
gboolean do_print;
|
||||
@@ -523,7 +523,7 @@ finish_print (PrintResponseData *rdata,
|
||||
GtkPrintOperationPrivate *priv = op->priv;
|
||||
GtkPrintJob *job;
|
||||
double top, bottom, left, right;
|
||||
|
||||
|
||||
if (rdata->do_print)
|
||||
{
|
||||
gtk_print_operation_set_print_settings (op, settings);
|
||||
@@ -555,38 +555,38 @@ finish_print (PrintResponseData *rdata,
|
||||
{
|
||||
GtkPrintOperationUnix *op_unix;
|
||||
cairo_t *cr;
|
||||
|
||||
|
||||
op_unix = g_new0 (GtkPrintOperationUnix, 1);
|
||||
priv->platform_data = op_unix;
|
||||
priv->free_platform_data = (GDestroyNotify) op_unix_free;
|
||||
op_unix->parent = rdata->parent;
|
||||
|
||||
|
||||
priv->start_page = unix_start_page;
|
||||
priv->end_page = unix_end_page;
|
||||
priv->end_run = unix_end_run;
|
||||
|
||||
|
||||
job = gtk_print_job_new (priv->job_name, printer, settings, page_setup);
|
||||
op_unix->job = job;
|
||||
gtk_print_job_set_track_print_status (job, priv->track_print_status);
|
||||
|
||||
|
||||
op_unix->surface = gtk_print_job_get_surface (job, &priv->error);
|
||||
if (op_unix->surface == NULL)
|
||||
if (op_unix->surface == NULL)
|
||||
{
|
||||
rdata->result = GTK_PRINT_OPERATION_RESULT_ERROR;
|
||||
rdata->do_print = FALSE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
cr = cairo_create (op_unix->surface);
|
||||
gtk_print_context_set_cairo_context (priv->print_context, cr, 72, 72);
|
||||
cairo_destroy (cr);
|
||||
|
||||
_gtk_print_operation_set_status (op, gtk_print_job_get_status (job), NULL);
|
||||
|
||||
|
||||
op_unix->job_status_changed_tag =
|
||||
g_signal_connect (job, "status-changed",
|
||||
G_CALLBACK (job_status_changed_cb), op);
|
||||
|
||||
|
||||
priv->print_pages = gtk_print_job_get_pages (job);
|
||||
priv->page_ranges = gtk_print_job_get_page_ranges (job, &priv->num_page_ranges);
|
||||
priv->manual_num_copies = gtk_print_job_get_num_copies (job);
|
||||
@@ -598,16 +598,16 @@ finish_print (PrintResponseData *rdata,
|
||||
priv->manual_number_up = gtk_print_job_get_n_up (job);
|
||||
priv->manual_number_up_layout = gtk_print_job_get_n_up_layout (job);
|
||||
}
|
||||
}
|
||||
}
|
||||
out:
|
||||
if (rdata->print_cb)
|
||||
rdata->print_cb (op, rdata->parent, rdata->do_print, rdata->result);
|
||||
rdata->print_cb (op, rdata->parent, rdata->do_print, rdata->result);
|
||||
|
||||
if (rdata->destroy)
|
||||
rdata->destroy (rdata);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
handle_print_response (GtkWidget *dialog,
|
||||
int response,
|
||||
gpointer data)
|
||||
@@ -627,7 +627,7 @@ handle_print_response (GtkWidget *dialog,
|
||||
rdata->do_preview = FALSE;
|
||||
if (printer != NULL)
|
||||
rdata->do_print = TRUE;
|
||||
}
|
||||
}
|
||||
else if (response == GTK_RESPONSE_APPLY)
|
||||
{
|
||||
/* print preview */
|
||||
@@ -650,15 +650,15 @@ handle_print_response (GtkWidget *dialog,
|
||||
gtk_print_operation_set_print_settings (rdata->op, settings);
|
||||
g_signal_emit_by_name (rdata->op, "custom-widget-apply", rdata->op->priv->custom_widget);
|
||||
}
|
||||
|
||||
|
||||
if (rdata->loop)
|
||||
g_main_loop_quit (rdata->loop);
|
||||
|
||||
|
||||
finish_print (rdata, printer, page_setup, settings, page_setup_set);
|
||||
|
||||
if (settings)
|
||||
g_object_unref (settings);
|
||||
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (pd));
|
||||
}
|
||||
|
||||
@@ -675,7 +675,7 @@ found_printer (GtkPrinter *printer,
|
||||
if (rdata->loop)
|
||||
g_main_loop_quit (rdata->loop);
|
||||
|
||||
if (printer != NULL)
|
||||
if (printer != NULL)
|
||||
{
|
||||
rdata->result = GTK_PRINT_OPERATION_RESULT_APPLY;
|
||||
|
||||
@@ -688,18 +688,18 @@ found_printer (GtkPrinter *printer,
|
||||
|
||||
gtk_print_settings_set_printer (settings,
|
||||
gtk_printer_get_name (printer));
|
||||
|
||||
|
||||
if (priv->default_page_setup)
|
||||
page_setup = gtk_page_setup_copy (priv->default_page_setup);
|
||||
else
|
||||
page_setup = gtk_page_setup_new ();
|
||||
}
|
||||
|
||||
|
||||
finish_print (rdata, printer, page_setup, settings, FALSE);
|
||||
|
||||
if (settings)
|
||||
g_object_unref (settings);
|
||||
|
||||
|
||||
if (page_setup)
|
||||
g_object_unref (page_setup);
|
||||
}
|
||||
@@ -723,13 +723,13 @@ gtk_print_operation_unix_run_dialog_async (GtkPrintOperation *op,
|
||||
rdata->parent = parent;
|
||||
rdata->loop = NULL;
|
||||
rdata->destroy = print_response_data_free;
|
||||
|
||||
|
||||
if (show_dialog)
|
||||
{
|
||||
pd = get_print_dialog (op, parent);
|
||||
gtk_window_set_modal (GTK_WINDOW (pd), TRUE);
|
||||
|
||||
g_signal_connect (pd, "response",
|
||||
g_signal_connect (pd, "response",
|
||||
G_CALLBACK (handle_print_response), rdata);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (pd));
|
||||
@@ -739,7 +739,7 @@ gtk_print_operation_unix_run_dialog_async (GtkPrintOperation *op,
|
||||
printer_name = NULL;
|
||||
if (op->priv->print_settings)
|
||||
printer_name = gtk_print_settings_get_printer (op->priv->print_settings);
|
||||
|
||||
|
||||
find_printer (printer_name, (GFunc) found_printer, rdata);
|
||||
}
|
||||
}
|
||||
@@ -751,8 +751,8 @@ write_preview (void *closure,
|
||||
{
|
||||
int fd = GPOINTER_TO_INT (closure);
|
||||
gssize written;
|
||||
|
||||
while (length > 0)
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
written = write (fd, data, length);
|
||||
|
||||
@@ -760,9 +760,9 @@ write_preview (void *closure,
|
||||
{
|
||||
if (errno == EAGAIN || errno == EINTR)
|
||||
continue;
|
||||
|
||||
|
||||
return CAIRO_STATUS_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
data += written;
|
||||
length -= written;
|
||||
@@ -792,7 +792,7 @@ gtk_print_operation_unix_create_preview_surface (GtkPrintOperation *op,
|
||||
double w, h;
|
||||
cairo_surface_t *surface;
|
||||
static cairo_user_data_key_t key;
|
||||
|
||||
|
||||
filename = g_build_filename (g_get_tmp_dir (), "previewXXXXXX.pdf", NULL);
|
||||
fd = g_mkstemp (filename);
|
||||
|
||||
@@ -803,14 +803,14 @@ gtk_print_operation_unix_create_preview_surface (GtkPrintOperation *op,
|
||||
}
|
||||
|
||||
*target = filename;
|
||||
|
||||
|
||||
paper_size = gtk_page_setup_get_paper_size (page_setup);
|
||||
w = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
|
||||
h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
|
||||
|
||||
|
||||
*dpi_x = *dpi_y = 72;
|
||||
surface = cairo_pdf_surface_create_for_stream (write_preview, GINT_TO_POINTER (fd), w, h);
|
||||
|
||||
|
||||
cairo_surface_set_user_data (surface, &key, GINT_TO_POINTER (fd), close_preview);
|
||||
|
||||
return surface;
|
||||
@@ -837,7 +837,7 @@ gtk_print_operation_unix_resize_preview_surface (GtkPrintOperation *op,
|
||||
cairo_surface_t *surface)
|
||||
{
|
||||
double w, h;
|
||||
|
||||
|
||||
w = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
|
||||
h = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
|
||||
cairo_pdf_surface_set_size (surface, w, h);
|
||||
@@ -852,7 +852,7 @@ gtk_print_operation_unix_run_dialog (GtkPrintOperation *op,
|
||||
GtkWidget *pd;
|
||||
PrintResponseData rdata;
|
||||
const char *printer_name;
|
||||
|
||||
|
||||
rdata.op = op;
|
||||
rdata.do_print = FALSE;
|
||||
rdata.do_preview = FALSE;
|
||||
@@ -867,7 +867,7 @@ gtk_print_operation_unix_run_dialog (GtkPrintOperation *op,
|
||||
pd = get_print_dialog (op, parent);
|
||||
gtk_window_set_modal (GTK_WINDOW (pd), TRUE);
|
||||
|
||||
g_signal_connect (pd, "response",
|
||||
g_signal_connect (pd, "response",
|
||||
G_CALLBACK (handle_print_response), &rdata);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (pd));
|
||||
@@ -882,7 +882,7 @@ gtk_print_operation_unix_run_dialog (GtkPrintOperation *op,
|
||||
printer_name = NULL;
|
||||
if (op->priv->print_settings)
|
||||
printer_name = gtk_print_settings_get_printer (op->priv->print_settings);
|
||||
|
||||
|
||||
rdata.loop = g_main_loop_new (NULL, FALSE);
|
||||
find_printer (printer_name,
|
||||
(GFunc) found_printer, &rdata);
|
||||
@@ -893,12 +893,12 @@ gtk_print_operation_unix_run_dialog (GtkPrintOperation *op,
|
||||
}
|
||||
|
||||
*do_print = rdata.do_print;
|
||||
|
||||
|
||||
return rdata.result;
|
||||
}
|
||||
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
GtkPageSetup *page_setup;
|
||||
GtkPageSetupDoneFunc done_cb;
|
||||
@@ -967,13 +967,13 @@ get_page_setup_dialog (GtkWindow *parent,
|
||||
*
|
||||
* Runs a page setup dialog, letting the user modify the values from
|
||||
* @page_setup. If the user cancels the dialog, the returned `GtkPageSetup`
|
||||
* is identical to the passed in @page_setup, otherwise it contains the
|
||||
* is identical to the passed in @page_setup, otherwise it contains the
|
||||
* modifications done in the dialog.
|
||||
*
|
||||
* Note that this function may use a recursive mainloop to show the page
|
||||
* setup dialog. See gtk_print_run_page_setup_dialog_async() if this is
|
||||
* setup dialog. See gtk_print_run_page_setup_dialog_async() if this is
|
||||
* a problem.
|
||||
*
|
||||
*
|
||||
* Returns: (transfer full): a new `GtkPageSetup`
|
||||
*/
|
||||
GtkPageSetup *
|
||||
@@ -982,8 +982,8 @@ gtk_print_run_page_setup_dialog (GtkWindow *parent,
|
||||
GtkPrintSettings *settings)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
PageSetupResponseData rdata;
|
||||
|
||||
PageSetupResponseData rdata;
|
||||
|
||||
rdata.page_setup = NULL;
|
||||
rdata.done_cb = NULL;
|
||||
rdata.data = NULL;
|
||||
@@ -997,7 +997,7 @@ gtk_print_run_page_setup_dialog (GtkWindow *parent,
|
||||
&rdata);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
|
||||
|
||||
g_main_loop_run (rdata.loop);
|
||||
g_main_loop_unref (rdata.loop);
|
||||
rdata.loop = NULL;
|
||||
@@ -1034,10 +1034,10 @@ gtk_print_run_page_setup_dialog_async (GtkWindow *parent,
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
PageSetupResponseData *rdata;
|
||||
|
||||
|
||||
dialog = get_page_setup_dialog (parent, page_setup, settings);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
|
||||
|
||||
rdata = g_new (PageSetupResponseData, 1);
|
||||
rdata->page_setup = NULL;
|
||||
rdata->done_cb = done_cb;
|
||||
@@ -1051,7 +1051,7 @@ gtk_print_run_page_setup_dialog_async (GtkWindow *parent,
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
struct _PrinterFinder
|
||||
struct _PrinterFinder
|
||||
{
|
||||
gboolean found_printer;
|
||||
GFunc func;
|
||||
@@ -1087,8 +1087,8 @@ find_printer_idle (gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
printer_added_cb (GtkPrintBackend *backend,
|
||||
GtkPrinter *printer,
|
||||
printer_added_cb (GtkPrintBackend *backend,
|
||||
GtkPrinter *printer,
|
||||
PrinterFinder *finder)
|
||||
{
|
||||
if (finder->found_printer)
|
||||
@@ -1112,26 +1112,28 @@ printer_added_cb (GtkPrintBackend *backend,
|
||||
finder->found_printer = TRUE;
|
||||
}
|
||||
else
|
||||
if (finder->first_printer == NULL)
|
||||
finder->first_printer = g_object_ref (printer);
|
||||
|
||||
{
|
||||
if (finder->first_printer == NULL)
|
||||
finder->first_printer = g_object_ref (printer);
|
||||
}
|
||||
|
||||
if (finder->found_printer)
|
||||
g_idle_add (find_printer_idle, finder);
|
||||
}
|
||||
|
||||
static void
|
||||
printer_list_done_cb (GtkPrintBackend *backend,
|
||||
printer_list_done_cb (GtkPrintBackend *backend,
|
||||
PrinterFinder *finder)
|
||||
{
|
||||
finder->backends = g_list_remove (finder->backends, backend);
|
||||
|
||||
|
||||
g_signal_handlers_disconnect_by_func (backend, printer_added_cb, finder);
|
||||
g_signal_handlers_disconnect_by_func (backend, printer_list_done_cb, finder);
|
||||
|
||||
|
||||
gtk_print_backend_destroy (backend);
|
||||
g_object_unref (backend);
|
||||
|
||||
if (finder->backends == NULL && !finder->found_printer)
|
||||
if (finder->backends == NULL)
|
||||
g_idle_add (find_printer_idle, finder);
|
||||
}
|
||||
|
||||
@@ -1164,11 +1166,11 @@ find_printer_init (PrinterFinder *finder,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_signal_connect (backend, "printer-added",
|
||||
(GCallback) printer_added_cb,
|
||||
g_signal_connect (backend, "printer-added",
|
||||
(GCallback) printer_added_cb,
|
||||
finder);
|
||||
g_signal_connect (backend, "printer-list-done",
|
||||
(GCallback) printer_list_done_cb,
|
||||
g_signal_connect (backend, "printer-list-done",
|
||||
(GCallback) printer_list_done_cb,
|
||||
finder);
|
||||
}
|
||||
|
||||
@@ -1178,15 +1180,15 @@ static void
|
||||
printer_finder_free (PrinterFinder *finder)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
|
||||
g_free (finder->printer_name);
|
||||
|
||||
|
||||
if (finder->printer)
|
||||
g_object_unref (finder->printer);
|
||||
|
||||
|
||||
if (finder->default_printer)
|
||||
g_object_unref (finder->default_printer);
|
||||
|
||||
|
||||
if (finder->first_printer)
|
||||
g_object_unref (finder->first_printer);
|
||||
|
||||
@@ -1198,9 +1200,9 @@ printer_finder_free (PrinterFinder *finder)
|
||||
gtk_print_backend_destroy (backend);
|
||||
g_object_unref (backend);
|
||||
}
|
||||
|
||||
|
||||
g_list_free (finder->backends);
|
||||
|
||||
|
||||
g_free (finder);
|
||||
}
|
||||
|
||||
@@ -1228,10 +1230,8 @@ find_printer (const char *printer,
|
||||
find_printer_init (finder, GTK_PRINT_BACKEND (node->data));
|
||||
}
|
||||
|
||||
if (finder->backends == NULL && !finder->found_printer)
|
||||
if (finder->backends == NULL)
|
||||
g_idle_add (find_printer_idle, finder);
|
||||
else
|
||||
printer_finder_free (finder);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ struct _GtkTextBTree {
|
||||
int end_iter_segment_char_offset;
|
||||
guint end_iter_line_stamp;
|
||||
guint end_iter_segment_stamp;
|
||||
|
||||
|
||||
GHashTable *child_anchor_table;
|
||||
};
|
||||
|
||||
@@ -415,7 +415,7 @@ _gtk_text_btree_new (GtkTextTagTable *table,
|
||||
tree->end_iter_line = NULL;
|
||||
tree->end_iter_segment_byte_index = 0;
|
||||
tree->end_iter_segment_char_offset = 0;
|
||||
|
||||
|
||||
g_object_ref (tree->table);
|
||||
|
||||
tree->tag_changed_handler = g_signal_connect (tree->table,
|
||||
@@ -425,7 +425,7 @@ _gtk_text_btree_new (GtkTextTagTable *table,
|
||||
|
||||
tree->mark_table = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
tree->child_anchor_table = NULL;
|
||||
|
||||
|
||||
/* We don't ref the buffer, since the buffer owns us;
|
||||
* we'd have some circularity issues. The buffer always
|
||||
* lasts longer than the BTree
|
||||
@@ -489,20 +489,20 @@ _gtk_text_btree_unref (GtkTextBTree *tree)
|
||||
tree->refcount -= 1;
|
||||
|
||||
if (tree->refcount == 0)
|
||||
{
|
||||
{
|
||||
g_signal_handler_disconnect (tree->table,
|
||||
tree->tag_changed_handler);
|
||||
|
||||
g_object_unref (tree->table);
|
||||
tree->table = NULL;
|
||||
|
||||
|
||||
gtk_text_btree_node_destroy (tree, tree->root_node);
|
||||
tree->root_node = NULL;
|
||||
|
||||
|
||||
g_assert (g_hash_table_size (tree->mark_table) == 0);
|
||||
g_hash_table_destroy (tree->mark_table);
|
||||
tree->mark_table = NULL;
|
||||
if (tree->child_anchor_table != NULL)
|
||||
if (tree->child_anchor_table != NULL)
|
||||
{
|
||||
g_hash_table_destroy (tree->child_anchor_table);
|
||||
tree->child_anchor_table = NULL;
|
||||
@@ -568,7 +568,7 @@ gtk_text_btree_resolve_bidi (GtkTextIter *start,
|
||||
start_line_prev = _gtk_text_line_previous (start_line);
|
||||
end_line = _gtk_text_iter_get_text_line (end);
|
||||
end_line_next = _gtk_text_line_next (end_line);
|
||||
|
||||
|
||||
line = start_line;
|
||||
while (line && line != end_line_next)
|
||||
{
|
||||
@@ -576,7 +576,7 @@ gtk_text_btree_resolve_bidi (GtkTextIter *start,
|
||||
*/
|
||||
GtkTextLineSegment *seg = line->segments;
|
||||
line->dir_strong = PANGO_DIRECTION_NEUTRAL;
|
||||
|
||||
|
||||
while (seg)
|
||||
{
|
||||
if (seg->type == >k_text_char_type && seg->byte_count > 0)
|
||||
@@ -584,7 +584,7 @@ gtk_text_btree_resolve_bidi (GtkTextIter *start,
|
||||
PangoDirection pango_dir;
|
||||
|
||||
pango_dir = gdk_find_base_dir (seg->body.chars, seg->byte_count);
|
||||
|
||||
|
||||
if (pango_dir != PANGO_DIRECTION_NEUTRAL)
|
||||
{
|
||||
line->dir_strong = pango_dir;
|
||||
@@ -607,7 +607,7 @@ gtk_text_btree_resolve_bidi (GtkTextIter *start,
|
||||
if (start_line_prev)
|
||||
dir_above_propagated = start_line_prev->dir_propagated_forward;
|
||||
|
||||
/* Loop forward and propagate the direction of each paragraph
|
||||
/* Loop forward and propagate the direction of each paragraph
|
||||
* to all neutral lines.
|
||||
*/
|
||||
line = start_line;
|
||||
@@ -616,9 +616,9 @@ gtk_text_btree_resolve_bidi (GtkTextIter *start,
|
||||
{
|
||||
if (line->dir_strong != PANGO_DIRECTION_NEUTRAL)
|
||||
last_strong = line->dir_strong;
|
||||
|
||||
|
||||
line->dir_propagated_forward = last_strong;
|
||||
|
||||
|
||||
line = _gtk_text_line_next (line);
|
||||
}
|
||||
|
||||
@@ -627,14 +627,14 @@ gtk_text_btree_resolve_bidi (GtkTextIter *start,
|
||||
*/
|
||||
{
|
||||
GtkTextIter end_propagate;
|
||||
|
||||
|
||||
while (line &&
|
||||
line->dir_strong == PANGO_DIRECTION_NEUTRAL &&
|
||||
line->dir_propagated_forward != last_strong)
|
||||
{
|
||||
GtkTextLine *prev = line;
|
||||
line->dir_propagated_forward = last_strong;
|
||||
|
||||
|
||||
line = _gtk_text_line_next(line);
|
||||
if (!line)
|
||||
{
|
||||
@@ -654,7 +654,7 @@ gtk_text_btree_resolve_bidi (GtkTextIter *start,
|
||||
_gtk_text_btree_get_iter_at_line (tree, &end_propagate, line, 0);
|
||||
_gtk_text_btree_invalidate_region (tree, end, &end_propagate, FALSE);
|
||||
}
|
||||
|
||||
|
||||
/* Sweep backward */
|
||||
|
||||
/* The variable dir_below_propagated contains the backward propagated
|
||||
@@ -665,7 +665,7 @@ gtk_text_btree_resolve_bidi (GtkTextIter *start,
|
||||
if (end_line_next)
|
||||
dir_below_propagated = end_line_next->dir_propagated_back;
|
||||
|
||||
/* Loop backward and propagate the direction of each paragraph
|
||||
/* Loop backward and propagate the direction of each paragraph
|
||||
* to all neutral lines.
|
||||
*/
|
||||
line = end_line;
|
||||
@@ -929,7 +929,7 @@ _gtk_text_btree_delete (GtkTextIter *start,
|
||||
BTreeView *view;
|
||||
GtkTextBTreeNode *ancestor_node;
|
||||
GtkTextLine *prevline;
|
||||
int chars_moved;
|
||||
int chars_moved;
|
||||
|
||||
/* last_seg was appended to start_line up at the top of this function */
|
||||
chars_moved = 0;
|
||||
@@ -948,7 +948,7 @@ _gtk_text_btree_delete (GtkTextIter *start,
|
||||
{
|
||||
node->num_chars += chars_moved;
|
||||
}
|
||||
|
||||
|
||||
curnode = end_line->parent;
|
||||
for (node = curnode; node != NULL;
|
||||
node = node->parent)
|
||||
@@ -1004,7 +1004,7 @@ _gtk_text_btree_delete (GtkTextIter *start,
|
||||
if (deleted_width > 0 || deleted_height > 0)
|
||||
{
|
||||
ld = _gtk_text_line_get_data (start_line, view->view_id);
|
||||
|
||||
|
||||
if (ld == NULL)
|
||||
{
|
||||
/* This means that start_line has never been validated.
|
||||
@@ -1018,7 +1018,7 @@ _gtk_text_btree_delete (GtkTextIter *start,
|
||||
ld->height = 0;
|
||||
ld->valid = FALSE;
|
||||
}
|
||||
|
||||
|
||||
ld->width = MAX (deleted_width, ld->width);
|
||||
ld->height += deleted_height;
|
||||
ld->valid = FALSE;
|
||||
@@ -1043,7 +1043,7 @@ _gtk_text_btree_delete (GtkTextIter *start,
|
||||
|
||||
/* avoid dangling pointer */
|
||||
deleted_lines = NULL;
|
||||
|
||||
|
||||
gtk_text_btree_rebalance (tree, curnode);
|
||||
}
|
||||
|
||||
@@ -1116,7 +1116,7 @@ _gtk_text_btree_insert (GtkTextIter *iter,
|
||||
/* extract iterator info */
|
||||
tree = _gtk_text_iter_get_btree (iter);
|
||||
line = _gtk_text_iter_get_text_line (iter);
|
||||
|
||||
|
||||
start_line = line;
|
||||
start_byte_index = gtk_text_iter_get_line_index (iter);
|
||||
|
||||
@@ -1131,7 +1131,7 @@ _gtk_text_btree_insert (GtkTextIter *iter,
|
||||
/* Invalidate all iterators */
|
||||
chars_changed (tree);
|
||||
segments_changed (tree);
|
||||
|
||||
|
||||
/*
|
||||
* Chop the text up into lines and create a new segment for
|
||||
* each line, plus a new line for the leftovers from the
|
||||
@@ -1145,11 +1145,11 @@ _gtk_text_btree_insert (GtkTextIter *iter,
|
||||
while (eol < len)
|
||||
{
|
||||
sol = eol;
|
||||
|
||||
|
||||
pango_find_paragraph_boundary (text + sol,
|
||||
len - sol,
|
||||
&delim,
|
||||
&eol);
|
||||
&eol);
|
||||
|
||||
/* make these relative to the start of the text */
|
||||
delim += sol;
|
||||
@@ -1160,7 +1160,7 @@ _gtk_text_btree_insert (GtkTextIter *iter,
|
||||
g_assert (eol >= delim);
|
||||
g_assert (sol >= 0);
|
||||
g_assert (eol <= len);
|
||||
|
||||
|
||||
chunk_len = eol - sol;
|
||||
|
||||
g_assert (g_utf8_validate (&text[sol], chunk_len, NULL));
|
||||
@@ -1285,13 +1285,13 @@ insert_paintable_or_widget_segment (GtkTextIter *iter,
|
||||
DV (g_print ("invalidating due to inserting paintable/widget (%s)\n", G_STRLOC));
|
||||
_gtk_text_btree_invalidate_region (tree, &start, iter, FALSE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_gtk_text_btree_insert_paintable (GtkTextIter *iter,
|
||||
GdkPaintable *paintable)
|
||||
{
|
||||
GtkTextLineSegment *seg;
|
||||
|
||||
|
||||
seg = _gtk_paintable_segment_new (paintable);
|
||||
seg->body.paintable.tree = _gtk_text_iter_get_btree (iter);
|
||||
seg->body.paintable.line = _gtk_text_iter_get_text_line (iter);
|
||||
@@ -1311,12 +1311,12 @@ _gtk_text_btree_insert_child_anchor (GtkTextIter *iter,
|
||||
g_warning (G_STRLOC": Same child anchor can't be inserted twice");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
seg = _gtk_widget_segment_new (anchor);
|
||||
|
||||
tree = seg->body.child.tree = _gtk_text_iter_get_btree (iter);
|
||||
seg->body.child.line = _gtk_text_iter_get_text_line (iter);
|
||||
|
||||
|
||||
insert_paintable_or_widget_segment (iter, seg);
|
||||
|
||||
if (tree->child_anchor_table == NULL)
|
||||
@@ -1333,7 +1333,7 @@ _gtk_text_btree_unregister_child_anchor (GtkTextChildAnchor *anchor)
|
||||
GtkTextLineSegment *seg;
|
||||
|
||||
seg = anchor->segment;
|
||||
|
||||
|
||||
g_hash_table_remove (seg->body.child.tree->child_anchor_table,
|
||||
anchor);
|
||||
}
|
||||
@@ -1538,7 +1538,7 @@ _gtk_text_btree_add_view (GtkTextBTree *tree,
|
||||
GtkTextLineData *line_data;
|
||||
|
||||
g_return_if_fail (tree != NULL);
|
||||
|
||||
|
||||
view = g_slice_new (BTreeView);
|
||||
|
||||
view->view_id = layout;
|
||||
@@ -1552,7 +1552,7 @@ _gtk_text_btree_add_view (GtkTextBTree *tree,
|
||||
g_assert (tree->views->prev == NULL);
|
||||
tree->views->prev = view;
|
||||
}
|
||||
|
||||
|
||||
tree->views = view;
|
||||
|
||||
/* The last line in the buffer has identity values for the per-view
|
||||
@@ -1580,7 +1580,7 @@ _gtk_text_btree_remove_view (GtkTextBTree *tree,
|
||||
GtkTextLineData *line_data;
|
||||
|
||||
g_return_if_fail (tree != NULL);
|
||||
|
||||
|
||||
view = tree->views;
|
||||
|
||||
while (view != NULL)
|
||||
@@ -1673,7 +1673,7 @@ iter_stack_new (void)
|
||||
}
|
||||
|
||||
static void
|
||||
iter_stack_push (IterStack *stack,
|
||||
iter_stack_push (IterStack *stack,
|
||||
const GtkTextIter *iter)
|
||||
{
|
||||
stack->count += 1;
|
||||
@@ -1687,7 +1687,7 @@ iter_stack_push (IterStack *stack,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
iter_stack_pop (IterStack *stack,
|
||||
iter_stack_pop (IterStack *stack,
|
||||
GtkTextIter *iter)
|
||||
{
|
||||
if (stack->count == 0)
|
||||
@@ -1771,7 +1771,7 @@ _gtk_text_btree_tag (const GtkTextIter *start_orig,
|
||||
g_return_if_fail (_gtk_text_iter_get_btree (start_orig) ==
|
||||
_gtk_text_iter_get_btree (end_orig));
|
||||
g_return_if_fail (tag->priv->table == _gtk_text_iter_get_btree (start_orig)->table);
|
||||
|
||||
|
||||
#if 0
|
||||
printf ("%s tag %s from %d to %d\n",
|
||||
add ? "Adding" : "Removing",
|
||||
@@ -1885,7 +1885,7 @@ _gtk_text_btree_tag (const GtkTextIter *start_orig,
|
||||
g_assert (seg != NULL);
|
||||
g_assert (indexable_seg != NULL);
|
||||
g_assert (seg != indexable_seg);
|
||||
|
||||
|
||||
if ( (seg->type == >k_text_toggle_on_type ||
|
||||
seg->type == >k_text_toggle_off_type) &&
|
||||
(seg->body.toggle.info == info) )
|
||||
@@ -2026,7 +2026,7 @@ get_line_internal (GtkTextBTree *tree,
|
||||
line_count = _gtk_text_btree_line_count (tree);
|
||||
if (!include_last)
|
||||
line_count -= 1;
|
||||
|
||||
|
||||
if (line_number < 0)
|
||||
{
|
||||
line_number = line_count;
|
||||
@@ -2387,7 +2387,7 @@ copy_segment (GString *string,
|
||||
{
|
||||
gboolean copy = TRUE;
|
||||
if (!include_nonchars &&
|
||||
g_strcmp0 (_gtk_text_unknown_char_utf8, seg->body.child.obj->chars) == 0)
|
||||
g_strcmp0 (_gtk_text_unknown_char_utf8, gtk_text_child_anchor_get_replacement (seg->body.child.obj)) == 0)
|
||||
{
|
||||
copy = FALSE;
|
||||
}
|
||||
@@ -2400,7 +2400,7 @@ copy_segment (GString *string,
|
||||
if (copy)
|
||||
{
|
||||
g_string_append_len (string,
|
||||
seg->body.child.obj->chars,
|
||||
gtk_text_child_anchor_get_replacement (seg->body.child.obj),
|
||||
seg->byte_count);
|
||||
}
|
||||
}
|
||||
@@ -2741,7 +2741,7 @@ real_set_mark (GtkTextBTree *tree,
|
||||
/* OK if !should_exist and it does already exist, in that case
|
||||
* we just move it.
|
||||
*/
|
||||
|
||||
|
||||
iter = *where;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
@@ -2948,7 +2948,7 @@ _gtk_text_btree_release_mark_segment (GtkTextBTree *tree,
|
||||
|
||||
segment->body.mark.tree = NULL;
|
||||
segment->body.mark.line = NULL;
|
||||
|
||||
|
||||
/* Remove the ref on the mark, which frees segment as a side effect
|
||||
* if this is the last reference.
|
||||
*/
|
||||
@@ -2974,7 +2974,7 @@ _gtk_text_btree_remove_mark (GtkTextBTree *tree,
|
||||
|
||||
/* This calls cleanup_line and segments_changed */
|
||||
gtk_text_btree_unlink_segment (tree, segment, segment->body.mark.line);
|
||||
|
||||
|
||||
_gtk_text_btree_release_mark_segment (tree, segment);
|
||||
}
|
||||
|
||||
@@ -3420,12 +3420,12 @@ ensure_end_iter_line (GtkTextBTree *tree)
|
||||
if (tree->end_iter_line_stamp != tree->chars_changed_stamp)
|
||||
{
|
||||
int real_line;
|
||||
|
||||
|
||||
/* n_lines is without the magic line at the end */
|
||||
g_assert (_gtk_text_btree_line_count (tree) >= 1);
|
||||
|
||||
tree->end_iter_line = _gtk_text_btree_get_line_no_last (tree, -1, &real_line);
|
||||
|
||||
|
||||
tree->end_iter_line_stamp = tree->chars_changed_stamp;
|
||||
}
|
||||
}
|
||||
@@ -3441,7 +3441,7 @@ ensure_end_iter_segment (GtkTextBTree *tree)
|
||||
ensure_end_iter_line (tree);
|
||||
|
||||
last_with_chars = NULL;
|
||||
|
||||
|
||||
seg = tree->end_iter_line->segments;
|
||||
while (seg != NULL)
|
||||
{
|
||||
@@ -3456,7 +3456,7 @@ ensure_end_iter_segment (GtkTextBTree *tree)
|
||||
/* We know the last char in the last line is '\n' */
|
||||
tree->end_iter_segment_byte_index = last_with_chars->byte_count - 1;
|
||||
tree->end_iter_segment_char_offset = last_with_chars->char_count - 1;
|
||||
|
||||
|
||||
tree->end_iter_segment_stamp = tree->segments_changed_stamp;
|
||||
|
||||
g_assert (tree->end_iter_segment->type == >k_text_char_type);
|
||||
@@ -3481,7 +3481,7 @@ _gtk_text_btree_is_end (GtkTextBTree *tree,
|
||||
int char_offset)
|
||||
{
|
||||
g_return_val_if_fail (byte_index >= 0 || char_offset >= 0, FALSE);
|
||||
|
||||
|
||||
/* Do this first to avoid walking segments in most cases */
|
||||
if (!_gtk_text_line_contains_end_iter (line, tree))
|
||||
return FALSE;
|
||||
@@ -3536,7 +3536,7 @@ GtkTextLine*
|
||||
_gtk_text_line_next_excluding_last (GtkTextLine *line)
|
||||
{
|
||||
GtkTextLine *next;
|
||||
|
||||
|
||||
next = _gtk_text_line_next (line);
|
||||
|
||||
/* If we were on the end iter line, we can't go to
|
||||
@@ -3708,9 +3708,9 @@ _gtk_text_line_invalidate_wrap (GtkTextLine *line,
|
||||
is less than the max width for the parent node,
|
||||
and the case where the height is unchanged when we re-wrap.
|
||||
*/
|
||||
|
||||
|
||||
g_return_if_fail (ld != NULL);
|
||||
|
||||
|
||||
ld->valid = FALSE;
|
||||
gtk_text_btree_node_invalidate_upward (line->parent, ld->view_id);
|
||||
}
|
||||
@@ -4075,7 +4075,7 @@ _gtk_text_line_char_locate (GtkTextLine *line,
|
||||
|
||||
g_return_val_if_fail (line != NULL, FALSE);
|
||||
g_return_val_if_fail (char_offset >= 0, FALSE);
|
||||
|
||||
|
||||
*segment = NULL;
|
||||
*any_segment = NULL;
|
||||
chars_in_line = 0;
|
||||
@@ -4216,7 +4216,7 @@ _gtk_text_line_char_to_byte_offsets (GtkTextLine *line,
|
||||
|
||||
/* if in the last fourth of the segment walk backwards */
|
||||
if (seg->char_count - offset < seg->char_count / 4)
|
||||
p = g_utf8_offset_to_pointer (seg->body.chars + seg->byte_count,
|
||||
p = g_utf8_offset_to_pointer (seg->body.chars + seg->byte_count,
|
||||
offset - seg->char_count);
|
||||
else
|
||||
p = g_utf8_offset_to_pointer (seg->body.chars, offset);
|
||||
@@ -4357,7 +4357,7 @@ _gtk_text_line_next_could_contain_tag (GtkTextLine *line,
|
||||
/* Our tag summaries only have node precision, not line
|
||||
* precision. This means that if any line under a node could contain a
|
||||
* tag, then any of the others could also contain a tag.
|
||||
*
|
||||
*
|
||||
* In the future we could have some mechanism to keep track of how
|
||||
* many toggles we've found under a node so far, since we have a
|
||||
* count of toggles under the node. But for now I'm going with KISS.
|
||||
@@ -4828,7 +4828,7 @@ node_data_new (gpointer view_id,
|
||||
NodeData *next)
|
||||
{
|
||||
NodeData *nd;
|
||||
|
||||
|
||||
nd = g_slice_new (NodeData);
|
||||
|
||||
nd->view_id = view_id;
|
||||
@@ -4853,7 +4853,7 @@ node_data_list_destroy (NodeData *nd)
|
||||
}
|
||||
|
||||
static inline NodeData*
|
||||
node_data_find (NodeData *nd,
|
||||
node_data_find (NodeData *nd,
|
||||
gpointer view_id)
|
||||
{
|
||||
while (nd != NULL)
|
||||
@@ -5439,7 +5439,7 @@ _gtk_text_btree_validate_line (GtkTextBTree *tree,
|
||||
|
||||
view = gtk_text_btree_get_view (tree, view_id);
|
||||
g_return_if_fail (view != NULL);
|
||||
|
||||
|
||||
ld = _gtk_text_line_get_data (line, view_id);
|
||||
if (!ld || !ld->valid)
|
||||
{
|
||||
@@ -6208,7 +6208,7 @@ recompute_node_counts (GtkTextBTree *tree, GtkTextBTreeNode *node)
|
||||
gtk_text_btree_node_check_valid (node, view->view_id);
|
||||
view = view->next;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Scan through the GtkTextBTreeNode’s tag records again and delete any Summary
|
||||
* records that still have a zero count, or that have all the toggles.
|
||||
@@ -6617,7 +6617,7 @@ gtk_text_btree_node_view_check_consistency (GtkTextBTree *tree,
|
||||
int height;
|
||||
gboolean valid;
|
||||
BTreeView *view;
|
||||
|
||||
|
||||
view = tree->views;
|
||||
|
||||
while (view != NULL)
|
||||
@@ -6631,7 +6631,7 @@ gtk_text_btree_node_view_check_consistency (GtkTextBTree *tree,
|
||||
if (view == NULL)
|
||||
g_error ("Node has data for a view %p no longer attached to the tree",
|
||||
nd->view_id);
|
||||
|
||||
|
||||
gtk_text_btree_node_compute_view_aggregates (node, nd->view_id,
|
||||
&width, &height, &valid);
|
||||
|
||||
@@ -6644,7 +6644,7 @@ gtk_text_btree_node_view_check_consistency (GtkTextBTree *tree,
|
||||
* invalid - we don’t guarantee that if the node is invalid there
|
||||
* are invalid lines.
|
||||
*/
|
||||
|
||||
|
||||
if (nd->width != width ||
|
||||
nd->height != height ||
|
||||
(nd->valid && !valid))
|
||||
@@ -7142,7 +7142,7 @@ _gtk_text_btree_spew_line_short (GtkTextLine *line, int indent)
|
||||
}
|
||||
else if (seg->type == >k_text_child_type)
|
||||
{
|
||||
char *str = g_strndup (seg->body.child.obj->chars, seg->byte_count);
|
||||
char *str = g_strndup (gtk_text_child_anchor_get_replacement (seg->body.child.obj), seg->byte_count);
|
||||
printf ("%s child '%s'...\n", spaces, str);
|
||||
g_free (str);
|
||||
}
|
||||
@@ -7250,7 +7250,7 @@ _gtk_text_btree_spew_segment (GtkTextBTree* tree, GtkTextLineSegment * seg)
|
||||
}
|
||||
else if (seg->type == >k_text_child_type)
|
||||
{
|
||||
char *str = g_strndup (seg->body.child.obj->chars, seg->byte_count);
|
||||
char *str = g_strndup (gtk_text_child_anchor_get_replacement (seg->body.child.obj), seg->byte_count);
|
||||
printf (" '%s'\n", str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,12 @@
|
||||
#include "gtktextlayoutprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
typedef struct {
|
||||
char *replacement;
|
||||
} GtkTextChildAnchorPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkTextChildAnchor, gtk_text_child_anchor, G_TYPE_OBJECT)
|
||||
|
||||
#define CHECK_IN_BUFFER(anchor) \
|
||||
G_STMT_START { \
|
||||
if ((anchor)->segment == NULL) \
|
||||
@@ -232,7 +238,7 @@ child_segment_delete_func (GtkTextLineSegment *seg,
|
||||
GSList *copy;
|
||||
|
||||
_gtk_text_btree_unregister_child_anchor (seg->body.child.obj);
|
||||
|
||||
|
||||
seg->body.child.tree = NULL;
|
||||
seg->body.child.line = NULL;
|
||||
|
||||
@@ -254,9 +260,9 @@ child_segment_delete_func (GtkTextLineSegment *seg,
|
||||
g_assert (seg->body.child.widgets == NULL);
|
||||
|
||||
g_slist_free (copy);
|
||||
|
||||
_gtk_widget_segment_unref (seg);
|
||||
|
||||
|
||||
_gtk_widget_segment_unref (seg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -291,6 +297,7 @@ _gtk_widget_segment_new (GtkTextChildAnchor *anchor)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
GtkTextLineSegment *seg;
|
||||
GtkTextChildAnchorPrivate *priv = gtk_text_child_anchor_get_instance_private (anchor);
|
||||
|
||||
seg = g_slice_alloc (WIDGET_SEG_SIZE);
|
||||
|
||||
@@ -298,8 +305,8 @@ _gtk_widget_segment_new (GtkTextChildAnchor *anchor)
|
||||
|
||||
seg->next = NULL;
|
||||
|
||||
seg->byte_count = strlen (anchor->chars);
|
||||
seg->char_count = g_utf8_strlen (anchor->chars, seg->byte_count);
|
||||
seg->byte_count = strlen (priv->replacement);
|
||||
seg->char_count = g_utf8_strlen (priv->replacement, seg->byte_count);
|
||||
|
||||
seg->body.child.obj = anchor;
|
||||
seg->body.child.obj->segment = seg;
|
||||
@@ -308,7 +315,7 @@ _gtk_widget_segment_new (GtkTextChildAnchor *anchor)
|
||||
seg->body.child.line = NULL;
|
||||
|
||||
g_object_ref (anchor);
|
||||
|
||||
|
||||
return seg;
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
@@ -321,7 +328,7 @@ _gtk_widget_segment_add (GtkTextLineSegment *widget_segment,
|
||||
g_return_if_fail (widget_segment->body.child.tree != NULL);
|
||||
|
||||
g_object_ref (child);
|
||||
|
||||
|
||||
widget_segment->body.child.widgets =
|
||||
g_slist_prepend (widget_segment->body.child.widgets,
|
||||
child);
|
||||
@@ -332,7 +339,7 @@ _gtk_widget_segment_remove (GtkTextLineSegment *widget_segment,
|
||||
GtkWidget *child)
|
||||
{
|
||||
g_return_if_fail (widget_segment->type == >k_text_child_type);
|
||||
|
||||
|
||||
widget_segment->body.child.widgets =
|
||||
g_slist_remove (widget_segment->body.child.widgets,
|
||||
child);
|
||||
@@ -359,7 +366,7 @@ _gtk_widget_segment_unref (GtkTextLineSegment *widget_segment)
|
||||
GtkTextLayout*
|
||||
_gtk_anchored_child_get_layout (GtkWidget *child)
|
||||
{
|
||||
return g_object_get_data (G_OBJECT (child), "gtk-text-child-anchor-layout");
|
||||
return g_object_get_data (G_OBJECT (child), "gtk-text-child-anchor-layout");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -368,12 +375,10 @@ _gtk_anchored_child_set_layout (GtkWidget *child,
|
||||
{
|
||||
g_object_set_data (G_OBJECT (child),
|
||||
I_("gtk-text-child-anchor-layout"),
|
||||
layout);
|
||||
layout);
|
||||
}
|
||||
|
||||
static void gtk_text_child_anchor_finalize (GObject *obj);
|
||||
|
||||
G_DEFINE_TYPE (GtkTextChildAnchor, gtk_text_child_anchor, G_TYPE_OBJECT)
|
||||
static void gtk_text_child_anchor_finalize (GObject *obj);
|
||||
|
||||
static void
|
||||
gtk_text_child_anchor_init (GtkTextChildAnchor *child_anchor)
|
||||
@@ -391,14 +396,14 @@ gtk_text_child_anchor_class_init (GtkTextChildAnchorClass *klass)
|
||||
|
||||
/**
|
||||
* gtk_text_child_anchor_new:
|
||||
*
|
||||
*
|
||||
* Creates a new `GtkTextChildAnchor`.
|
||||
*
|
||||
* Usually you would then insert it into a `GtkTextBuffer` with
|
||||
* [method@Gtk.TextBuffer.insert_child_anchor]. To perform the
|
||||
* creation and insertion in one step, use the convenience
|
||||
* function [method@Gtk.TextBuffer.create_child_anchor].
|
||||
*
|
||||
*
|
||||
* Returns: a new `GtkTextChildAnchor`
|
||||
**/
|
||||
GtkTextChildAnchor*
|
||||
@@ -416,28 +421,34 @@ gtk_text_child_anchor_new (void)
|
||||
* [method@Gtk.TextBuffer.insert_child_anchor].
|
||||
*
|
||||
* Returns: a new `GtkTextChildAnchor`
|
||||
*
|
||||
* Since: 4.6
|
||||
**/
|
||||
GtkTextChildAnchor *
|
||||
gtk_text_child_anchor_new_with_replacement (const char *replacement_character)
|
||||
{
|
||||
GtkTextChildAnchor *anchor;
|
||||
GtkTextChildAnchorPrivate *priv;
|
||||
|
||||
/* only a single character can be set as replacement */
|
||||
g_return_val_if_fail (g_utf8_strlen (replacement_character, -1) == 1, NULL);
|
||||
|
||||
GtkTextChildAnchor *anchor = g_object_new (GTK_TYPE_TEXT_CHILD_ANCHOR, NULL);
|
||||
anchor->chars = g_strdup (replacement_character);
|
||||
anchor = g_object_new (GTK_TYPE_TEXT_CHILD_ANCHOR, NULL);
|
||||
|
||||
priv = gtk_text_child_anchor_get_instance_private (anchor);
|
||||
|
||||
priv->replacement = g_strdup (replacement_character);
|
||||
|
||||
return anchor;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_child_anchor_finalize (GObject *obj)
|
||||
{
|
||||
GtkTextChildAnchor *anchor;
|
||||
GtkTextLineSegment *seg;
|
||||
|
||||
anchor = GTK_TEXT_CHILD_ANCHOR (obj);
|
||||
GtkTextChildAnchor *anchor = GTK_TEXT_CHILD_ANCHOR (obj);
|
||||
GtkTextChildAnchorPrivate *priv = gtk_text_child_anchor_get_instance_private (anchor);
|
||||
GtkTextLineSegment *seg = anchor->segment;
|
||||
|
||||
seg = anchor->segment;
|
||||
|
||||
if (seg)
|
||||
{
|
||||
if (seg->body.child.tree != NULL)
|
||||
@@ -453,7 +464,7 @@ gtk_text_child_anchor_finalize (GObject *obj)
|
||||
g_slice_free1 (WIDGET_SEG_SIZE, seg);
|
||||
}
|
||||
|
||||
anchor->segment = NULL;
|
||||
g_free (priv->replacement);
|
||||
|
||||
G_OBJECT_CLASS (gtk_text_child_anchor_parent_class)->finalize (obj);
|
||||
}
|
||||
@@ -462,7 +473,7 @@ gtk_text_child_anchor_finalize (GObject *obj)
|
||||
* gtk_text_child_anchor_get_widgets:
|
||||
* @anchor: a `GtkTextChildAnchor`
|
||||
* @out_len: (out): return location for the length of the array
|
||||
*
|
||||
*
|
||||
* Gets a list of all widgets anchored at this child anchor.
|
||||
*
|
||||
* The order in which the widgets are returned is not defined.
|
||||
@@ -527,7 +538,7 @@ gtk_text_child_anchor_get_deleted (GtkTextChildAnchor *anchor)
|
||||
GtkTextLineSegment *seg = anchor->segment;
|
||||
|
||||
CHECK_IN_BUFFER_RETURN (anchor, TRUE);
|
||||
|
||||
|
||||
g_return_val_if_fail (seg->type == >k_text_child_type, TRUE);
|
||||
|
||||
return seg->body.child.tree == NULL;
|
||||
@@ -542,9 +553,9 @@ gtk_text_child_anchor_register_child (GtkTextChildAnchor *anchor,
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
CHECK_IN_BUFFER (anchor);
|
||||
|
||||
|
||||
_gtk_anchored_child_set_layout (child, layout);
|
||||
|
||||
|
||||
_gtk_widget_segment_add (anchor->segment, child);
|
||||
|
||||
gtk_text_child_anchor_queue_resize (anchor, layout);
|
||||
@@ -558,15 +569,15 @@ gtk_text_child_anchor_unregister_child (GtkTextChildAnchor *anchor,
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
CHECK_IN_BUFFER (anchor);
|
||||
|
||||
|
||||
if (_gtk_anchored_child_get_layout (child))
|
||||
{
|
||||
gtk_text_child_anchor_queue_resize (anchor,
|
||||
_gtk_anchored_child_get_layout (child));
|
||||
}
|
||||
|
||||
|
||||
_gtk_anchored_child_set_layout (child, NULL);
|
||||
|
||||
|
||||
_gtk_widget_segment_remove (anchor->segment, child);
|
||||
}
|
||||
|
||||
@@ -577,22 +588,22 @@ gtk_text_child_anchor_queue_resize (GtkTextChildAnchor *anchor,
|
||||
GtkTextIter start;
|
||||
GtkTextIter end;
|
||||
GtkTextLineSegment *seg;
|
||||
|
||||
|
||||
g_return_if_fail (GTK_IS_TEXT_CHILD_ANCHOR (anchor));
|
||||
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
|
||||
|
||||
CHECK_IN_BUFFER (anchor);
|
||||
|
||||
|
||||
seg = anchor->segment;
|
||||
|
||||
if (seg->body.child.tree == NULL)
|
||||
return;
|
||||
|
||||
|
||||
gtk_text_buffer_get_iter_at_child_anchor (layout->buffer,
|
||||
&start, anchor);
|
||||
end = start;
|
||||
gtk_text_iter_forward_char (&end);
|
||||
|
||||
|
||||
gtk_text_layout_invalidate (layout, &start, &end);
|
||||
}
|
||||
|
||||
@@ -602,6 +613,14 @@ gtk_text_anchored_child_set_layout (GtkWidget *child,
|
||||
{
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
g_return_if_fail (layout == NULL || GTK_IS_TEXT_LAYOUT (layout));
|
||||
|
||||
|
||||
_gtk_anchored_child_set_layout (child, layout);
|
||||
}
|
||||
|
||||
const char *
|
||||
gtk_text_child_anchor_get_replacement (GtkTextChildAnchor *anchor)
|
||||
{
|
||||
GtkTextChildAnchorPrivate *priv = gtk_text_child_anchor_get_instance_private (anchor);
|
||||
|
||||
return priv->replacement;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ struct _GtkTextChildAnchor
|
||||
|
||||
/*< private >*/
|
||||
gpointer segment;
|
||||
char *chars; /* replacement character */
|
||||
};
|
||||
|
||||
struct _GtkTextChildAnchorClass
|
||||
|
||||
@@ -85,6 +85,8 @@ void _gtk_widget_segment_unref (GtkTextLineSegment *widget_seg
|
||||
|
||||
GtkTextLayout* _gtk_anchored_child_get_layout (GtkWidget *child);
|
||||
|
||||
const char * gtk_text_child_anchor_get_replacement (GtkTextChildAnchor *anchor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
@@ -294,7 +294,7 @@ iter_init_from_byte_offset (GtkTextIter *iter,
|
||||
"character; this will crash the text buffer. "
|
||||
"Byte indexes must refer to the start of a character.",
|
||||
line_byte_offset);
|
||||
|
||||
|
||||
return real;
|
||||
}
|
||||
|
||||
@@ -611,11 +611,11 @@ gtk_text_iter_get_offset (const GtkTextIter *iter)
|
||||
return 0;
|
||||
|
||||
check_invariants (iter);
|
||||
|
||||
|
||||
if (real->cached_char_index < 0)
|
||||
{
|
||||
ensure_char_offsets (real);
|
||||
|
||||
|
||||
real->cached_char_index =
|
||||
_gtk_text_line_char_index (real->line);
|
||||
real->cached_char_index += real->line_char_offset;
|
||||
@@ -705,7 +705,7 @@ int
|
||||
gtk_text_iter_get_line_index (const GtkTextIter *iter)
|
||||
{
|
||||
GtkTextRealIter *real;
|
||||
|
||||
|
||||
g_return_val_if_fail (iter != NULL, 0);
|
||||
|
||||
real = gtk_text_iter_make_surreal (iter);
|
||||
@@ -738,7 +738,7 @@ gtk_text_iter_get_visible_line_offset (const GtkTextIter *iter)
|
||||
int vis_offset;
|
||||
GtkTextLineSegment *seg;
|
||||
GtkTextIter pos;
|
||||
|
||||
|
||||
g_return_val_if_fail (iter != NULL, 0);
|
||||
|
||||
real = gtk_text_iter_make_real (iter);
|
||||
@@ -749,11 +749,11 @@ gtk_text_iter_get_visible_line_offset (const GtkTextIter *iter)
|
||||
ensure_char_offsets (real);
|
||||
|
||||
check_invariants (iter);
|
||||
|
||||
|
||||
vis_offset = real->line_char_offset;
|
||||
|
||||
g_assert (vis_offset >= 0);
|
||||
|
||||
|
||||
_gtk_text_btree_get_iter_at_line (real->tree,
|
||||
&pos,
|
||||
real->line,
|
||||
@@ -780,7 +780,7 @@ gtk_text_iter_get_visible_line_offset (const GtkTextIter *iter)
|
||||
|
||||
if (_gtk_text_btree_char_is_invisible (&pos))
|
||||
vis_offset -= real->segment_char_offset;
|
||||
|
||||
|
||||
return vis_offset;
|
||||
}
|
||||
|
||||
@@ -803,7 +803,7 @@ gtk_text_iter_get_visible_line_index (const GtkTextIter *iter)
|
||||
int vis_offset;
|
||||
GtkTextLineSegment *seg;
|
||||
GtkTextIter pos;
|
||||
|
||||
|
||||
g_return_val_if_fail (iter != NULL, 0);
|
||||
|
||||
real = gtk_text_iter_make_real (iter);
|
||||
@@ -818,7 +818,7 @@ gtk_text_iter_get_visible_line_index (const GtkTextIter *iter)
|
||||
vis_offset = real->line_byte_offset;
|
||||
|
||||
g_assert (vis_offset >= 0);
|
||||
|
||||
|
||||
_gtk_text_btree_get_iter_at_line (real->tree,
|
||||
&pos,
|
||||
real->line,
|
||||
@@ -845,7 +845,7 @@ gtk_text_iter_get_visible_line_index (const GtkTextIter *iter)
|
||||
|
||||
if (_gtk_text_btree_char_is_invisible (&pos))
|
||||
vis_offset -= real->segment_byte_offset;
|
||||
|
||||
|
||||
return vis_offset;
|
||||
}
|
||||
|
||||
@@ -888,13 +888,13 @@ gtk_text_iter_get_char (const GtkTextIter *iter)
|
||||
else if (real->segment->type == >k_text_char_type)
|
||||
{
|
||||
ensure_byte_offsets (real);
|
||||
|
||||
|
||||
return g_utf8_get_char (real->segment->body.chars +
|
||||
real->segment_byte_offset);
|
||||
}
|
||||
else if (real->segment->type == >k_text_child_type)
|
||||
{
|
||||
return g_utf8_get_char (real->segment->body.child.obj->chars);
|
||||
return g_utf8_get_char (gtk_text_child_anchor_get_replacement (real->segment->body.child.obj));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1445,7 +1445,7 @@ gtk_text_iter_editable (const GtkTextIter *iter,
|
||||
gboolean retval;
|
||||
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
|
||||
values = gtk_text_attributes_new ();
|
||||
|
||||
values->editable = default_setting;
|
||||
@@ -1480,7 +1480,7 @@ gtk_text_iter_can_insert (const GtkTextIter *iter,
|
||||
gboolean default_editability)
|
||||
{
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
|
||||
if (gtk_text_iter_editable (iter, default_editability))
|
||||
return TRUE;
|
||||
/* If at start/end of buffer, default editability is used */
|
||||
@@ -1540,7 +1540,7 @@ gtk_text_iter_get_language (const GtkTextIter *iter)
|
||||
{
|
||||
GtkTextAttributes *values;
|
||||
PangoLanguage *retval;
|
||||
|
||||
|
||||
values = gtk_text_attributes_new ();
|
||||
|
||||
gtk_text_iter_get_attributes (iter, values);
|
||||
@@ -1613,7 +1613,7 @@ gboolean
|
||||
gtk_text_iter_ends_line (const GtkTextIter *iter)
|
||||
{
|
||||
gunichar wc;
|
||||
|
||||
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
check_invariants (iter);
|
||||
@@ -1624,7 +1624,7 @@ gtk_text_iter_ends_line (const GtkTextIter *iter)
|
||||
#define PARAGRAPH_SEPARATOR 0x2029
|
||||
|
||||
wc = gtk_text_iter_get_char (iter);
|
||||
|
||||
|
||||
if (wc == '\r' || wc == PARAGRAPH_SEPARATOR || wc == 0) /* wc == 0 is end iterator */
|
||||
return TRUE;
|
||||
else if (wc == '\n')
|
||||
@@ -1689,7 +1689,7 @@ gtk_text_iter_is_end (const GtkTextIter *iter)
|
||||
|
||||
if (real == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
||||
return _gtk_text_btree_is_end (real->tree, real->line,
|
||||
real->segment,
|
||||
real->segment_byte_offset,
|
||||
@@ -1758,7 +1758,7 @@ gtk_text_iter_get_chars_in_line (const GtkTextIter *iter)
|
||||
|
||||
if (_gtk_text_line_contains_end_iter (real->line, real->tree))
|
||||
count -= 1; /* Dump the newline that was in the last segment of the end iter line */
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -1809,7 +1809,7 @@ gtk_text_iter_get_bytes_in_line (const GtkTextIter *iter)
|
||||
|
||||
if (_gtk_text_line_contains_end_iter (real->line, real->tree))
|
||||
count -= 1; /* Dump the newline that was in the last segment of the end iter line */
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -1831,12 +1831,12 @@ forward_line_leaving_caches_unmodified (GtkTextRealIter *real)
|
||||
if (!_gtk_text_line_contains_end_iter (real->line, real->tree))
|
||||
{
|
||||
GtkTextLine *new_line;
|
||||
|
||||
|
||||
new_line = _gtk_text_line_next (real->line);
|
||||
g_assert (new_line);
|
||||
g_assert (new_line != real->line);
|
||||
g_assert (!_gtk_text_line_is_last (new_line, real->tree));
|
||||
|
||||
|
||||
real->line = new_line;
|
||||
|
||||
real->line_byte_offset = 0;
|
||||
@@ -1859,7 +1859,7 @@ forward_line_leaving_caches_unmodified (GtkTextRealIter *real)
|
||||
* the line containing the end iterator.
|
||||
* However we may not be at the end iterator itself.
|
||||
*/
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -1912,7 +1912,7 @@ backward_line_leaving_caches_unmodified (GtkTextRealIter *real)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* The return value indicates (MOVEMENT OCCURRED && NEW ITER IS
|
||||
* DEREFERENCEABLE)
|
||||
@@ -2064,7 +2064,7 @@ _gtk_text_iter_forward_indexable_segment (GtkTextIter *iter)
|
||||
/* End of buffer, but iter is still at start of last segment,
|
||||
* not at the end iterator. We put it on the end iterator.
|
||||
*/
|
||||
|
||||
|
||||
check_invariants (iter);
|
||||
|
||||
g_assert (!_gtk_text_line_is_last (real->line, real->tree));
|
||||
@@ -2073,7 +2073,7 @@ _gtk_text_iter_forward_indexable_segment (GtkTextIter *iter)
|
||||
gtk_text_iter_forward_to_line_end (iter);
|
||||
|
||||
g_assert (gtk_text_iter_is_end (iter));
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -2326,7 +2326,7 @@ gtk_text_iter_forward_chars (GtkTextIter *iter, int count)
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
FIX_OVERFLOWS (count);
|
||||
|
||||
|
||||
real = gtk_text_iter_make_real (iter);
|
||||
|
||||
if (real == NULL)
|
||||
@@ -2400,7 +2400,7 @@ gtk_text_iter_backward_chars (GtkTextIter *iter, int count)
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
FIX_OVERFLOWS (count);
|
||||
|
||||
|
||||
real = gtk_text_iter_make_real (iter);
|
||||
|
||||
if (real == NULL)
|
||||
@@ -2430,7 +2430,7 @@ gtk_text_iter_backward_chars (GtkTextIter *iter, int count)
|
||||
|
||||
/* if in the last fourth of the segment walk backwards */
|
||||
if (count < real->segment_char_offset / 4)
|
||||
p = g_utf8_offset_to_pointer (real->segment->body.chars + real->segment_byte_offset,
|
||||
p = g_utf8_offset_to_pointer (real->segment->body.chars + real->segment_byte_offset,
|
||||
-count);
|
||||
else
|
||||
p = g_utf8_offset_to_pointer (real->segment->body.chars,
|
||||
@@ -2555,7 +2555,7 @@ gtk_text_iter_forward_line (GtkTextIter *iter)
|
||||
GtkTextRealIter *real;
|
||||
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
|
||||
real = gtk_text_iter_make_real (iter);
|
||||
|
||||
if (real == NULL)
|
||||
@@ -2578,10 +2578,10 @@ gtk_text_iter_forward_line (GtkTextIter *iter)
|
||||
else
|
||||
{
|
||||
/* On the last line, move to end of it */
|
||||
|
||||
|
||||
if (!gtk_text_iter_is_end (iter))
|
||||
gtk_text_iter_forward_to_end (iter);
|
||||
|
||||
|
||||
check_invariants (iter);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -2689,7 +2689,7 @@ gboolean
|
||||
gtk_text_iter_forward_lines (GtkTextIter *iter, int count)
|
||||
{
|
||||
FIX_OVERFLOWS (count);
|
||||
|
||||
|
||||
if (count < 0)
|
||||
return gtk_text_iter_backward_lines (iter, 0 - count);
|
||||
else if (count == 0)
|
||||
@@ -2705,7 +2705,7 @@ gtk_text_iter_forward_lines (GtkTextIter *iter, int count)
|
||||
|
||||
if (gtk_text_iter_is_end (iter))
|
||||
return FALSE;
|
||||
|
||||
|
||||
old_line = gtk_text_iter_get_line (iter);
|
||||
|
||||
gtk_text_iter_set_line (iter, old_line + count);
|
||||
@@ -2716,7 +2716,7 @@ gtk_text_iter_forward_lines (GtkTextIter *iter, int count)
|
||||
if (!gtk_text_iter_is_end (iter))
|
||||
gtk_text_iter_forward_to_end (iter);
|
||||
}
|
||||
|
||||
|
||||
return !gtk_text_iter_is_end (iter);
|
||||
}
|
||||
}
|
||||
@@ -2743,7 +2743,7 @@ gboolean
|
||||
gtk_text_iter_backward_lines (GtkTextIter *iter, int count)
|
||||
{
|
||||
FIX_OVERFLOWS (count);
|
||||
|
||||
|
||||
if (count < 0)
|
||||
return gtk_text_iter_forward_lines (iter, 0 - count);
|
||||
else if (count == 0)
|
||||
@@ -2790,14 +2790,14 @@ gtk_text_iter_forward_visible_line (GtkTextIter *iter)
|
||||
{
|
||||
if (!gtk_text_iter_forward_char (iter))
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (!_gtk_text_btree_char_is_invisible (iter))
|
||||
return TRUE;
|
||||
}
|
||||
while (!gtk_text_iter_ends_line (iter));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -2830,14 +2830,14 @@ gtk_text_iter_backward_visible_line (GtkTextIter *iter)
|
||||
{
|
||||
if (!gtk_text_iter_backward_char (iter))
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (!_gtk_text_btree_char_is_invisible (iter))
|
||||
return TRUE;
|
||||
}
|
||||
while (!gtk_text_iter_starts_line (iter));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -2864,7 +2864,7 @@ gtk_text_iter_forward_visible_lines (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
FIX_OVERFLOWS (count);
|
||||
|
||||
|
||||
if (count < 0)
|
||||
return gtk_text_iter_backward_visible_lines (iter, 0 - count);
|
||||
else if (count == 0)
|
||||
@@ -2879,7 +2879,7 @@ gtk_text_iter_forward_visible_lines (GtkTextIter *iter,
|
||||
while (gtk_text_iter_forward_visible_line (iter) && count > 0)
|
||||
count--;
|
||||
return count == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2905,7 +2905,7 @@ gtk_text_iter_backward_visible_lines (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
FIX_OVERFLOWS (count);
|
||||
|
||||
|
||||
if (count < 0)
|
||||
return gtk_text_iter_forward_visible_lines (iter, 0 - count);
|
||||
else if (count == 0)
|
||||
@@ -3138,9 +3138,9 @@ find_line_log_attrs (const GtkTextIter *iter,
|
||||
int offset;
|
||||
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
|
||||
attrs = _gtk_text_buffer_get_line_log_attrs (gtk_text_iter_get_buffer (iter),
|
||||
iter, &char_len);
|
||||
iter, &char_len);
|
||||
|
||||
offset = gtk_text_iter_get_line_offset (iter);
|
||||
|
||||
@@ -3244,9 +3244,9 @@ find_visible_by_log_attrs (GtkTextIter *iter,
|
||||
|
||||
typedef gboolean (* OneStepFunc) (GtkTextIter *iter);
|
||||
typedef gboolean (* MultipleStepFunc) (GtkTextIter *iter, int count);
|
||||
|
||||
static gboolean
|
||||
move_multiple_steps (GtkTextIter *iter,
|
||||
|
||||
static gboolean
|
||||
move_multiple_steps (GtkTextIter *iter,
|
||||
int count,
|
||||
OneStepFunc step_forward,
|
||||
MultipleStepFunc n_steps_backward)
|
||||
@@ -3254,13 +3254,13 @@ move_multiple_steps (GtkTextIter *iter,
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
FIX_OVERFLOWS (count);
|
||||
|
||||
|
||||
if (count == 0)
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (count < 0)
|
||||
return n_steps_backward (iter, -count);
|
||||
|
||||
|
||||
if (!step_forward (iter))
|
||||
return FALSE;
|
||||
--count;
|
||||
@@ -3271,10 +3271,10 @@ move_multiple_steps (GtkTextIter *iter,
|
||||
break;
|
||||
--count;
|
||||
}
|
||||
|
||||
return !gtk_text_iter_is_end (iter);
|
||||
|
||||
return !gtk_text_iter_is_end (iter);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gtk_text_iter_forward_word_end:
|
||||
@@ -3333,7 +3333,7 @@ gboolean
|
||||
gtk_text_iter_forward_word_ends (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
return move_multiple_steps (iter, count,
|
||||
return move_multiple_steps (iter, count,
|
||||
gtk_text_iter_forward_word_end,
|
||||
gtk_text_iter_backward_word_starts);
|
||||
}
|
||||
@@ -3351,7 +3351,7 @@ gboolean
|
||||
gtk_text_iter_backward_word_starts (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
return move_multiple_steps (iter, count,
|
||||
return move_multiple_steps (iter, count,
|
||||
gtk_text_iter_backward_word_start,
|
||||
gtk_text_iter_forward_word_ends);
|
||||
}
|
||||
@@ -3409,7 +3409,7 @@ gboolean
|
||||
gtk_text_iter_forward_visible_word_ends (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
return move_multiple_steps (iter, count,
|
||||
return move_multiple_steps (iter, count,
|
||||
gtk_text_iter_forward_visible_word_end,
|
||||
gtk_text_iter_backward_visible_word_starts);
|
||||
}
|
||||
@@ -3427,7 +3427,7 @@ gboolean
|
||||
gtk_text_iter_backward_visible_word_starts (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
return move_multiple_steps (iter, count,
|
||||
return move_multiple_steps (iter, count,
|
||||
gtk_text_iter_backward_visible_word_start,
|
||||
gtk_text_iter_forward_visible_word_ends);
|
||||
}
|
||||
@@ -3599,7 +3599,7 @@ gboolean
|
||||
gtk_text_iter_forward_sentence_ends (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
return move_multiple_steps (iter, count,
|
||||
return move_multiple_steps (iter, count,
|
||||
gtk_text_iter_forward_sentence_end,
|
||||
gtk_text_iter_backward_sentence_starts);
|
||||
}
|
||||
@@ -3619,7 +3619,7 @@ gboolean
|
||||
gtk_text_iter_backward_sentence_starts (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
return move_multiple_steps (iter, count,
|
||||
return move_multiple_steps (iter, count,
|
||||
gtk_text_iter_backward_sentence_start,
|
||||
gtk_text_iter_forward_sentence_ends);
|
||||
}
|
||||
@@ -3738,7 +3738,7 @@ gboolean
|
||||
gtk_text_iter_forward_cursor_positions (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
return move_multiple_steps (iter, count,
|
||||
return move_multiple_steps (iter, count,
|
||||
gtk_text_iter_forward_cursor_position,
|
||||
gtk_text_iter_backward_cursor_positions);
|
||||
}
|
||||
@@ -3758,7 +3758,7 @@ gboolean
|
||||
gtk_text_iter_backward_cursor_positions (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
return move_multiple_steps (iter, count,
|
||||
return move_multiple_steps (iter, count,
|
||||
gtk_text_iter_backward_cursor_position,
|
||||
gtk_text_iter_forward_cursor_positions);
|
||||
}
|
||||
@@ -3810,7 +3810,7 @@ gboolean
|
||||
gtk_text_iter_forward_visible_cursor_positions (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
return move_multiple_steps (iter, count,
|
||||
return move_multiple_steps (iter, count,
|
||||
gtk_text_iter_forward_visible_cursor_position,
|
||||
gtk_text_iter_backward_visible_cursor_positions);
|
||||
}
|
||||
@@ -3830,7 +3830,7 @@ gboolean
|
||||
gtk_text_iter_backward_visible_cursor_positions (GtkTextIter *iter,
|
||||
int count)
|
||||
{
|
||||
return move_multiple_steps (iter, count,
|
||||
return move_multiple_steps (iter, count,
|
||||
gtk_text_iter_backward_visible_cursor_position,
|
||||
gtk_text_iter_forward_visible_cursor_positions);
|
||||
}
|
||||
@@ -3871,14 +3871,14 @@ gtk_text_iter_set_line_offset (GtkTextIter *iter,
|
||||
{
|
||||
GtkTextRealIter *real;
|
||||
int chars_in_line;
|
||||
|
||||
|
||||
g_return_if_fail (iter != NULL);
|
||||
|
||||
real = gtk_text_iter_make_surreal (iter);
|
||||
|
||||
if (real == NULL)
|
||||
return;
|
||||
|
||||
|
||||
check_invariants (iter);
|
||||
|
||||
chars_in_line = gtk_text_iter_get_chars_in_line (iter);
|
||||
@@ -3889,7 +3889,7 @@ gtk_text_iter_set_line_offset (GtkTextIter *iter,
|
||||
iter_set_from_char_offset (real, real->line, char_on_line);
|
||||
else
|
||||
gtk_text_iter_forward_line (iter); /* set to start of next line */
|
||||
|
||||
|
||||
check_invariants (iter);
|
||||
}
|
||||
|
||||
@@ -3909,7 +3909,7 @@ gtk_text_iter_set_line_index (GtkTextIter *iter,
|
||||
{
|
||||
GtkTextRealIter *real;
|
||||
int bytes_in_line;
|
||||
|
||||
|
||||
g_return_if_fail (iter != NULL);
|
||||
|
||||
real = gtk_text_iter_make_surreal (iter);
|
||||
@@ -3922,7 +3922,7 @@ gtk_text_iter_set_line_index (GtkTextIter *iter,
|
||||
bytes_in_line = gtk_text_iter_get_bytes_in_line (iter);
|
||||
|
||||
g_return_if_fail (byte_on_line <= bytes_in_line);
|
||||
|
||||
|
||||
if (byte_on_line < bytes_in_line)
|
||||
iter_set_from_byte_offset (real, real->line, byte_on_line);
|
||||
else
|
||||
@@ -3956,7 +3956,7 @@ gtk_text_iter_set_visible_line_offset (GtkTextIter *iter,
|
||||
GtkTextIter pos;
|
||||
|
||||
g_return_if_fail (iter != NULL);
|
||||
|
||||
|
||||
gtk_text_iter_set_line_offset (iter, 0);
|
||||
|
||||
pos = *iter;
|
||||
@@ -3973,7 +3973,7 @@ gtk_text_iter_set_visible_line_offset (GtkTextIter *iter,
|
||||
if (chars_seen == char_on_line)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (_gtk_text_iter_get_text_line (&pos) == _gtk_text_iter_get_text_line (iter))
|
||||
*iter = pos;
|
||||
else
|
||||
@@ -3997,7 +3997,7 @@ gtk_text_iter_set_visible_line_index (GtkTextIter *iter,
|
||||
int offset = 0;
|
||||
GtkTextIter pos;
|
||||
GtkTextLineSegment *seg;
|
||||
|
||||
|
||||
g_return_if_fail (iter != NULL);
|
||||
|
||||
gtk_text_iter_set_line_offset (iter, 0);
|
||||
@@ -4204,12 +4204,12 @@ gtk_text_iter_forward_to_line_end (GtkTextIter *iter)
|
||||
int current_offset;
|
||||
int new_offset;
|
||||
|
||||
|
||||
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
current_offset = gtk_text_iter_get_line_offset (iter);
|
||||
new_offset = find_paragraph_delimiter_for_line (iter);
|
||||
|
||||
|
||||
if (current_offset < new_offset)
|
||||
{
|
||||
/* Move to end of this line. */
|
||||
@@ -4462,11 +4462,11 @@ gtk_text_iter_forward_find_char (GtkTextIter *iter,
|
||||
if (limit &&
|
||||
gtk_text_iter_compare (iter, limit) >= 0)
|
||||
return FALSE;
|
||||
|
||||
|
||||
while ((limit == NULL ||
|
||||
!gtk_text_iter_equal (limit, iter)) &&
|
||||
gtk_text_iter_forward_char (iter))
|
||||
{
|
||||
{
|
||||
if (matches_pred (iter, pred, user_data))
|
||||
return TRUE;
|
||||
}
|
||||
@@ -4498,7 +4498,7 @@ gtk_text_iter_backward_find_char (GtkTextIter *iter,
|
||||
if (limit &&
|
||||
gtk_text_iter_compare (iter, limit) <= 0)
|
||||
return FALSE;
|
||||
|
||||
|
||||
while ((limit == NULL ||
|
||||
!gtk_text_iter_equal (limit, iter)) &&
|
||||
gtk_text_iter_backward_char (iter))
|
||||
@@ -4998,18 +4998,18 @@ gtk_text_iter_forward_search (const GtkTextIter *iter,
|
||||
if (limit &&
|
||||
gtk_text_iter_compare (iter, limit) >= 0)
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (*str == '\0')
|
||||
{
|
||||
/* If we can move one char, return the empty string there */
|
||||
match = *iter;
|
||||
|
||||
|
||||
if (gtk_text_iter_forward_char (&match))
|
||||
{
|
||||
if (limit &&
|
||||
gtk_text_iter_equal (&match, limit))
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (match_start)
|
||||
*match_start = match;
|
||||
if (match_end)
|
||||
@@ -5041,7 +5041,7 @@ gtk_text_iter_forward_search (const GtkTextIter *iter,
|
||||
if (limit &&
|
||||
gtk_text_iter_compare (&search, limit) >= 0)
|
||||
break;
|
||||
|
||||
|
||||
if (lines_match (&search, (const char **)lines,
|
||||
visible_only, slice, case_insensitive, &match, &end))
|
||||
{
|
||||
@@ -5050,14 +5050,14 @@ gtk_text_iter_forward_search (const GtkTextIter *iter,
|
||||
gtk_text_iter_compare (&end, limit) <= 0))
|
||||
{
|
||||
retval = TRUE;
|
||||
|
||||
|
||||
if (match_start)
|
||||
*match_start = match;
|
||||
|
||||
|
||||
if (match_end)
|
||||
*match_end = end;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5316,14 +5316,14 @@ gtk_text_iter_backward_search (const GtkTextIter *iter,
|
||||
gboolean visible_only;
|
||||
gboolean slice;
|
||||
gboolean case_insensitive;
|
||||
|
||||
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
g_return_val_if_fail (str != NULL, FALSE);
|
||||
|
||||
if (limit &&
|
||||
gtk_text_iter_compare (limit, iter) > 0)
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (*str == '\0')
|
||||
{
|
||||
/* If we can move one char, return the empty string there */
|
||||
@@ -5331,7 +5331,7 @@ gtk_text_iter_backward_search (const GtkTextIter *iter,
|
||||
|
||||
if (limit && gtk_text_iter_equal (limit, &match))
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (gtk_text_iter_backward_char (&match))
|
||||
{
|
||||
if (match_start)
|
||||
@@ -5371,7 +5371,7 @@ gtk_text_iter_backward_search (const GtkTextIter *iter,
|
||||
/* We're now before the search limit, abort. */
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
/* If there are multiple lines, the first line will
|
||||
* end in '\n', so this will only match at the
|
||||
* end of the first line, which is correct.
|
||||
@@ -5425,7 +5425,7 @@ gtk_text_iter_backward_search (const GtkTextIter *iter,
|
||||
out:
|
||||
lines_window_free (&win);
|
||||
g_strfreev (lines);
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -5437,7 +5437,7 @@ gtk_text_iter_backward_search (const GtkTextIter *iter,
|
||||
* gtk_text_iter_equal:
|
||||
* @lhs: a `GtkTextIter`
|
||||
* @rhs: another `GtkTextIter`
|
||||
*
|
||||
*
|
||||
* Tests whether two iterators are equal, using the fastest possible
|
||||
* mechanism.
|
||||
*
|
||||
@@ -5445,7 +5445,7 @@ gtk_text_iter_backward_search (const GtkTextIter *iter,
|
||||
* better than e.g. getting the character offset for each
|
||||
* iterator and comparing the offsets yourself. Also, it’s a
|
||||
* bit faster than [method@Gtk.TextIter.compare].
|
||||
*
|
||||
*
|
||||
* Returns: %TRUE if the iterators point to the same place in the buffer
|
||||
**/
|
||||
gboolean
|
||||
@@ -5524,7 +5524,7 @@ gtk_text_iter_compare (const GtkTextIter *lhs,
|
||||
|
||||
check_invariants (lhs);
|
||||
check_invariants (rhs);
|
||||
|
||||
|
||||
if (real_lhs->line == real_rhs->line)
|
||||
{
|
||||
int left_index, right_index;
|
||||
@@ -5588,7 +5588,7 @@ gtk_text_iter_in_range (const GtkTextIter *iter,
|
||||
g_return_val_if_fail (start != NULL, FALSE);
|
||||
g_return_val_if_fail (end != NULL, FALSE);
|
||||
g_return_val_if_fail (gtk_text_iter_compare (start, end) <= 0, FALSE);
|
||||
|
||||
|
||||
return gtk_text_iter_compare (iter, start) >= 0 &&
|
||||
gtk_text_iter_compare (iter, end) < 0;
|
||||
}
|
||||
@@ -5666,7 +5666,7 @@ _gtk_text_btree_get_iter_at_line_char (GtkTextBTree *tree,
|
||||
g_return_if_fail (tree != NULL);
|
||||
|
||||
line = _gtk_text_btree_get_line_no_last (tree, line_number, &real_line);
|
||||
|
||||
|
||||
iter_init_from_char_offset (iter, tree, line, char_on_line);
|
||||
|
||||
/* We might as well cache this, since we know it. */
|
||||
@@ -5762,7 +5762,7 @@ _gtk_text_btree_get_iter_at_last_toggle (GtkTextBTree *tree,
|
||||
found = gtk_text_iter_backward_to_tag_toggle (iter, tag);
|
||||
|
||||
check_invariants (iter);
|
||||
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
@@ -5831,11 +5831,11 @@ _gtk_text_btree_get_iter_at_child_anchor (GtkTextBTree *tree,
|
||||
g_return_if_fail (iter != NULL);
|
||||
g_return_if_fail (tree != NULL);
|
||||
g_return_if_fail (GTK_IS_TEXT_CHILD_ANCHOR (anchor));
|
||||
|
||||
seg = anchor->segment;
|
||||
|
||||
seg = anchor->segment;
|
||||
|
||||
g_assert (seg->body.child.line != NULL);
|
||||
|
||||
|
||||
iter_init_from_segment (iter, tree,
|
||||
seg->body.child.line, seg);
|
||||
g_assert (seg->body.child.line == _gtk_text_iter_get_text_line (iter));
|
||||
@@ -5934,7 +5934,7 @@ _gtk_text_iter_check (const GtkTextIter *iter)
|
||||
{
|
||||
const char *p;
|
||||
p = byte_segment->body.chars + seg_byte_offset;
|
||||
|
||||
|
||||
if (!gtk_text_byte_begins_utf8_char (p))
|
||||
g_error ("broken iterator byte index pointed into the middle of a character");
|
||||
}
|
||||
@@ -5951,7 +5951,7 @@ _gtk_text_iter_check (const GtkTextIter *iter)
|
||||
g_error ("wrong char offset was stored in iterator");
|
||||
|
||||
if (segments_updated)
|
||||
{
|
||||
{
|
||||
if (real->segment != char_segment)
|
||||
g_error ("wrong segment was stored in iterator");
|
||||
|
||||
|
||||
@@ -454,7 +454,7 @@ gtk_text_layout_set_overwrite_mode (GtkTextLayout *layout,
|
||||
* %GTK_TEXT_DIR_NONE means draw cursors for both
|
||||
* left-to-right insertion and right-to-left insertion.
|
||||
* (The two cursors will be visually distinguished.)
|
||||
*
|
||||
*
|
||||
* Sets which text directions (left-to-right and/or right-to-left) for
|
||||
* which cursors will be drawn for the insertion point. The visual
|
||||
* point at which new text is inserted depends on whether the new
|
||||
@@ -580,7 +580,7 @@ gtk_text_layout_get_cursor_visible (GtkTextLayout *layout)
|
||||
* @preedit_string: a string to display at the insertion point
|
||||
* @preedit_attrs: a `PangoAttrList` of attributes that apply to @preedit_string
|
||||
* @cursor_pos: position of cursor within preedit string in chars
|
||||
*
|
||||
*
|
||||
* Set the preedit string and attributes. The preedit string is a
|
||||
* string showing text that is currently being edited and not
|
||||
* yet committed into the buffer.
|
||||
@@ -796,7 +796,7 @@ gtk_text_layout_invalidate (GtkTextLayout *layout,
|
||||
* we always invalidate the line with "start" even
|
||||
* if there's an empty range.
|
||||
*/
|
||||
|
||||
|
||||
#if 0
|
||||
gtk_text_view_index_spew (start_index, "invalidate start");
|
||||
gtk_text_view_index_spew (end_index, "invalidate end");
|
||||
@@ -810,7 +810,7 @@ gtk_text_layout_invalidate (GtkTextLayout *layout,
|
||||
GtkTextLineData *line_data = _gtk_text_line_get_data (line, layout);
|
||||
|
||||
gtk_text_layout_invalidate_cache (layout, line, FALSE);
|
||||
|
||||
|
||||
if (line_data)
|
||||
_gtk_text_line_invalidate_wrap (line, line_data);
|
||||
|
||||
@@ -930,7 +930,7 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout,
|
||||
{
|
||||
int old_height, new_height;
|
||||
int top_ink, bottom_ink;
|
||||
|
||||
|
||||
old_height = line_data ? line_data->height : 0;
|
||||
top_ink = line_data ? line_data->top_ink : 0;
|
||||
bottom_ink = line_data ? line_data->bottom_ink : 0;
|
||||
@@ -947,7 +947,7 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout,
|
||||
}
|
||||
|
||||
delta_height += new_height - old_height;
|
||||
|
||||
|
||||
first_line = line;
|
||||
first_line_y = -seen - new_height - top_ink;
|
||||
if (!last_line)
|
||||
@@ -971,7 +971,7 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout,
|
||||
{
|
||||
int old_height, new_height;
|
||||
int top_ink, bottom_ink;
|
||||
|
||||
|
||||
old_height = line_data ? line_data->height : 0;
|
||||
top_ink = line_data ? line_data->top_ink : 0;
|
||||
bottom_ink = line_data ? line_data->bottom_ink : 0;
|
||||
@@ -987,7 +987,7 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout,
|
||||
}
|
||||
|
||||
delta_height += new_height - old_height;
|
||||
|
||||
|
||||
if (!first_line)
|
||||
{
|
||||
first_line = line;
|
||||
@@ -1062,7 +1062,7 @@ gtk_text_layout_wrap (GtkTextLayout *layout,
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TEXT_LAYOUT (layout), NULL);
|
||||
g_return_val_if_fail (line != NULL, NULL);
|
||||
|
||||
|
||||
if (line_data == NULL)
|
||||
{
|
||||
line_data = _gtk_text_line_data_new (layout, line);
|
||||
@@ -1159,9 +1159,9 @@ totally_invisible_line (GtkTextLayout *layout,
|
||||
GtkTextLineSegment *seg;
|
||||
int bytes = 0;
|
||||
|
||||
/* Check if the first char is visible, if so we are partially visible.
|
||||
* Note that we have to check this since we don't know the current
|
||||
* invisible/noninvisible toggle state; this function can use the whole btree
|
||||
/* Check if the first char is visible, if so we are partially visible.
|
||||
* Note that we have to check this since we don't know the current
|
||||
* invisible/noninvisible toggle state; this function can use the whole btree
|
||||
* to get it right.
|
||||
*/
|
||||
gtk_text_layout_get_iter_at_line (layout, iter, line, 0);
|
||||
@@ -1233,7 +1233,7 @@ set_para_values (GtkTextLayout *layout,
|
||||
base_dir = PANGO_DIRECTION_RTL;
|
||||
else
|
||||
base_dir = PANGO_DIRECTION_LTR;
|
||||
|
||||
|
||||
break;
|
||||
case PANGO_DIRECTION_RTL :
|
||||
display->direction = GTK_TEXT_DIR_RTL;
|
||||
@@ -1247,7 +1247,7 @@ set_para_values (GtkTextLayout *layout,
|
||||
display->direction = GTK_TEXT_DIR_LTR;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (display->direction == GTK_TEXT_DIR_RTL)
|
||||
display->layout = pango_layout_new (layout->rtl_context);
|
||||
else
|
||||
@@ -1285,7 +1285,7 @@ set_para_values (GtkTextLayout *layout,
|
||||
display->bottom_margin = style->pixels_below_lines;
|
||||
display->left_margin = style->left_margin;
|
||||
display->right_margin = style->right_margin;
|
||||
|
||||
|
||||
display->x_offset = display->left_margin;
|
||||
|
||||
pango_layout_set_indent (display->layout,
|
||||
@@ -1362,12 +1362,12 @@ gtk_text_attr_appearance_destroy (PangoAttribute *attr)
|
||||
g_slice_free (GtkTextAttrAppearance, appearance_attr);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static gboolean
|
||||
rgba_equal (const GdkRGBA *rgba1, const GdkRGBA *rgba2)
|
||||
{
|
||||
if (rgba1 && rgba2)
|
||||
return gdk_rgba_equal (rgba1, rgba2);
|
||||
|
||||
|
||||
if (rgba1 || rgba2)
|
||||
return FALSE;
|
||||
|
||||
@@ -1479,10 +1479,10 @@ add_generic_attrs (GtkTextLayout *layout,
|
||||
if (appearance->underline != PANGO_UNDERLINE_NONE)
|
||||
{
|
||||
attr = pango_attr_underline_new (appearance->underline);
|
||||
|
||||
|
||||
attr->start_index = start;
|
||||
attr->end_index = start + byte_count;
|
||||
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
@@ -1523,10 +1523,10 @@ add_generic_attrs (GtkTextLayout *layout,
|
||||
if (appearance->strikethrough)
|
||||
{
|
||||
attr = pango_attr_strikethrough_new (appearance->strikethrough);
|
||||
|
||||
|
||||
attr->start_index = start;
|
||||
attr->end_index = start + byte_count;
|
||||
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
@@ -1545,22 +1545,22 @@ add_generic_attrs (GtkTextLayout *layout,
|
||||
if (appearance->rise != 0)
|
||||
{
|
||||
attr = pango_attr_rise_new (appearance->rise);
|
||||
|
||||
|
||||
attr->start_index = start;
|
||||
attr->end_index = start + byte_count;
|
||||
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
|
||||
if (!size_only)
|
||||
{
|
||||
attr = gtk_text_attr_appearance_new (appearance);
|
||||
|
||||
|
||||
attr->start_index = start;
|
||||
attr->end_index = start + byte_count;
|
||||
|
||||
((GtkTextAttrAppearance *)attr)->appearance.is_text = is_text;
|
||||
|
||||
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
}
|
||||
}
|
||||
@@ -1769,7 +1769,7 @@ add_child_attrs (GtkTextLayout *layout,
|
||||
|
||||
width = 1;
|
||||
height = 1;
|
||||
|
||||
|
||||
tmp_list = seg->body.child.widgets;
|
||||
while (tmp_list != NULL)
|
||||
{
|
||||
@@ -1786,10 +1786,10 @@ add_child_attrs (GtkTextLayout *layout,
|
||||
height = req.height;
|
||||
|
||||
widget = child;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
@@ -1833,7 +1833,7 @@ add_child_attrs (GtkTextLayout *layout,
|
||||
* @cursor_at_line_end: whether cursor is at the end of line
|
||||
*
|
||||
* Checks whether layout should display block cursor at given position.
|
||||
* For this layout must be in overwrite mode and text at @insert_iter
|
||||
* For this layout must be in overwrite mode and text at @insert_iter
|
||||
* must be editable.
|
||||
*/
|
||||
static gboolean
|
||||
@@ -1916,7 +1916,7 @@ static gboolean
|
||||
is_shape (PangoLayoutRun *run)
|
||||
{
|
||||
GSList *tmp_list = run->item->analysis.extra_attrs;
|
||||
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
PangoAttribute *attr = tmp_list->data;
|
||||
@@ -2037,7 +2037,7 @@ add_preedit_attrs (GtkTextLayout *layout,
|
||||
|
||||
if (end == G_MAXINT)
|
||||
end = layout->preedit_len;
|
||||
|
||||
|
||||
if (end == start)
|
||||
continue;
|
||||
|
||||
@@ -2053,13 +2053,13 @@ add_preedit_attrs (GtkTextLayout *layout,
|
||||
appearance.overline_rgba = gdk_rgba_copy (appearance.overline_rgba);
|
||||
if (appearance.strikethrough_rgba)
|
||||
appearance.strikethrough_rgba = gdk_rgba_copy (appearance.strikethrough_rgba);
|
||||
|
||||
|
||||
tmp_list = extra_attrs;
|
||||
while (tmp_list)
|
||||
{
|
||||
PangoAttribute *attr = tmp_list->data;
|
||||
GdkRGBA rgba;
|
||||
|
||||
|
||||
switch ((guint) attr->klass->type)
|
||||
{
|
||||
case PANGO_ATTR_FOREGROUND:
|
||||
@@ -2108,17 +2108,17 @@ add_preedit_attrs (GtkTextLayout *layout,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
pango_attribute_destroy (attr);
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
|
||||
g_slist_free (extra_attrs);
|
||||
|
||||
|
||||
insert_attr = pango_attr_font_desc_new (font_desc);
|
||||
insert_attr->start_index = start + offset;
|
||||
insert_attr->end_index = end + offset;
|
||||
|
||||
|
||||
pango_attr_list_insert (attrs, insert_attr);
|
||||
|
||||
if (language)
|
||||
@@ -2126,14 +2126,14 @@ add_preedit_attrs (GtkTextLayout *layout,
|
||||
insert_attr = pango_attr_language_new (language);
|
||||
insert_attr->start_index = start + offset;
|
||||
insert_attr->end_index = end + offset;
|
||||
|
||||
|
||||
pango_attr_list_insert (attrs, insert_attr);
|
||||
}
|
||||
|
||||
add_generic_attrs (layout, &appearance, end - start,
|
||||
attrs, start + offset,
|
||||
size_only, TRUE);
|
||||
|
||||
|
||||
if (appearance.fg_rgba)
|
||||
gdk_rgba_free (appearance.fg_rgba);
|
||||
if (appearance.bg_rgba)
|
||||
@@ -2399,7 +2399,7 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
|
||||
|
||||
int bytes = 0;
|
||||
GtkTextLineSegment *prev_seg = NULL;
|
||||
|
||||
|
||||
while (seg)
|
||||
{
|
||||
if (seg->type == >k_text_char_type)
|
||||
@@ -2463,14 +2463,14 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
|
||||
else if (seg->type == >k_text_child_type)
|
||||
{
|
||||
saw_widget = TRUE;
|
||||
|
||||
|
||||
add_generic_attrs (layout, &style->appearance,
|
||||
seg->byte_count,
|
||||
attrs, layout_byte_offset,
|
||||
size_only, FALSE);
|
||||
add_child_attrs (layout, display, style,
|
||||
seg, attrs, layout_byte_offset);
|
||||
memcpy (text + layout_byte_offset, seg->body.child.obj->chars,
|
||||
memcpy (text + layout_byte_offset, gtk_text_child_anchor_get_replacement (seg->body.child.obj),
|
||||
seg->byte_count);
|
||||
layout_byte_offset += seg->byte_count;
|
||||
buffer_byte_offset += seg->byte_count;
|
||||
@@ -2480,7 +2480,7 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
|
||||
/* We don't know this segment type */
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
|
||||
} /* if (segment was visible) */
|
||||
else
|
||||
{
|
||||
@@ -2509,13 +2509,13 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
|
||||
seg->type == >k_text_left_mark_type)
|
||||
{
|
||||
int cursor_offset = 0;
|
||||
|
||||
|
||||
/* At the insertion point, add the preedit string, if any */
|
||||
|
||||
|
||||
if (_gtk_text_btree_mark_is_insert (btree, seg->body.mark.obj))
|
||||
{
|
||||
display->insert_index = layout_byte_offset;
|
||||
|
||||
|
||||
if (layout->preedit_len > 0)
|
||||
{
|
||||
text_allocated += layout->preedit_len;
|
||||
@@ -2524,15 +2524,15 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
|
||||
style = get_style (layout, tags);
|
||||
add_preedit_attrs (layout, style, attrs, layout_byte_offset, size_only);
|
||||
release_style (layout, style);
|
||||
|
||||
|
||||
memcpy (text + layout_byte_offset, layout->preedit_string, layout->preedit_len);
|
||||
layout_byte_offset += layout->preedit_len;
|
||||
/* DO NOT increment the buffer byte offset for preedit */
|
||||
|
||||
|
||||
cursor_offset = layout->preedit_cursor - layout->preedit_len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Display visible marks */
|
||||
|
||||
@@ -2549,14 +2549,14 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
|
||||
|
||||
seg = seg->next;
|
||||
}
|
||||
|
||||
|
||||
if (!para_values_set)
|
||||
{
|
||||
style = get_style (layout, tags);
|
||||
set_para_values (layout, base_dir, style, display);
|
||||
release_style (layout, style);
|
||||
}
|
||||
|
||||
|
||||
/* Pango doesn't want the trailing paragraph delimiters */
|
||||
|
||||
{
|
||||
@@ -2582,7 +2582,7 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pango_layout_set_text (display->layout, text, layout_byte_offset);
|
||||
pango_layout_set_attributes (display->layout, attrs);
|
||||
|
||||
@@ -2628,7 +2628,7 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Free this if we aren't in a loop */
|
||||
if (layout->wrap_loop_count == 0)
|
||||
invalidate_cached_style (layout);
|
||||
@@ -2642,7 +2642,7 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
|
||||
|
||||
if (saw_widget)
|
||||
allocate_child_widgets (layout, display);
|
||||
|
||||
|
||||
return g_steal_pointer (&display);
|
||||
}
|
||||
|
||||
@@ -2695,7 +2695,7 @@ line_display_iter_to_index (GtkTextLayout *layout,
|
||||
g_return_val_if_fail (_gtk_text_iter_get_text_line (iter) == display->line, 0);
|
||||
|
||||
index = gtk_text_iter_get_visible_line_index (iter);
|
||||
|
||||
|
||||
if (layout->preedit_len > 0 && display->insert_index >= 0)
|
||||
{
|
||||
if (index >= display->insert_index)
|
||||
@@ -2714,7 +2714,7 @@ line_display_index_to_iter (GtkTextLayout *layout,
|
||||
{
|
||||
g_return_if_fail (!_gtk_text_line_is_last (display->line,
|
||||
_gtk_text_buffer_get_btree (layout->buffer)));
|
||||
|
||||
|
||||
if (layout->preedit_len > 0 && display->insert_index >= 0)
|
||||
{
|
||||
if (index >= display->insert_index + layout->preedit_len)
|
||||
@@ -2729,7 +2729,7 @@ line_display_index_to_iter (GtkTextLayout *layout,
|
||||
gtk_text_layout_get_iter_at_line (layout, iter, display->line, 0);
|
||||
|
||||
gtk_text_iter_set_visible_line_index (iter, index);
|
||||
|
||||
|
||||
if (_gtk_text_iter_get_text_line (iter) != display->line)
|
||||
{
|
||||
/* Clamp to end of line - really this clamping should have been done
|
||||
@@ -2739,7 +2739,7 @@ line_display_index_to_iter (GtkTextLayout *layout,
|
||||
if (!gtk_text_iter_ends_line (iter))
|
||||
gtk_text_iter_forward_to_line_end (iter);
|
||||
}
|
||||
|
||||
|
||||
gtk_text_iter_forward_chars (iter, trailing);
|
||||
}
|
||||
|
||||
@@ -2897,16 +2897,16 @@ gtk_text_layout_get_cursor_locations (GtkTextLayout *layout,
|
||||
line = _gtk_text_iter_get_text_line (iter);
|
||||
display = gtk_text_layout_get_line_display (layout, line, FALSE);
|
||||
index = line_display_iter_to_index (layout, display, iter);
|
||||
|
||||
|
||||
line_top = _gtk_text_btree_find_line_top (_gtk_text_buffer_get_btree (layout->buffer),
|
||||
line, layout);
|
||||
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (layout->buffer, &insert_iter,
|
||||
gtk_text_buffer_get_insert (layout->buffer));
|
||||
|
||||
if (gtk_text_iter_equal (iter, &insert_iter))
|
||||
index += layout->preedit_cursor - layout->preedit_len;
|
||||
|
||||
|
||||
pango_layout_get_cursor_pos (display->layout, index,
|
||||
strong_pos ? &pango_strong_pos : NULL,
|
||||
weak_pos ? &pango_weak_pos : NULL);
|
||||
@@ -3038,7 +3038,7 @@ gtk_text_layout_get_iter_location (GtkTextLayout *layout,
|
||||
GtkTextLineDisplay *display;
|
||||
int byte_index;
|
||||
int x_offset;
|
||||
|
||||
|
||||
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
|
||||
g_return_if_fail (_gtk_text_iter_get_btree (iter) == _gtk_text_buffer_get_btree (layout->buffer));
|
||||
g_return_if_fail (rect != NULL);
|
||||
@@ -3053,9 +3053,9 @@ gtk_text_layout_get_iter_location (GtkTextLayout *layout,
|
||||
x_offset = display->x_offset * PANGO_SCALE;
|
||||
|
||||
byte_index = gtk_text_iter_get_line_index (iter);
|
||||
|
||||
|
||||
pango_layout_index_to_pos (display->layout, byte_index, &pango_rect);
|
||||
|
||||
|
||||
rect->x = PANGO_PIXELS (x_offset + pango_rect.x);
|
||||
rect->y += PANGO_PIXELS (pango_rect.y) + display->top_margin;
|
||||
rect->width = PANGO_PIXELS (pango_rect.width);
|
||||
@@ -3106,7 +3106,7 @@ find_display_line_below (GtkTextLayout *layout,
|
||||
PangoLayoutLine *layout_line = pango_layout_iter_get_line_readonly (layout_iter);
|
||||
|
||||
found_byte = layout_line->start_index;
|
||||
|
||||
|
||||
if (line_top >= y)
|
||||
{
|
||||
found_line = line;
|
||||
@@ -3119,7 +3119,7 @@ find_display_line_below (GtkTextLayout *layout,
|
||||
while (pango_layout_iter_next_line (layout_iter));
|
||||
|
||||
pango_layout_iter_free (layout_iter);
|
||||
|
||||
|
||||
line_top += display->bottom_margin;
|
||||
gtk_text_line_display_unref (display);
|
||||
|
||||
@@ -3153,7 +3153,7 @@ find_display_line_above (GtkTextLayout *layout,
|
||||
if (!line)
|
||||
{
|
||||
line = _gtk_text_btree_get_end_iter_line (btree);
|
||||
|
||||
|
||||
line_top = _gtk_text_btree_find_line_top (btree, line, layout);
|
||||
}
|
||||
|
||||
@@ -3165,7 +3165,7 @@ find_display_line_above (GtkTextLayout *layout,
|
||||
int tmp_top;
|
||||
|
||||
layout_iter = pango_layout_get_iter (display->layout);
|
||||
|
||||
|
||||
line_top -= display->top_margin + display->bottom_margin;
|
||||
pango_layout_iter_get_layout_extents (layout_iter, NULL, &logical_rect);
|
||||
line_top -= logical_rect.height / PANGO_SCALE;
|
||||
@@ -3180,7 +3180,7 @@ find_display_line_above (GtkTextLayout *layout,
|
||||
found_byte = layout_line->start_index;
|
||||
|
||||
pango_layout_iter_get_line_yrange (layout_iter, &first_y, &last_y);
|
||||
|
||||
|
||||
tmp_top -= (last_y - first_y) / PANGO_SCALE;
|
||||
|
||||
if (tmp_top < y)
|
||||
@@ -3193,7 +3193,7 @@ find_display_line_above (GtkTextLayout *layout,
|
||||
while (pango_layout_iter_next_line (layout_iter));
|
||||
|
||||
pango_layout_iter_free (layout_iter);
|
||||
|
||||
|
||||
gtk_text_line_display_unref (display);
|
||||
|
||||
line = _gtk_text_line_previous (line);
|
||||
@@ -3272,7 +3272,7 @@ gtk_text_layout_move_iter_to_previous_line (GtkTextLayout *layout,
|
||||
PangoLayoutLine *layout_line;
|
||||
GtkTextIter orig;
|
||||
gboolean update_byte = FALSE;
|
||||
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TEXT_LAYOUT (layout), FALSE);
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
@@ -3304,7 +3304,7 @@ gtk_text_layout_move_iter_to_previous_line (GtkTextLayout *layout,
|
||||
display = gtk_text_layout_get_line_display (layout, prev_line, FALSE);
|
||||
update_byte = TRUE;
|
||||
}
|
||||
|
||||
|
||||
tmp_list = pango_layout_get_lines_readonly (display->layout);
|
||||
layout_line = tmp_list->data;
|
||||
|
||||
@@ -3364,7 +3364,7 @@ gtk_text_layout_move_iter_to_previous_line (GtkTextLayout *layout,
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
|
||||
gtk_text_line_display_unref (display);
|
||||
|
||||
return
|
||||
@@ -3397,7 +3397,7 @@ gtk_text_layout_move_iter_to_next_line (GtkTextLayout *layout,
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
orig = *iter;
|
||||
|
||||
|
||||
line = _gtk_text_iter_get_text_line (iter);
|
||||
|
||||
while (line && !found_after)
|
||||
@@ -3408,7 +3408,7 @@ gtk_text_layout_move_iter_to_next_line (GtkTextLayout *layout,
|
||||
|
||||
if (display->height == 0)
|
||||
goto next;
|
||||
|
||||
|
||||
if (first)
|
||||
{
|
||||
line_byte = line_display_iter_to_index (layout, display, iter);
|
||||
@@ -3416,7 +3416,7 @@ gtk_text_layout_move_iter_to_next_line (GtkTextLayout *layout,
|
||||
}
|
||||
else
|
||||
line_byte = 0;
|
||||
|
||||
|
||||
tmp_list = pango_layout_get_lines_readonly (display->layout);
|
||||
while (tmp_list && !found_after)
|
||||
{
|
||||
@@ -3430,12 +3430,12 @@ gtk_text_layout_move_iter_to_next_line (GtkTextLayout *layout,
|
||||
}
|
||||
else if (line_byte < layout_line->start_index + layout_line->length || !tmp_list->next)
|
||||
found = TRUE;
|
||||
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
next:
|
||||
|
||||
|
||||
gtk_text_line_display_unref (display);
|
||||
|
||||
line = _gtk_text_line_next_excluding_last (line);
|
||||
@@ -3443,7 +3443,7 @@ gtk_text_layout_move_iter_to_next_line (GtkTextLayout *layout,
|
||||
|
||||
if (!found_after)
|
||||
gtk_text_buffer_get_end_iter (layout->buffer, iter);
|
||||
|
||||
|
||||
return
|
||||
!gtk_text_iter_equal (iter, &orig) &&
|
||||
!gtk_text_iter_is_end (iter);
|
||||
@@ -3467,12 +3467,12 @@ gtk_text_layout_move_iter_to_line_end (GtkTextLayout *layout,
|
||||
int line_byte;
|
||||
GSList *tmp_list;
|
||||
GtkTextIter orig;
|
||||
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TEXT_LAYOUT (layout), FALSE);
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
orig = *iter;
|
||||
|
||||
|
||||
line = _gtk_text_iter_get_text_line (iter);
|
||||
display = gtk_text_layout_get_line_display (layout, line, FALSE);
|
||||
line_byte = line_display_iter_to_index (layout, display, iter);
|
||||
@@ -3492,13 +3492,13 @@ gtk_text_layout_move_iter_to_line_end (GtkTextLayout *layout,
|
||||
* are inside a paragraph to avoid going to next line on a
|
||||
* forced break not at whitespace. Real fix is to keep track
|
||||
* of whether marks are at leading or trailing edge? */
|
||||
if (direction > 0 && layout_line->length > 0 &&
|
||||
!gtk_text_iter_ends_line (iter) &&
|
||||
if (direction > 0 && layout_line->length > 0 &&
|
||||
!gtk_text_iter_ends_line (iter) &&
|
||||
!_gtk_text_btree_char_is_invisible (iter))
|
||||
gtk_text_iter_backward_char (iter);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
@@ -3525,7 +3525,7 @@ gtk_text_layout_iter_starts_line (GtkTextLayout *layout,
|
||||
GtkTextLineDisplay *display;
|
||||
int line_byte;
|
||||
GSList *tmp_list;
|
||||
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TEXT_LAYOUT (layout), FALSE);
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
@@ -3545,13 +3545,13 @@ gtk_text_layout_iter_starts_line (GtkTextLayout *layout,
|
||||
* it
|
||||
*/
|
||||
gtk_text_line_display_unref (display);
|
||||
|
||||
|
||||
if (line_byte == layout_line->start_index)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
@@ -3588,7 +3588,7 @@ gtk_text_layout_move_iter_to_x (GtkTextLayout *layout,
|
||||
GtkTextLineDisplay *display;
|
||||
int line_byte;
|
||||
PangoLayoutIter *layout_iter;
|
||||
|
||||
|
||||
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
|
||||
g_return_if_fail (iter != NULL);
|
||||
|
||||
@@ -3624,7 +3624,7 @@ gtk_text_layout_move_iter_to_x (GtkTextLayout *layout,
|
||||
while (pango_layout_iter_next_line (layout_iter));
|
||||
|
||||
pango_layout_iter_free (layout_iter);
|
||||
|
||||
|
||||
gtk_text_line_display_unref (display);
|
||||
}
|
||||
|
||||
@@ -3655,12 +3655,12 @@ gtk_text_layout_move_iter_visually (GtkTextLayout *layout,
|
||||
GtkTextLineDisplay *display = NULL;
|
||||
GtkTextIter orig;
|
||||
GtkTextIter lineiter;
|
||||
|
||||
|
||||
g_return_val_if_fail (layout != NULL, FALSE);
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
orig = *iter;
|
||||
|
||||
|
||||
while (count != 0)
|
||||
{
|
||||
GtkTextLine *line = _gtk_text_iter_get_text_line (iter);
|
||||
@@ -3709,7 +3709,7 @@ gtk_text_layout_move_iter_visually (GtkTextLayout *layout,
|
||||
extra_back = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (new_index < 0 || (new_index == 0 && extra_back))
|
||||
{
|
||||
do
|
||||
@@ -3719,7 +3719,7 @@ gtk_text_layout_move_iter_visually (GtkTextLayout *layout,
|
||||
goto done;
|
||||
}
|
||||
while (totally_invisible_line (layout, line, &lineiter));
|
||||
|
||||
|
||||
gtk_text_line_display_unref (display);
|
||||
display = gtk_text_layout_get_line_display (layout, line, FALSE);
|
||||
gtk_text_iter_forward_to_line_end (&lineiter);
|
||||
@@ -3739,7 +3739,7 @@ gtk_text_layout_move_iter_visually (GtkTextLayout *layout,
|
||||
display = gtk_text_layout_get_line_display (layout, line, FALSE);
|
||||
new_index = 0;
|
||||
}
|
||||
|
||||
|
||||
line_display_index_to_iter (layout, display, iter, new_index, new_trailing);
|
||||
if (extra_back)
|
||||
gtk_text_iter_backward_char (iter);
|
||||
@@ -3748,7 +3748,7 @@ gtk_text_layout_move_iter_visually (GtkTextLayout *layout,
|
||||
g_clear_pointer (&display, gtk_text_line_display_unref);
|
||||
|
||||
done:
|
||||
|
||||
|
||||
return
|
||||
!gtk_text_iter_equal (iter, &orig) &&
|
||||
!gtk_text_iter_is_end (iter);
|
||||
|
||||
@@ -69,7 +69,7 @@ typedef struct _GtkWindow GtkWindow;
|
||||
* Refer to each function's documentation for if this value is
|
||||
* allowed and what it does.
|
||||
*/
|
||||
#define GTK_INVALID_LIST_POSITION (0xffffffffU)
|
||||
#define GTK_INVALID_LIST_POSITION ((guint) 0xffffffff)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -67,13 +67,8 @@ struct _GtkViewport
|
||||
|
||||
GtkWidget *child;
|
||||
|
||||
GtkAdjustment *hadjustment;
|
||||
GtkAdjustment *vadjustment;
|
||||
|
||||
/* GtkScrollablePolicy needs to be checked when
|
||||
* driving the scrollable adjustment values */
|
||||
guint hscroll_policy : 1;
|
||||
guint vscroll_policy : 1;
|
||||
GtkAdjustment *adjustment[2];
|
||||
GtkScrollablePolicy scroll_policy[2];
|
||||
guint scroll_to_focus : 1;
|
||||
|
||||
gulong focus_handler;
|
||||
@@ -150,66 +145,15 @@ gtk_viewport_buildable_init (GtkBuildableIface *iface)
|
||||
|
||||
static void
|
||||
viewport_set_adjustment_values (GtkViewport *viewport,
|
||||
GtkOrientation orientation)
|
||||
GtkOrientation orientation,
|
||||
int viewport_size,
|
||||
int child_size)
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
GtkScrollablePolicy scroll_policy;
|
||||
GtkScrollablePolicy other_scroll_policy;
|
||||
GtkOrientation other_orientation;
|
||||
double upper, value;
|
||||
int viewport_size, other_viewport_size;
|
||||
int view_width, view_height;
|
||||
|
||||
view_width = gtk_widget_get_width (GTK_WIDGET (viewport));
|
||||
view_height = gtk_widget_get_height (GTK_WIDGET (viewport));
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
adjustment = viewport->hadjustment;
|
||||
other_orientation = GTK_ORIENTATION_VERTICAL;
|
||||
viewport_size = view_width;
|
||||
other_viewport_size = view_height;
|
||||
scroll_policy = viewport->hscroll_policy;
|
||||
other_scroll_policy = viewport->vscroll_policy;
|
||||
}
|
||||
else /* VERTICAL */
|
||||
{
|
||||
adjustment = viewport->vadjustment;
|
||||
other_orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
viewport_size = view_height;
|
||||
other_viewport_size = view_width;
|
||||
scroll_policy = viewport->vscroll_policy;
|
||||
other_scroll_policy = viewport->hscroll_policy;
|
||||
}
|
||||
|
||||
|
||||
if (viewport->child && gtk_widget_get_visible (viewport->child))
|
||||
{
|
||||
int min_size, nat_size;
|
||||
int scroll_size;
|
||||
|
||||
if (other_scroll_policy == GTK_SCROLL_MINIMUM)
|
||||
gtk_widget_measure (viewport->child, other_orientation, -1,
|
||||
&scroll_size, NULL, NULL, NULL);
|
||||
else
|
||||
gtk_widget_measure (viewport->child, other_orientation, -1,
|
||||
NULL, &scroll_size, NULL, NULL);
|
||||
|
||||
gtk_widget_measure (viewport->child, orientation,
|
||||
MAX (other_viewport_size, scroll_size),
|
||||
&min_size, &nat_size, NULL, NULL);
|
||||
|
||||
if (scroll_policy == GTK_SCROLL_MINIMUM)
|
||||
upper = MAX (min_size, viewport_size);
|
||||
else
|
||||
upper = MAX (nat_size, viewport_size);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
upper = viewport_size;
|
||||
}
|
||||
|
||||
adjustment = viewport->adjustment[orientation];
|
||||
upper = child_size;
|
||||
value = gtk_adjustment_get_value (adjustment);
|
||||
|
||||
/* We clamp to the left in RTL mode */
|
||||
@@ -282,7 +226,7 @@ gtk_viewport_get_request_mode (GtkWidget *widget)
|
||||
|
||||
#define ADJUSTMENT_POINTER(orientation) \
|
||||
(((orientation) == GTK_ORIENTATION_HORIZONTAL) ? \
|
||||
&viewport->hadjustment : &viewport->vadjustment)
|
||||
&viewport->adjustment[GTK_ORIENTATION_HORIZONTAL] : &viewport->adjustment[GTK_ORIENTATION_VERTICAL])
|
||||
|
||||
static void
|
||||
viewport_disconnect_adjustment (GtkViewport *viewport,
|
||||
@@ -411,17 +355,17 @@ gtk_viewport_set_property (GObject *object,
|
||||
viewport_set_adjustment (viewport, GTK_ORIENTATION_VERTICAL, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
if (viewport->hscroll_policy != g_value_get_enum (value))
|
||||
if (viewport->scroll_policy[GTK_ORIENTATION_HORIZONTAL] != g_value_get_enum (value))
|
||||
{
|
||||
viewport->hscroll_policy = g_value_get_enum (value);
|
||||
viewport->scroll_policy[GTK_ORIENTATION_HORIZONTAL] = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (viewport));
|
||||
g_object_notify_by_pspec (object, pspec);
|
||||
}
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
if (viewport->vscroll_policy != g_value_get_enum (value))
|
||||
if (viewport->scroll_policy[GTK_ORIENTATION_VERTICAL] != g_value_get_enum (value))
|
||||
{
|
||||
viewport->vscroll_policy = g_value_get_enum (value);
|
||||
viewport->scroll_policy[GTK_ORIENTATION_VERTICAL] = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (viewport));
|
||||
g_object_notify_by_pspec (object, pspec);
|
||||
}
|
||||
@@ -449,16 +393,16 @@ gtk_viewport_get_property (GObject *object,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_HADJUSTMENT:
|
||||
g_value_set_object (value, viewport->hadjustment);
|
||||
g_value_set_object (value, viewport->adjustment[GTK_ORIENTATION_HORIZONTAL]);
|
||||
break;
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, viewport->vadjustment);
|
||||
g_value_set_object (value, viewport->adjustment[GTK_ORIENTATION_VERTICAL]);
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
g_value_set_enum (value, viewport->hscroll_policy);
|
||||
g_value_set_enum (value, viewport->scroll_policy[GTK_ORIENTATION_HORIZONTAL]);
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
g_value_set_enum (value, viewport->vscroll_policy);
|
||||
g_value_set_enum (value, viewport->scroll_policy[GTK_ORIENTATION_VERTICAL]);
|
||||
break;
|
||||
case PROP_SCROLL_TO_FOCUS:
|
||||
g_value_set_boolean (value, viewport->scroll_to_focus);
|
||||
@@ -481,8 +425,8 @@ gtk_viewport_init (GtkViewport *viewport)
|
||||
|
||||
gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN);
|
||||
|
||||
viewport->hadjustment = NULL;
|
||||
viewport->vadjustment = NULL;
|
||||
viewport->adjustment[GTK_ORIENTATION_HORIZONTAL] = NULL;
|
||||
viewport->adjustment[GTK_ORIENTATION_VERTICAL] = NULL;
|
||||
|
||||
viewport_set_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL, NULL);
|
||||
viewport_set_adjustment (viewport, GTK_ORIENTATION_VERTICAL, NULL);
|
||||
@@ -530,8 +474,6 @@ viewport_set_adjustment (GtkViewport *viewport,
|
||||
*adjustmentp = adjustment;
|
||||
g_object_ref_sink (adjustment);
|
||||
|
||||
viewport_set_adjustment_values (viewport, orientation);
|
||||
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_viewport_adjustment_value_changed),
|
||||
viewport);
|
||||
@@ -546,29 +488,61 @@ gtk_viewport_size_allocate (GtkWidget *widget,
|
||||
int baseline)
|
||||
{
|
||||
GtkViewport *viewport = GTK_VIEWPORT (widget);
|
||||
GtkAdjustment *hadjustment = viewport->hadjustment;
|
||||
GtkAdjustment *vadjustment = viewport->vadjustment;
|
||||
int child_size[2];
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (hadjustment));
|
||||
g_object_freeze_notify (G_OBJECT (vadjustment));
|
||||
g_object_freeze_notify (G_OBJECT (viewport->adjustment[GTK_ORIENTATION_HORIZONTAL]));
|
||||
g_object_freeze_notify (G_OBJECT (viewport->adjustment[GTK_ORIENTATION_VERTICAL]));
|
||||
|
||||
viewport_set_adjustment_values (viewport, GTK_ORIENTATION_HORIZONTAL);
|
||||
viewport_set_adjustment_values (viewport, GTK_ORIENTATION_VERTICAL);
|
||||
child_size[GTK_ORIENTATION_HORIZONTAL] = width;
|
||||
child_size[GTK_ORIENTATION_VERTICAL] = height;
|
||||
|
||||
if (viewport->child && gtk_widget_get_visible (viewport->child))
|
||||
{
|
||||
GtkOrientation orientation, opposite;
|
||||
int min, nat;
|
||||
|
||||
if (gtk_widget_get_request_mode (viewport->child) == GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT)
|
||||
orientation = GTK_ORIENTATION_VERTICAL;
|
||||
else
|
||||
orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
opposite = OPPOSITE_ORIENTATION (orientation);
|
||||
|
||||
gtk_widget_measure (viewport->child,
|
||||
orientation, -1,
|
||||
&min, &nat,
|
||||
NULL, NULL);
|
||||
if (viewport->scroll_policy[orientation] == GTK_SCROLL_MINIMUM)
|
||||
child_size[orientation] = MAX (child_size[orientation], min);
|
||||
else
|
||||
child_size[orientation] = MAX (child_size[orientation], nat);
|
||||
|
||||
gtk_widget_measure (viewport->child,
|
||||
opposite, child_size[orientation],
|
||||
&min, &nat,
|
||||
NULL, NULL);
|
||||
if (viewport->scroll_policy[opposite] == GTK_SCROLL_MINIMUM)
|
||||
child_size[opposite] = MAX (child_size[opposite], min);
|
||||
else
|
||||
child_size[opposite] = MAX (child_size[opposite], nat);
|
||||
}
|
||||
|
||||
viewport_set_adjustment_values (viewport, GTK_ORIENTATION_HORIZONTAL, width, child_size[GTK_ORIENTATION_HORIZONTAL]);
|
||||
viewport_set_adjustment_values (viewport, GTK_ORIENTATION_VERTICAL, height, child_size[GTK_ORIENTATION_VERTICAL]);
|
||||
|
||||
if (viewport->child && gtk_widget_get_visible (viewport->child))
|
||||
{
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
child_allocation.x = - gtk_adjustment_get_value (hadjustment);
|
||||
child_allocation.y = - gtk_adjustment_get_value (vadjustment);
|
||||
child_allocation.width = gtk_adjustment_get_upper (hadjustment);
|
||||
child_allocation.height = gtk_adjustment_get_upper (vadjustment);
|
||||
child_allocation.width = child_size[GTK_ORIENTATION_HORIZONTAL];
|
||||
child_allocation.height = child_size[GTK_ORIENTATION_VERTICAL];
|
||||
child_allocation.x = - gtk_adjustment_get_value (viewport->adjustment[GTK_ORIENTATION_HORIZONTAL]);
|
||||
child_allocation.y = - gtk_adjustment_get_value (viewport->adjustment[GTK_ORIENTATION_VERTICAL]);
|
||||
|
||||
gtk_widget_size_allocate (viewport->child, &child_allocation, -1);
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (hadjustment));
|
||||
g_object_thaw_notify (G_OBJECT (vadjustment));
|
||||
g_object_thaw_notify (G_OBJECT (viewport->adjustment[GTK_ORIENTATION_HORIZONTAL]));
|
||||
g_object_thaw_notify (G_OBJECT (viewport->adjustment[GTK_ORIENTATION_VERTICAL]));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -670,8 +644,8 @@ focus_change_handler (GtkWidget *widget)
|
||||
rect.origin.y,
|
||||
&x, &y);
|
||||
|
||||
scroll_to_view (viewport->hadjustment, x, rect.size.width);
|
||||
scroll_to_view (viewport->vadjustment, y, rect.size.height);
|
||||
scroll_to_view (viewport->adjustment[GTK_ORIENTATION_HORIZONTAL], x, rect.size.width);
|
||||
scroll_to_view (viewport->adjustment[GTK_ORIENTATION_VERTICAL], y, rect.size.height);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -682,7 +656,7 @@ setup_focus_change_handler (GtkViewport *viewport)
|
||||
root = gtk_widget_get_root (GTK_WIDGET (viewport));
|
||||
|
||||
viewport->focus_handler = g_signal_connect_swapped (root, "notify::focus-widget",
|
||||
G_CALLBACK (focus_change_handler), viewport);
|
||||
G_CALLBACK (focus_change_handler), viewport);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
316
gtk/inspector/clipboard.c
Normal file
316
gtk/inspector/clipboard.c
Normal file
@@ -0,0 +1,316 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include "clipboard.h"
|
||||
#include "gtkdataviewer.h"
|
||||
#include "window.h"
|
||||
|
||||
#include "gtkbinlayout.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtklistbox.h"
|
||||
#include "gtktogglebutton.h"
|
||||
|
||||
struct _GtkInspectorClipboard
|
||||
{
|
||||
GtkWidget parent;
|
||||
|
||||
GdkDisplay *display;
|
||||
|
||||
GtkWidget *swin;
|
||||
|
||||
GtkWidget *clipboard_formats;
|
||||
GtkWidget *clipboard_info;
|
||||
|
||||
GtkWidget *primary_formats;
|
||||
GtkWidget *primary_info;
|
||||
};
|
||||
|
||||
typedef struct _GtkInspectorClipboardClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
} GtkInspectorClipboardClass;
|
||||
|
||||
G_DEFINE_TYPE (GtkInspectorClipboard, gtk_inspector_clipboard, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
load_gtype_value (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer data)
|
||||
{
|
||||
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
|
||||
GtkDataViewer *viewer = data;
|
||||
const GValue *value;
|
||||
GError *error = NULL;
|
||||
|
||||
value = gdk_clipboard_read_value_finish (clipboard, res, &error);
|
||||
if (value == NULL)
|
||||
gtk_data_viewer_load_error (viewer, error);
|
||||
else
|
||||
gtk_data_viewer_load_value (viewer, value);
|
||||
|
||||
g_object_unref (viewer);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
load_gtype (GtkDataViewer *viewer,
|
||||
GCancellable *cancellable,
|
||||
gpointer gtype)
|
||||
{
|
||||
GdkClipboard *clipboard = g_object_get_data (G_OBJECT (viewer), "clipboard");
|
||||
|
||||
gdk_clipboard_read_value_async (clipboard,
|
||||
GPOINTER_TO_SIZE (gtype),
|
||||
G_PRIORITY_DEFAULT,
|
||||
cancellable,
|
||||
load_gtype_value,
|
||||
g_object_ref (viewer));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
load_mime_type_stream (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer data)
|
||||
{
|
||||
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
|
||||
GtkDataViewer *viewer = data;
|
||||
GInputStream *stream;
|
||||
GError *error = NULL;
|
||||
const char *mime_type;
|
||||
|
||||
stream = gdk_clipboard_read_finish (clipboard, res, &mime_type, &error);
|
||||
if (stream == NULL)
|
||||
gtk_data_viewer_load_error (viewer, error);
|
||||
else
|
||||
gtk_data_viewer_load_stream (viewer, stream, mime_type);
|
||||
|
||||
g_object_unref (viewer);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
load_mime_type (GtkDataViewer *viewer,
|
||||
GCancellable *cancellable,
|
||||
gpointer mime_type)
|
||||
{
|
||||
GdkClipboard *clipboard = g_object_get_data (G_OBJECT (viewer), "clipboard");
|
||||
|
||||
gdk_clipboard_read_async (clipboard,
|
||||
(const char *[2]) { mime_type, NULL },
|
||||
G_PRIORITY_DEFAULT,
|
||||
cancellable,
|
||||
load_mime_type_stream,
|
||||
g_object_ref (viewer));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
add_content_type_row (GtkInspectorClipboard *self,
|
||||
GtkListBox *list,
|
||||
const char *type_name,
|
||||
GdkClipboard *clipboard,
|
||||
GCallback load_func,
|
||||
gpointer load_func_data)
|
||||
{
|
||||
GtkWidget *row, *vbox, *hbox, *label, *viewer, *button;
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 40);
|
||||
gtk_box_append (GTK_BOX (vbox), hbox);
|
||||
|
||||
label = gtk_label_new (type_name);
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_box_append (GTK_BOX (hbox), label);
|
||||
|
||||
button = gtk_toggle_button_new_with_label (_("Show"));
|
||||
gtk_widget_set_halign (button, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
|
||||
gtk_box_append (GTK_BOX (hbox), button);
|
||||
|
||||
viewer = gtk_data_viewer_new ();
|
||||
g_signal_connect (viewer, "load", load_func, load_func_data);
|
||||
g_object_set_data (G_OBJECT (viewer), "clipboard", clipboard);
|
||||
g_object_bind_property (G_OBJECT (button), "active",
|
||||
G_OBJECT (viewer), "visible",
|
||||
G_BINDING_SYNC_CREATE);
|
||||
gtk_box_append (GTK_BOX (vbox), viewer);
|
||||
|
||||
row = gtk_list_box_row_new ();
|
||||
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), vbox);
|
||||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
||||
|
||||
gtk_list_box_insert (list, row, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
init_formats (GtkInspectorClipboard *self,
|
||||
GtkListBox *list,
|
||||
GdkClipboard *clipboard)
|
||||
{
|
||||
GtkListBoxRow *row;
|
||||
GdkContentFormats *formats;
|
||||
const char * const *mime_types;
|
||||
const GType *gtypes;
|
||||
gsize i, n;
|
||||
|
||||
while ((row = gtk_list_box_get_row_at_index (list, 1)))
|
||||
gtk_list_box_remove (list, GTK_WIDGET (row));
|
||||
|
||||
formats = gdk_clipboard_get_formats (clipboard);
|
||||
|
||||
gtypes = gdk_content_formats_get_gtypes (formats, &n);
|
||||
for (i = 0; i < n; i++)
|
||||
add_content_type_row (self, list, g_type_name (gtypes[i]), clipboard, G_CALLBACK (load_gtype), GSIZE_TO_POINTER (gtypes[i]));
|
||||
|
||||
mime_types = gdk_content_formats_get_mime_types (formats, &n);
|
||||
for (i = 0; i < n; i++)
|
||||
add_content_type_row (self, list, mime_types[i], clipboard, G_CALLBACK (load_mime_type), (gpointer) mime_types[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
init_info (GtkInspectorClipboard *self,
|
||||
GtkLabel *label,
|
||||
GdkClipboard *clipboard)
|
||||
{
|
||||
GdkContentFormats *formats;
|
||||
|
||||
formats = gdk_clipboard_get_formats (clipboard);
|
||||
if (gdk_content_formats_get_gtypes (formats, NULL) == NULL &&
|
||||
gdk_content_formats_get_mime_types (formats, NULL) == NULL)
|
||||
{
|
||||
gtk_label_set_text (label, C_("clipboard", "empty"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (gdk_clipboard_is_local (clipboard))
|
||||
gtk_label_set_text (label, C_("clipboard", "local"));
|
||||
else
|
||||
gtk_label_set_text (label, C_("clipboard", "remote"));
|
||||
}
|
||||
|
||||
static void
|
||||
clipboard_notify (GdkClipboard *clipboard,
|
||||
GParamSpec *pspec,
|
||||
GtkInspectorClipboard *self)
|
||||
{
|
||||
if (g_str_equal (pspec->name, "formats"))
|
||||
{
|
||||
init_formats (self, GTK_LIST_BOX (self->clipboard_formats), clipboard);
|
||||
}
|
||||
|
||||
init_info (self, GTK_LABEL (self->clipboard_info), clipboard);
|
||||
}
|
||||
|
||||
static void
|
||||
primary_notify (GdkClipboard *clipboard,
|
||||
GParamSpec *pspec,
|
||||
GtkInspectorClipboard *self)
|
||||
{
|
||||
if (g_str_equal (pspec->name, "formats"))
|
||||
{
|
||||
init_formats (self, GTK_LIST_BOX (self->primary_formats), clipboard);
|
||||
}
|
||||
|
||||
g_print ("%s: %s\n", pspec->name, gdk_content_formats_to_string (gdk_clipboard_get_formats (clipboard)));
|
||||
init_info (self, GTK_LABEL (self->primary_info), clipboard);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_clipboard_unset_display (GtkInspectorClipboard *self)
|
||||
{
|
||||
GdkClipboard *clipboard;
|
||||
|
||||
if (self->display == NULL)
|
||||
return;
|
||||
|
||||
clipboard = gdk_display_get_clipboard (self->display);
|
||||
g_signal_handlers_disconnect_by_func (clipboard, clipboard_notify, self);
|
||||
|
||||
clipboard = gdk_display_get_primary_clipboard (self->display);
|
||||
g_signal_handlers_disconnect_by_func (clipboard, primary_notify, self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_clipboard_init (GtkInspectorClipboard *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_clipboard_dispose (GObject *object)
|
||||
{
|
||||
GtkInspectorClipboard *self = GTK_INSPECTOR_CLIPBOARD (object);
|
||||
|
||||
gtk_inspector_clipboard_unset_display (self);
|
||||
|
||||
g_clear_pointer (&self->swin, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (gtk_inspector_clipboard_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_clipboard_class_init (GtkInspectorClipboardClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = gtk_inspector_clipboard_dispose;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/clipboard.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, swin);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, clipboard_formats);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, clipboard_info);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, primary_formats);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, primary_info);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_inspector_clipboard_set_display (GtkInspectorClipboard *self,
|
||||
GdkDisplay *display)
|
||||
{
|
||||
GdkClipboard *clipboard;
|
||||
|
||||
gtk_inspector_clipboard_unset_display (self);
|
||||
|
||||
self->display = display;
|
||||
|
||||
if (display == NULL)
|
||||
return;
|
||||
|
||||
clipboard = gdk_display_get_clipboard (display);
|
||||
g_signal_connect (clipboard, "notify", G_CALLBACK (clipboard_notify), self);
|
||||
init_formats (self, GTK_LIST_BOX (self->clipboard_formats), clipboard);
|
||||
init_info (self, GTK_LABEL (self->clipboard_info), clipboard);
|
||||
|
||||
clipboard = gdk_display_get_primary_clipboard (display);
|
||||
g_signal_connect (clipboard, "notify", G_CALLBACK (primary_notify), self);
|
||||
init_formats (self, GTK_LIST_BOX (self->primary_formats), clipboard);
|
||||
init_info (self, GTK_LABEL (self->primary_info), clipboard);
|
||||
}
|
||||
|
||||
38
gtk/inspector/clipboard.h
Normal file
38
gtk/inspector/clipboard.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _GTK_INSPECTOR_CLIPBOARD_H_
|
||||
#define _GTK_INSPECTOR_CLIPBOARD_H_
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
#define GTK_TYPE_INSPECTOR_CLIPBOARD (gtk_inspector_clipboard_get_type())
|
||||
#define GTK_INSPECTOR_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_CLIPBOARD, GtkInspectorClipboard))
|
||||
#define GTK_INSPECTOR_IS_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_CLIPBOARD))
|
||||
|
||||
typedef struct _GtkInspectorClipboard GtkInspectorClipboard;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType gtk_inspector_clipboard_get_type (void);
|
||||
|
||||
void gtk_inspector_clipboard_set_display (GtkInspectorClipboard *self,
|
||||
GdkDisplay *display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // _GTK_INSPECTOR_CLIPBOARD_H_
|
||||
98
gtk/inspector/clipboard.ui
Normal file
98
gtk/inspector/clipboard.ui
Normal file
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface domain="gtk40">
|
||||
<template class="GtkInspectorClipboard" parent="GtkWidget">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="swin">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin-start">60</property>
|
||||
<property name="margin-end">60</property>
|
||||
<property name="margin-top">60</property>
|
||||
<property name="margin-bottom">60</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child>
|
||||
<object class="GtkListBox" id="clipboard_formats">
|
||||
<property name="selection-mode">none</property>
|
||||
<style>
|
||||
<class name="rich-list"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Clipboard</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="clipboard_info">
|
||||
<property name="selectable">1</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child>
|
||||
<object class="GtkListBox" id="primary_formats">
|
||||
<property name="selection-mode">none</property>
|
||||
<style>
|
||||
<class name="rich-list"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Primary</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="primary_info">
|
||||
<property name="selectable">1</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
||||
412
gtk/inspector/gtkdataviewer.c
Normal file
412
gtk/inspector/gtkdataviewer.c
Normal file
@@ -0,0 +1,412 @@
|
||||
/*
|
||||
* Copyright © 2021 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkdataviewer.h"
|
||||
|
||||
#include "gtkbinlayout.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkpicture.h"
|
||||
#include "gtkcolorswatchprivate.h"
|
||||
#include "gtkbox.h"
|
||||
|
||||
|
||||
struct _GtkDataViewer
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GtkWidget *contents;
|
||||
GCancellable *cancellable;
|
||||
GError *error;
|
||||
|
||||
enum {
|
||||
NOT_LOADED = 0,
|
||||
LOADING_DONE,
|
||||
LOADING_EXTERNALLY,
|
||||
LOADING_INTERNALLY,
|
||||
LOADING_FAILED
|
||||
} loading;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_LOADING,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
enum {
|
||||
LOAD,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkDataViewer, gtk_data_viewer, GTK_TYPE_WIDGET)
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
static guint signals[LAST_SIGNAL];
|
||||
|
||||
static void
|
||||
gtk_data_viewer_ensure_loaded (GtkDataViewer *self)
|
||||
{
|
||||
gboolean started_loading;
|
||||
|
||||
if (self->loading != NOT_LOADED)
|
||||
return;
|
||||
|
||||
self->loading = LOADING_EXTERNALLY;
|
||||
self->cancellable = g_cancellable_new ();
|
||||
g_signal_emit (self, signals[LOAD], 0, self->cancellable, &started_loading);
|
||||
|
||||
if (!started_loading)
|
||||
{
|
||||
self->loading = LOADING_FAILED; /* avoid notify::is_loading */
|
||||
gtk_data_viewer_load_error (self, g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED, "Nothing to load"));
|
||||
}
|
||||
|
||||
g_assert (self->loading != NOT_LOADED);
|
||||
|
||||
if (gtk_data_viewer_is_loading (self))
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LOADING]);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_data_viewer_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkDataViewer *self = GTK_DATA_VIEWER (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_data_viewer_parent_class)->realize (widget);
|
||||
|
||||
gtk_data_viewer_ensure_loaded (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_data_viewer_unrealize (GtkWidget *widget)
|
||||
{
|
||||
GtkDataViewer *self = GTK_DATA_VIEWER (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_data_viewer_parent_class)->unrealize (widget);
|
||||
|
||||
gtk_data_viewer_reset (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_data_viewer_dispose (GObject *object)
|
||||
{
|
||||
//GtkDataViewer *self = GTK_DATA_VIEWER (object);
|
||||
|
||||
G_OBJECT_CLASS (gtk_data_viewer_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_data_viewer_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkDataViewer *self = GTK_DATA_VIEWER (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_LOADING:
|
||||
g_value_set_boolean (value, gtk_data_viewer_is_loading (self));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_data_viewer_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
//GtkDataViewer *self = GTK_DATA_VIEWER (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_data_viewer_class_init (GtkDataViewerClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
widget_class->realize = gtk_data_viewer_realize;
|
||||
widget_class->unrealize = gtk_data_viewer_unrealize;
|
||||
|
||||
gobject_class->dispose = gtk_data_viewer_dispose;
|
||||
gobject_class->get_property = gtk_data_viewer_get_property;
|
||||
gobject_class->set_property = gtk_data_viewer_set_property;
|
||||
|
||||
properties[PROP_LOADING] =
|
||||
g_param_spec_boolean ("loading",
|
||||
"Loading",
|
||||
"If the widget is currently loading the data to display",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
|
||||
signals[LOAD] =
|
||||
g_signal_new ("load",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
g_signal_accumulator_first_wins, NULL,
|
||||
NULL,
|
||||
G_TYPE_BOOLEAN, 1,
|
||||
G_TYPE_CANCELLABLE);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
gtk_widget_class_set_css_name (widget_class, "frame");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_data_viewer_init (GtkDataViewer *self)
|
||||
{
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_data_viewer_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_DATA_VIEWER, NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_data_viewer_is_loading (GtkDataViewer *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_DATA_VIEWER (self), FALSE);
|
||||
|
||||
return self->loading == LOADING_EXTERNALLY ||
|
||||
self->loading == LOADING_INTERNALLY;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_data_viewer_reset (GtkDataViewer *self)
|
||||
{
|
||||
gboolean was_loading;
|
||||
|
||||
g_return_if_fail (GTK_IS_DATA_VIEWER (self));
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (self));
|
||||
|
||||
was_loading = gtk_data_viewer_is_loading (self);
|
||||
|
||||
g_clear_pointer (&self->contents, gtk_widget_unparent);
|
||||
g_clear_error (&self->error);
|
||||
g_cancellable_cancel (self->cancellable);
|
||||
g_clear_object (&self->cancellable);
|
||||
|
||||
self->loading = NOT_LOADED;
|
||||
|
||||
if (gtk_widget_get_realized (GTK_WIDGET (self)))
|
||||
gtk_data_viewer_ensure_loaded (self);
|
||||
|
||||
if (was_loading != gtk_data_viewer_is_loading (self))
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LOADING]);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (self));
|
||||
}
|
||||
|
||||
void
|
||||
gtk_data_viewer_load_value (GtkDataViewer *self,
|
||||
const GValue *value)
|
||||
{
|
||||
gboolean was_loading;
|
||||
|
||||
g_return_if_fail (GTK_IS_DATA_VIEWER (self));
|
||||
|
||||
was_loading = gtk_data_viewer_is_loading (self);
|
||||
self->loading = LOADING_DONE;
|
||||
|
||||
g_clear_pointer (&self->contents, gtk_widget_unparent);
|
||||
g_cancellable_cancel (self->cancellable);
|
||||
g_clear_object (&self->cancellable);
|
||||
|
||||
if (g_type_is_a (G_VALUE_TYPE (value), G_TYPE_STRING))
|
||||
{
|
||||
self->contents = gtk_label_new (g_value_get_string (value));
|
||||
gtk_label_set_wrap (GTK_LABEL (self->contents), TRUE);
|
||||
gtk_widget_set_parent (self->contents, GTK_WIDGET (self));
|
||||
}
|
||||
else if (g_type_is_a (G_VALUE_TYPE (value), GDK_TYPE_PAINTABLE))
|
||||
{
|
||||
self->contents = gtk_picture_new_for_paintable (g_value_get_object (value));
|
||||
gtk_widget_set_size_request (self->contents, 256, 256);
|
||||
gtk_widget_set_parent (self->contents, GTK_WIDGET (self));
|
||||
}
|
||||
else if (g_type_is_a (G_VALUE_TYPE (value), GDK_TYPE_PIXBUF))
|
||||
{
|
||||
self->contents = gtk_picture_new_for_pixbuf (g_value_get_object (value));
|
||||
gtk_widget_set_size_request (self->contents, 256, 256);
|
||||
gtk_widget_set_parent (self->contents, GTK_WIDGET (self));
|
||||
}
|
||||
else if (g_type_is_a (G_VALUE_TYPE (value), GDK_TYPE_RGBA))
|
||||
{
|
||||
const GdkRGBA *color = g_value_get_boxed (value);
|
||||
|
||||
self->contents = gtk_color_swatch_new ();
|
||||
gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (self->contents), color);
|
||||
gtk_widget_set_size_request (self->contents, 48, 32);
|
||||
gtk_widget_set_halign (self->contents, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_parent (self->contents, GTK_WIDGET (self));
|
||||
}
|
||||
else if (g_type_is_a (G_VALUE_TYPE (value), G_TYPE_FILE))
|
||||
{
|
||||
GFile *file = g_value_get_object (value);
|
||||
|
||||
self->contents = gtk_label_new (g_file_peek_path (file));
|
||||
gtk_label_set_ellipsize (GTK_LABEL (self->contents), PANGO_ELLIPSIZE_START);
|
||||
gtk_widget_set_halign (self->contents, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_parent (self->contents, GTK_WIDGET (self));
|
||||
}
|
||||
else if (g_type_is_a (G_VALUE_TYPE (value), GDK_TYPE_FILE_LIST))
|
||||
{
|
||||
GList *l;
|
||||
|
||||
self->contents = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_widget_set_parent (self->contents, GTK_WIDGET (self));
|
||||
|
||||
for (l = g_value_get_boxed (value); l; l = l->next)
|
||||
{
|
||||
GFile *file = l->data;
|
||||
GtkWidget *label = gtk_label_new (g_file_peek_path (file));
|
||||
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_START);
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
|
||||
gtk_box_append (GTK_BOX (self->contents), label);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_data_viewer_load_error (self,
|
||||
g_error_new (G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"Cannot display objects of type \"%s\"", G_VALUE_TYPE_NAME (value)));
|
||||
}
|
||||
|
||||
if (was_loading)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LOADING]);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_data_viewer_load_stream_done (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer data)
|
||||
{
|
||||
GtkDataViewer *self = data;
|
||||
GError *error = NULL;
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
if (!gdk_content_deserialize_finish (res, &value, &error))
|
||||
{
|
||||
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
gtk_data_viewer_load_error (self, error);
|
||||
else
|
||||
g_clear_error (&error);
|
||||
|
||||
g_object_unref (self);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_data_viewer_load_value (self, &value);
|
||||
g_object_unref (self);
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_data_viewer_load_stream (GtkDataViewer *self,
|
||||
GInputStream *stream,
|
||||
const char *mime_type)
|
||||
{
|
||||
GdkContentFormats *formats;
|
||||
const GType *gtypes;
|
||||
gboolean was_loading;
|
||||
|
||||
g_return_if_fail (GTK_IS_DATA_VIEWER (self));
|
||||
g_return_if_fail (G_IS_INPUT_STREAM (stream));
|
||||
g_return_if_fail (mime_type != NULL);
|
||||
|
||||
was_loading = gtk_data_viewer_is_loading (self);
|
||||
self->loading = LOADING_INTERNALLY;
|
||||
if (self->cancellable == NULL)
|
||||
self->cancellable = g_cancellable_new ();
|
||||
|
||||
formats = gdk_content_formats_new (&mime_type, 1);
|
||||
formats = gdk_content_formats_union_deserialize_gtypes (formats);
|
||||
gtypes = gdk_content_formats_get_gtypes (formats, NULL);
|
||||
if (gtypes)
|
||||
{
|
||||
gdk_content_deserialize_async (stream,
|
||||
mime_type,
|
||||
gtypes[0],
|
||||
G_PRIORITY_DEFAULT,
|
||||
self->cancellable,
|
||||
gtk_data_viewer_load_stream_done,
|
||||
g_object_ref (self));
|
||||
|
||||
if (!was_loading)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LOADING]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_data_viewer_load_error (self,
|
||||
g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Cannot display data of type \"%s\"", mime_type));
|
||||
}
|
||||
|
||||
gdk_content_formats_unref (formats);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_data_viewer_load_error (GtkDataViewer *self,
|
||||
GError *error)
|
||||
{
|
||||
gboolean was_loading;
|
||||
|
||||
g_return_if_fail (GTK_IS_DATA_VIEWER (self));
|
||||
|
||||
was_loading = gtk_data_viewer_is_loading (self);
|
||||
self->loading = LOADING_FAILED;
|
||||
|
||||
g_clear_pointer (&self->contents, gtk_widget_unparent);
|
||||
g_clear_error (&self->error);
|
||||
g_cancellable_cancel (self->cancellable);
|
||||
g_clear_object (&self->cancellable);
|
||||
|
||||
self->error = error;
|
||||
self->contents = gtk_label_new (error->message);
|
||||
gtk_widget_add_css_class (self->contents, "error");
|
||||
gtk_widget_set_halign (self->contents, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (self->contents, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_parent (self->contents, GTK_WIDGET (self));
|
||||
|
||||
if (was_loading)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LOADING]);
|
||||
}
|
||||
|
||||
47
gtk/inspector/gtkdataviewer.h
Normal file
47
gtk/inspector/gtkdataviewer.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright © 2021 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GTK_DATA_VIEWER_H__
|
||||
#define __GTK_DATA_VIEWER_H__
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_DATA_VIEWER (gtk_data_viewer_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GtkDataViewer, gtk_data_viewer, GTK, DATA_VIEWER, GtkWidget)
|
||||
|
||||
GtkWidget * gtk_data_viewer_new (void);
|
||||
|
||||
gboolean gtk_data_viewer_is_loading (GtkDataViewer *self);
|
||||
|
||||
void gtk_data_viewer_reset (GtkDataViewer *self);
|
||||
|
||||
void gtk_data_viewer_load_value (GtkDataViewer *self,
|
||||
const GValue *value);
|
||||
void gtk_data_viewer_load_stream (GtkDataViewer *self,
|
||||
GInputStream *stream,
|
||||
const char *mime_type);
|
||||
void gtk_data_viewer_load_error (GtkDataViewer *self,
|
||||
GError *error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_DATA_VIEWER_H__ */
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "a11y.h"
|
||||
#include "actions.h"
|
||||
#include "cellrenderergraph.h"
|
||||
#include "clipboard.h"
|
||||
#include "controllers.h"
|
||||
#include "css-editor.h"
|
||||
#include "css-node-tree.h"
|
||||
@@ -64,6 +65,7 @@ gtk_inspector_init (void)
|
||||
g_type_ensure (GTK_TYPE_GRAPH_DATA);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_A11Y);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_ACTIONS);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_CLIPBOARD);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_CONTROLLERS);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_CSS_EDITOR);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_CSS_NODE_TREE);
|
||||
|
||||
@@ -5,6 +5,7 @@ inspector_sources = files(
|
||||
'actions.c',
|
||||
'baselineoverlay.c',
|
||||
'cellrenderergraph.c',
|
||||
'clipboard.c',
|
||||
'controllers.c',
|
||||
'css-editor.c',
|
||||
'css-node-tree.c',
|
||||
@@ -13,6 +14,7 @@ inspector_sources = files(
|
||||
'general.c',
|
||||
'graphdata.c',
|
||||
'gtktreemodelcssnode.c',
|
||||
'gtkdataviewer.c',
|
||||
'highlightoverlay.c',
|
||||
'init.c',
|
||||
'inspect-button.c',
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "init.h"
|
||||
#include "window.h"
|
||||
#include "prop-list.h"
|
||||
#include "clipboard.h"
|
||||
#include "controllers.h"
|
||||
#include "css-editor.h"
|
||||
#include "css-node-tree.h"
|
||||
@@ -298,6 +299,7 @@ gtk_inspector_window_constructed (GObject *object)
|
||||
gtk_inspector_css_editor_set_display (GTK_INSPECTOR_CSS_EDITOR (iw->css_editor), iw->inspected_display);
|
||||
gtk_inspector_visual_set_display (GTK_INSPECTOR_VISUAL (iw->visual), iw->inspected_display);
|
||||
gtk_inspector_general_set_display (GTK_INSPECTOR_GENERAL (iw->general), iw->inspected_display);
|
||||
gtk_inspector_clipboard_set_display (GTK_INSPECTOR_CLIPBOARD (iw->clipboard), iw->inspected_display);
|
||||
gtk_inspector_logs_set_display (GTK_INSPECTOR_LOGS (iw->logs), iw->inspected_display);
|
||||
gtk_inspector_css_node_tree_set_display (GTK_INSPECTOR_CSS_NODE_TREE (iw->widget_css_node_tree), iw->inspected_display);
|
||||
}
|
||||
@@ -652,6 +654,7 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, css_editor);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, visual);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, general);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, clipboard);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, logs);
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, go_up_button);
|
||||
|
||||
@@ -76,6 +76,7 @@ typedef struct
|
||||
GtkWidget *sidebar_revealer;
|
||||
GtkWidget *css_editor;
|
||||
GtkWidget *visual;
|
||||
GtkWidget *clipboard;
|
||||
GtkWidget *general;
|
||||
GtkWidget *logs;
|
||||
|
||||
|
||||
@@ -130,6 +130,14 @@
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">clipboard</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox"/>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">statistics</property>
|
||||
@@ -560,6 +568,16 @@
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">clipboard</property>
|
||||
<property name="title" translatable="yes">Clipboard</property>
|
||||
<property name="child">
|
||||
<object class="GtkInspectorClipboard" id="clipboard">
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">statistics</property>
|
||||
|
||||
@@ -56,6 +56,7 @@ $backdrop_bg_color: $bg_color;
|
||||
$backdrop_fg_color: mix($fg_color, $backdrop_bg_color, 50%);
|
||||
$backdrop_insensitive_color: if($variant == 'light', darken($backdrop_bg_color, 15%), lighten($backdrop_bg_color, 15%));
|
||||
$backdrop_selected_fg_color: if($variant == 'light', $backdrop_base_color, $backdrop_text_color);
|
||||
$backdrop_selected_bg_color: transparentize(desaturate($selected_bg_color,100%),0.5);
|
||||
$backdrop_borders_color: mix($borders_color, $bg_color, 80%);
|
||||
$backdrop_dark_fill: mix($backdrop_borders_color, $backdrop_bg_color, 35%);
|
||||
|
||||
|
||||
@@ -66,7 +66,13 @@ textview {
|
||||
> text {
|
||||
@extend %view;
|
||||
|
||||
> selection { &:focus, & { @extend %selected_items; }}
|
||||
> selection {
|
||||
background-color: $backdrop_selected_bg_color;
|
||||
|
||||
&:focus-within {
|
||||
background-color: $selected_bg_color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:drop(active) {
|
||||
@@ -152,8 +158,11 @@ label {
|
||||
&:selected { @extend %nobg_selected_items; }
|
||||
|
||||
> selection {
|
||||
background-color: $selected_bg_color;
|
||||
background-color: $backdrop_selected_bg_color;
|
||||
color: $selected_fg_color;
|
||||
&:focus-within {
|
||||
background-color: $selected_bg_color;
|
||||
}
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
@@ -318,7 +327,14 @@ entry {
|
||||
|
||||
&:disabled { @include entry(insensitive); }
|
||||
|
||||
> text > selection { @extend %selected_items; }
|
||||
> text > selection {
|
||||
background-color: $backdrop_selected_bg_color;
|
||||
color: transparent;
|
||||
&:focus-within {
|
||||
background-color: $selected_bg_color;
|
||||
color: $selected_fg_color;
|
||||
}
|
||||
}
|
||||
|
||||
// entry error and warning style
|
||||
@each $e_type, $e_color in (error, $error_color),
|
||||
@@ -1134,7 +1150,14 @@ spinbutton {
|
||||
padding: 0;
|
||||
border-radius: 0;
|
||||
|
||||
> selection { @extend %selected_items; }
|
||||
> selection {
|
||||
background-color: $backdrop_selected_bg_color;
|
||||
color: transparent;
|
||||
&:focus-within {
|
||||
background-color: $selected_bg_color;
|
||||
color: $selected_fg_color;
|
||||
}
|
||||
}
|
||||
> block-cursor { @include entry(block_cursor); }
|
||||
}
|
||||
|
||||
@@ -3357,8 +3380,12 @@ columnview row:not(:selected) cell editablelabel.editing:focus-within {
|
||||
}
|
||||
|
||||
columnview row:not(:selected) cell editablelabel.editing text selection {
|
||||
color: $selected_fg_color;
|
||||
background-color: $selected_bg_color;
|
||||
background-color: $backdrop_selected_bg_color;
|
||||
color: transparent;
|
||||
&:focus-within {
|
||||
background-color: $selected_bg_color;
|
||||
color: $selected_fg_color;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************
|
||||
@@ -4127,11 +4154,7 @@ tooltip.csd {
|
||||
// catch all extend :)
|
||||
|
||||
%selected_items {
|
||||
background-color: desaturate($selected_bg_color,100%);
|
||||
|
||||
&:focus-within {
|
||||
background-color: $selected_bg_color;
|
||||
}
|
||||
background-color: $selected_bg_color;
|
||||
|
||||
@at-root %nobg_selected_items, & {
|
||||
color: $selected_fg_color;
|
||||
|
||||
BIN
gtk/ui/gtkaboutdialog.ui.precompiled
Normal file
BIN
gtk/ui/gtkaboutdialog.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkappchooserdialog.ui.precompiled
Normal file
BIN
gtk/ui/gtkappchooserdialog.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkappchooserwidget.ui.precompiled
Normal file
BIN
gtk/ui/gtkappchooserwidget.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkapplication-quartz.ui.precompiled
Normal file
BIN
gtk/ui/gtkapplication-quartz.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkassistant.ui.precompiled
Normal file
BIN
gtk/ui/gtkassistant.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkcolorchooserdialog.ui.precompiled
Normal file
BIN
gtk/ui/gtkcolorchooserdialog.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkcoloreditor.ui.precompiled
Normal file
BIN
gtk/ui/gtkcoloreditor.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkcombobox.ui.precompiled
Normal file
BIN
gtk/ui/gtkcombobox.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkdialog.ui.precompiled
Normal file
BIN
gtk/ui/gtkdialog.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkdropdown.ui.precompiled
Normal file
BIN
gtk/ui/gtkdropdown.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkemojichooser.ui.precompiled
Normal file
BIN
gtk/ui/gtkemojichooser.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkemojicompletion.ui.precompiled
Normal file
BIN
gtk/ui/gtkemojicompletion.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkfilechooserdialog.ui.precompiled
Normal file
BIN
gtk/ui/gtkfilechooserdialog.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkfilechooserwidget.ui.precompiled
Normal file
BIN
gtk/ui/gtkfilechooserwidget.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkfontchooserdialog.ui.precompiled
Normal file
BIN
gtk/ui/gtkfontchooserdialog.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkfontchooserwidget.ui.precompiled
Normal file
BIN
gtk/ui/gtkfontchooserwidget.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtklockbutton.ui.precompiled
Normal file
BIN
gtk/ui/gtklockbutton.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkmediacontrols.ui.precompiled
Normal file
BIN
gtk/ui/gtkmediacontrols.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkmessagedialog.ui.precompiled
Normal file
BIN
gtk/ui/gtkmessagedialog.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkpagesetupunixdialog.ui.precompiled
Normal file
BIN
gtk/ui/gtkpagesetupunixdialog.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkplacesview.ui.precompiled
Normal file
BIN
gtk/ui/gtkplacesview.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkplacesviewrow.ui.precompiled
Normal file
BIN
gtk/ui/gtkplacesviewrow.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkprintunixdialog.ui.precompiled
Normal file
BIN
gtk/ui/gtkprintunixdialog.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkscalebutton.ui.precompiled
Normal file
BIN
gtk/ui/gtkscalebutton.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtksidebarrow.ui.precompiled
Normal file
BIN
gtk/ui/gtksidebarrow.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkstatusbar.ui.precompiled
Normal file
BIN
gtk/ui/gtkstatusbar.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtktooltipwindow.ui.precompiled
Normal file
BIN
gtk/ui/gtktooltipwindow.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkvideo.ui.precompiled
Normal file
BIN
gtk/ui/gtkvideo.ui.precompiled
Normal file
Binary file not shown.
BIN
gtk/ui/gtkvolumebutton.ui.precompiled
Normal file
BIN
gtk/ui/gtkvolumebutton.ui.precompiled
Normal file
Binary file not shown.
@@ -7,7 +7,7 @@ project('gtk', 'c',
|
||||
# https://github.com/mesonbuild/meson/issues/2289
|
||||
'c_std=gnu99',
|
||||
],
|
||||
meson_version : '>= 0.55',
|
||||
meson_version : '>= 0.59',
|
||||
license: 'LGPL-2.1-or-later')
|
||||
|
||||
glib_req = '>= 2.66.0'
|
||||
@@ -861,7 +861,7 @@ common_pc_variables = [
|
||||
foreach pkg: pkgs
|
||||
pkg_config.generate(
|
||||
filebase: pkg,
|
||||
variables: common_pc_variables,
|
||||
unescaped_variables: common_pc_variables,
|
||||
name: 'GTK',
|
||||
description: 'GTK Graphical UI Library',
|
||||
requires: gdk_packages + gsk_packages + gtk_packages,
|
||||
@@ -877,7 +877,7 @@ endforeach
|
||||
if os_unix
|
||||
pkg_config.generate(
|
||||
filebase: 'gtk4-unix-print',
|
||||
variables: common_pc_variables,
|
||||
unescaped_variables: common_pc_variables,
|
||||
name: 'GTK',
|
||||
description: 'GTK Unix print support',
|
||||
requires: ['gtk4'] + gtk_packages,
|
||||
|
||||
@@ -137,11 +137,13 @@ gtk_gst_media_file_ensure_prepared (GtkGstMediaFile *self)
|
||||
media_info = gst_player_get_media_info (self->player);
|
||||
if (media_info)
|
||||
{
|
||||
GstClockTime duration = gst_player_media_info_get_duration (media_info);
|
||||
|
||||
gtk_media_stream_stream_prepared (GTK_MEDIA_STREAM (self),
|
||||
gst_player_media_info_get_audio_streams (media_info) != NULL,
|
||||
gst_player_media_info_get_video_streams (media_info) != NULL,
|
||||
gst_player_media_info_is_seekable (media_info),
|
||||
FROM_GST_TIME (gst_player_media_info_get_duration (media_info)));
|
||||
duration == GST_CLOCK_TIME_NONE ? 0 : FROM_GST_TIME (duration));
|
||||
|
||||
g_object_unref (media_info);
|
||||
}
|
||||
|
||||
@@ -332,6 +332,7 @@ gtk/gtkwindow.c
|
||||
gtk/gtkwindowcontrols.c
|
||||
gtk/gtkwindowhandle.c
|
||||
gtk/inspector/action-editor.c
|
||||
gtk/inspector/clipboard.c
|
||||
gtk/inspector/controllers.c
|
||||
gtk/inspector/css-editor.c
|
||||
gtk/inspector/css-node-tree.c
|
||||
|
||||
@@ -94,6 +94,7 @@ examples/plugman.c
|
||||
gtk/inspector/a11y.ui
|
||||
gtk/inspector/actions.ui
|
||||
gtk/inspector/actions.ui.h
|
||||
gtk/inspector/clipboard.ui
|
||||
gtk/inspector/css-editor.ui
|
||||
gtk/inspector/css-editor.ui.h
|
||||
gtk/inspector/css-node-tree.ui
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -337,6 +337,8 @@ gtk/gtkwindowhandle.c
|
||||
gtk/inspector/a11y.ui
|
||||
gtk/inspector/action-editor.c
|
||||
gtk/inspector/actions.ui
|
||||
gtk/inspector/clipboard.c
|
||||
gtk/inspector/clipboard.ui
|
||||
gtk/inspector/controllers.c
|
||||
gtk/inspector/css-editor.c
|
||||
gtk/inspector/css-editor.ui
|
||||
|
||||
297
po/pt.po
297
po/pt.po
@@ -12,8 +12,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 3.10\n"
|
||||
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gtk/-/issues/\n"
|
||||
"POT-Creation-Date: 2021-11-07 07:53+0000\n"
|
||||
"PO-Revision-Date: 2021-11-07 21:24+0000\n"
|
||||
"POT-Creation-Date: 2021-12-12 12:57+0000\n"
|
||||
"PO-Revision-Date: 2021-12-12 16:25+0000\n"
|
||||
"Last-Translator: Hugo Carvalho <hugokarvalho@hotmail.com>\n"
|
||||
"Language-Team: Português <https://l10n.gnome.org/teams/pt/>\n"
|
||||
"Language: pt\n"
|
||||
@@ -21,7 +21,7 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Poedit 3.0\n"
|
||||
"X-Generator: Poedit 3.0.1\n"
|
||||
|
||||
#: gdk/broadway/gdkbroadway-server.c:135
|
||||
#, c-format
|
||||
@@ -60,47 +60,47 @@ msgstr "O motor atual não suporta OpenGL"
|
||||
msgid "GL support disabled via GDK_DEBUG"
|
||||
msgstr "Suporte GL desativado via GDK_DEBUG"
|
||||
|
||||
#: gdk/gdkdisplay.c:1569
|
||||
#: gdk/gdkdisplay.c:1544
|
||||
msgid "No EGL configuration available"
|
||||
msgstr "Nenhuma configuração EGL disponível"
|
||||
|
||||
#: gdk/gdkdisplay.c:1577
|
||||
#: gdk/gdkdisplay.c:1552
|
||||
msgid "Failed to get EGL configurations"
|
||||
msgstr "Falha ao obter configurações EGL"
|
||||
|
||||
#: gdk/gdkdisplay.c:1607
|
||||
#: gdk/gdkdisplay.c:1582
|
||||
msgid "No EGL configuration with required features found"
|
||||
msgstr ""
|
||||
"Não foi encontrada nenhuma configuração de EGL com as características "
|
||||
"necessárias"
|
||||
|
||||
#: gdk/gdkdisplay.c:1614
|
||||
#: gdk/gdkdisplay.c:1589
|
||||
msgid "No perfect EGL configuration found"
|
||||
msgstr "Não foi encontrada nenhuma configuração de EGL perfeita"
|
||||
|
||||
#: gdk/gdkdisplay.c:1656
|
||||
#: gdk/gdkdisplay.c:1631
|
||||
msgid "EGL implementation is missing extension %2$s"
|
||||
msgid_plural "EGL implementation is missing %d extensions: %s"
|
||||
msgstr[0] "Implementação da EGL com extensão %2$s em falta"
|
||||
msgstr[1] "Implementação da EGL está com %d extensões em falta: %s"
|
||||
|
||||
#: gdk/gdkdisplay.c:1689
|
||||
#: gdk/gdkdisplay.c:1664
|
||||
msgid "libEGL not available in this sandbox"
|
||||
msgstr "libEGL não disponível nesta sandbox"
|
||||
|
||||
#: gdk/gdkdisplay.c:1690
|
||||
#: gdk/gdkdisplay.c:1665
|
||||
msgid "libEGL not available"
|
||||
msgstr "libEGL não disponível"
|
||||
|
||||
#: gdk/gdkdisplay.c:1700
|
||||
#: gdk/gdkdisplay.c:1675
|
||||
msgid "Failed to create EGL display"
|
||||
msgstr "Falha ao criar o EGL display"
|
||||
|
||||
#: gdk/gdkdisplay.c:1710
|
||||
#: gdk/gdkdisplay.c:1685
|
||||
msgid "Could not initialize EGL display"
|
||||
msgstr "Não foi possível iniciar o EGL display"
|
||||
|
||||
#: gdk/gdkdisplay.c:1721
|
||||
#: gdk/gdkdisplay.c:1696
|
||||
#, c-format
|
||||
msgid "EGL version %d.%d is too old. GTK requires %d.%d"
|
||||
msgstr "A versão EGL %d.%d é muito antiga. O GTK requer %d.%d"
|
||||
@@ -117,8 +117,8 @@ msgstr "Nenhum formato compatível para transferir conteúdo de transferência."
|
||||
msgid "The EGL implementation does not support any allowed APIs"
|
||||
msgstr "A implementação da EGL não suporta quaisquer APIs permitidas"
|
||||
|
||||
#: gdk/gdkglcontext.c:404 gdk/win32/gdkglcontext-win32-egl.c:401
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:627 gdk/x11/gdkglcontext-glx.c:622
|
||||
#: gdk/gdkglcontext.c:404 gdk/win32/gdkglcontext-win32-wgl.c:624
|
||||
#: gdk/x11/gdkglcontext-glx.c:622
|
||||
msgid "Unable to create a GL context"
|
||||
msgstr "Impossível criar um contexto GL"
|
||||
|
||||
@@ -138,11 +138,11 @@ msgstr "Aplicação não suporta API %s"
|
||||
msgid "Trying to use %s, but %s is already in use"
|
||||
msgstr "A tentar usar %s, mas %s já está em uso"
|
||||
|
||||
#: gdk/gdksurface.c:1235
|
||||
#: gdk/gdksurface.c:1238
|
||||
msgid "Vulkan support disabled via GDK_DEBUG"
|
||||
msgstr "Suporte a Vulkan desativado via GDK_DEBUG"
|
||||
|
||||
#: gdk/gdktexture.c:530
|
||||
#: gdk/gdktexture.c:529
|
||||
msgid "Unknown image format."
|
||||
msgstr "Formato de imagem desconhecido."
|
||||
|
||||
@@ -564,7 +564,7 @@ msgstr "Dados de leitura falhados na fila %d"
|
||||
|
||||
#: gdk/macos/gdkmacosclipboard.c:557 gdk/wayland/gdkclipboard-wayland.c:231
|
||||
#: gdk/wayland/gdkdrop-wayland.c:203 gdk/wayland/gdkprimary-wayland.c:312
|
||||
#: gdk/win32/gdkdrop-win32.c:1013 gdk/win32/gdkdrop-win32.c:1058
|
||||
#: gdk/win32/gdkdrop-win32.c:1006 gdk/win32/gdkdrop-win32.c:1051
|
||||
#: gdk/x11/gdkclipboard-x11.c:763 gdk/x11/gdkdrop-x11.c:233
|
||||
msgid "No compatible transfer format found"
|
||||
msgstr "Nenhum formato de transferência compatível localizado"
|
||||
@@ -688,55 +688,52 @@ msgstr ""
|
||||
"Não foi possível obter dados da área de transferência. GetClipboardData() "
|
||||
"falhou: 0x%lx."
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:944
|
||||
#: gdk/win32/gdkdrop-win32.c:937
|
||||
#, c-format
|
||||
msgid "Cannot get DnD data. GlobalLock(0x%p) failed: 0x%lx."
|
||||
msgstr "Não foi possível obter dados de DnD. GlobalLock(0x%p) falhou: 0x%lx."
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:953
|
||||
#: gdk/win32/gdkdrop-win32.c:946
|
||||
#, c-format
|
||||
msgid "Cannot get DnD data. GlobalSize(0x%p) failed: 0x%lx."
|
||||
msgstr "Não foi possível obter dados de DnD. GlobalSize(0x%p) falhou: 0x%lx."
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:964
|
||||
#: gdk/win32/gdkdrop-win32.c:957
|
||||
#, c-format
|
||||
msgid "Cannot get DnD data. Failed to allocate %s bytes to store the data."
|
||||
msgstr ""
|
||||
"Não foi possível obter dados de DnD. Falha ao atribuir %s bytes para "
|
||||
"armazenar os dados."
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:1032
|
||||
#: gdk/win32/gdkdrop-win32.c:1025
|
||||
#, c-format
|
||||
msgid "GDK surface 0x%p is not registered as a drop target"
|
||||
msgstr "Superfície GDK 0x%p não está registrada como um alvo de largar"
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:1039
|
||||
#: gdk/win32/gdkdrop-win32.c:1032
|
||||
#, c-format
|
||||
msgid "Target context record 0x%p has no data object"
|
||||
msgstr "Registro de contexto de alvo 0x%p possui nenhum objeto de dados"
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:1077
|
||||
#: gdk/win32/gdkdrop-win32.c:1070
|
||||
#, c-format
|
||||
msgid "IDataObject_GetData (0x%x) failed, returning 0x%lx"
|
||||
msgstr "IDataObject_GetData (0x%x) falhou, retornando 0x%lx"
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:1109
|
||||
#: gdk/win32/gdkdrop-win32.c:1102
|
||||
#, c-format
|
||||
msgid "Failed to transmute DnD data W32 format 0x%x to %p (%s)"
|
||||
msgstr "Falha ao transmutar dados DnD W32 de formato 0x%x para %p (%s)"
|
||||
|
||||
#: gdk/win32/gdkglcontext-win32-egl.c:215
|
||||
#: gdk/win32/gdkglcontext-win32-egl.c:225
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:593
|
||||
msgid "No available configurations for the given pixel format"
|
||||
msgstr "Sem configurações disponíveis para o formato de pixel indicado"
|
||||
|
||||
#: gdk/win32/gdkglcontext-win32-egl.c:275
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:282
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:299
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:279
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:296
|
||||
msgid "No GL implementation is available"
|
||||
msgstr "Nenhuma implementação GL disponível"
|
||||
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:590
|
||||
msgid "No available configurations for the given pixel format"
|
||||
msgstr "Sem configurações disponíveis para o formato de pixel indicado"
|
||||
|
||||
#: gdk/win32/gdkhdataoutputstream-win32.c:63
|
||||
msgid "writing a closed stream"
|
||||
msgstr "a escrever um fluxo fechado"
|
||||
@@ -2124,7 +2121,7 @@ msgstr "Já existe um ficheiro com esse nome"
|
||||
#: gtk/gtkmountoperation.c:610 gtk/gtkpagesetupunixdialog.c:283
|
||||
#: gtk/gtkprintbackend.c:642 gtk/gtkprinteroptionwidget.c:713
|
||||
#: gtk/gtkprintunixdialog.c:667 gtk/gtkprintunixdialog.c:823
|
||||
#: gtk/gtkwindow.c:6138 gtk/inspector/css-editor.c:248
|
||||
#: gtk/gtkwindow.c:6218 gtk/inspector/css-editor.c:248
|
||||
#: gtk/inspector/recorder.c:1271
|
||||
msgid "_Cancel"
|
||||
msgstr "_Cancelar"
|
||||
@@ -2214,7 +2211,7 @@ msgid "If you delete an item, it will be permanently lost."
|
||||
msgstr "Se eliminar um item, estará permanentemente perdido."
|
||||
|
||||
#: gtk/gtkfilechooserwidget.c:1210 gtk/gtkfilechooserwidget.c:1826
|
||||
#: gtk/gtklabel.c:5514 gtk/gtktext.c:6062 gtk/gtktextview.c:8900
|
||||
#: gtk/gtklabel.c:5533 gtk/gtktext.c:6064 gtk/gtktextview.c:8920
|
||||
msgid "_Delete"
|
||||
msgstr "_Eliminar"
|
||||
|
||||
@@ -2424,56 +2421,56 @@ msgstr "Sans 12"
|
||||
msgid "Pick a Font"
|
||||
msgstr "Escolha uma letra"
|
||||
|
||||
#: gtk/gtkfontbutton.c:1348
|
||||
#: gtk/gtkfontbutton.c:1363
|
||||
msgctxt "font"
|
||||
msgid "None"
|
||||
msgstr "Nenhuma"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1568
|
||||
#: gtk/gtkfontchooserwidget.c:1569
|
||||
msgid "Width"
|
||||
msgstr "Largura"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1569
|
||||
#: gtk/gtkfontchooserwidget.c:1570
|
||||
msgid "Weight"
|
||||
msgstr "Peso"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1570
|
||||
#: gtk/gtkfontchooserwidget.c:1571
|
||||
msgid "Italic"
|
||||
msgstr "Itálico"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1571
|
||||
#: gtk/gtkfontchooserwidget.c:1572
|
||||
msgid "Slant"
|
||||
msgstr "Inclinado"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1572
|
||||
#: gtk/gtkfontchooserwidget.c:1573
|
||||
msgid "Optical Size"
|
||||
msgstr "Tamanho ótico"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2118
|
||||
#: gtk/gtkfontchooserwidget.c:2120
|
||||
msgid "Default"
|
||||
msgstr "Predefinição"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2164
|
||||
#: gtk/gtkfontchooserwidget.c:2166
|
||||
msgid "Ligatures"
|
||||
msgstr "Ligaduras"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2165
|
||||
#: gtk/gtkfontchooserwidget.c:2167
|
||||
msgid "Letter Case"
|
||||
msgstr "Caixa de letra"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2166
|
||||
#: gtk/gtkfontchooserwidget.c:2168
|
||||
msgid "Number Case"
|
||||
msgstr "Caixa de número"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2167
|
||||
#: gtk/gtkfontchooserwidget.c:2169
|
||||
msgid "Number Spacing"
|
||||
msgstr "Espaçamento de número"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2168
|
||||
#: gtk/gtkfontchooserwidget.c:2170
|
||||
msgid "Number Formatting"
|
||||
msgstr "Formatação de número"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2169
|
||||
#: gtk/gtkfontchooserwidget.c:2171
|
||||
msgid "Character Variants"
|
||||
msgstr "Variantes de carácter"
|
||||
|
||||
@@ -2481,27 +2478,27 @@ msgstr "Variantes de carácter"
|
||||
msgid "OpenGL context creation failed"
|
||||
msgstr "Falha ao criar o contexto OpenGL"
|
||||
|
||||
#: gtk/gtklabel.c:5511 gtk/gtktext.c:6050 gtk/gtktextview.c:8888
|
||||
#: gtk/gtklabel.c:5530 gtk/gtktext.c:6052 gtk/gtktextview.c:8908
|
||||
msgid "Cu_t"
|
||||
msgstr "Cor_tar"
|
||||
|
||||
#: gtk/gtklabel.c:5512 gtk/gtktext.c:6054 gtk/gtktextview.c:8892
|
||||
#: gtk/gtklabel.c:5531 gtk/gtktext.c:6056 gtk/gtktextview.c:8912
|
||||
msgid "_Copy"
|
||||
msgstr "_Copiar"
|
||||
|
||||
#: gtk/gtklabel.c:5513 gtk/gtktext.c:6058 gtk/gtktextview.c:8896
|
||||
#: gtk/gtklabel.c:5532 gtk/gtktext.c:6060 gtk/gtktextview.c:8916
|
||||
msgid "_Paste"
|
||||
msgstr "Co_lar"
|
||||
|
||||
#: gtk/gtklabel.c:5519 gtk/gtktext.c:6071 gtk/gtktextview.c:8921
|
||||
#: gtk/gtklabel.c:5538 gtk/gtktext.c:6073 gtk/gtktextview.c:8941
|
||||
msgid "Select _All"
|
||||
msgstr "Selecionar _tudo"
|
||||
|
||||
#: gtk/gtklabel.c:5524
|
||||
#: gtk/gtklabel.c:5543
|
||||
msgid "_Open Link"
|
||||
msgstr "_Abrir Ligação"
|
||||
|
||||
#: gtk/gtklabel.c:5528
|
||||
#: gtk/gtklabel.c:5547
|
||||
msgid "Copy _Link Address"
|
||||
msgstr "Copiar endereço da _ligação"
|
||||
|
||||
@@ -2603,7 +2600,7 @@ msgid "%d:%02d"
|
||||
msgstr "%d:%02d"
|
||||
|
||||
#: gtk/gtkmessagedialog.c:158 gtk/gtkmessagedialog.c:176
|
||||
#: gtk/gtkprintbackend.c:643 gtk/gtkwindow.c:6139
|
||||
#: gtk/gtkprintbackend.c:643 gtk/gtkwindow.c:6219
|
||||
msgid "_OK"
|
||||
msgstr "_Aceitar"
|
||||
|
||||
@@ -3444,7 +3441,7 @@ msgid "Swipe right"
|
||||
msgstr "Deslizar para a direita"
|
||||
|
||||
#. Translators: This is the window title for the shortcuts window in normal mode
|
||||
#: gtk/gtkshortcutswindow.c:874 gtk/inspector/window.ui:490
|
||||
#: gtk/gtkshortcutswindow.c:874 gtk/inspector/window.ui:498
|
||||
msgid "Shortcuts"
|
||||
msgstr "Atalhos"
|
||||
|
||||
@@ -3470,15 +3467,15 @@ msgstr "Tente uma procura diferente"
|
||||
msgid "Could not show link"
|
||||
msgstr "Impossível mostrar a ligação"
|
||||
|
||||
#: gtk/gtktext.c:6076 gtk/gtktextview.c:8926
|
||||
#: gtk/gtktext.c:6078 gtk/gtktextview.c:8946
|
||||
msgid "Insert _Emoji"
|
||||
msgstr "Inserir _emoji"
|
||||
|
||||
#: gtk/gtktextview.c:8908
|
||||
#: gtk/gtktextview.c:8928
|
||||
msgid "_Undo"
|
||||
msgstr "_Desfazer"
|
||||
|
||||
#: gtk/gtktextview.c:8912
|
||||
#: gtk/gtktextview.c:8932
|
||||
msgid "_Redo"
|
||||
msgstr "_Refazer"
|
||||
|
||||
@@ -3505,12 +3502,12 @@ msgctxt "volume percentage"
|
||||
msgid "%d %%"
|
||||
msgstr "%d %%"
|
||||
|
||||
#: gtk/gtkwindow.c:6126
|
||||
#: gtk/gtkwindow.c:6206
|
||||
#, c-format
|
||||
msgid "Do you want to use GTK Inspector?"
|
||||
msgstr "Deseja usar o Inspetor GTK?"
|
||||
|
||||
#: gtk/gtkwindow.c:6128
|
||||
#: gtk/gtkwindow.c:6208
|
||||
#, c-format
|
||||
msgid ""
|
||||
"GTK Inspector is an interactive debugger that lets you explore and modify "
|
||||
@@ -3521,7 +3518,7 @@ msgstr ""
|
||||
"estado interno de qualquer aplicação GTK. Usá-lo pode fazer que a aplicação "
|
||||
"se encerre ou falhe."
|
||||
|
||||
#: gtk/gtkwindow.c:6133
|
||||
#: gtk/gtkwindow.c:6213
|
||||
msgid "Don’t show this message again"
|
||||
msgstr "Não mostrar esta mensagem novamente"
|
||||
|
||||
@@ -3591,6 +3588,33 @@ msgstr "Tipo de parâmetro"
|
||||
msgid "State"
|
||||
msgstr "Estado"
|
||||
|
||||
#: gtk/inspector/clipboard.c:149
|
||||
msgid "Show"
|
||||
msgstr "Mostrar"
|
||||
|
||||
#: gtk/inspector/clipboard.c:205
|
||||
msgctxt "clipboard"
|
||||
msgid "empty"
|
||||
msgstr "vazio"
|
||||
|
||||
#: gtk/inspector/clipboard.c:210
|
||||
msgctxt "clipboard"
|
||||
msgid "local"
|
||||
msgstr "local"
|
||||
|
||||
#: gtk/inspector/clipboard.c:212
|
||||
msgctxt "clipboard"
|
||||
msgid "remote"
|
||||
msgstr "remoto"
|
||||
|
||||
#: gtk/inspector/clipboard.ui:31 gtk/inspector/window.ui:574
|
||||
msgid "Clipboard"
|
||||
msgstr "Área de transferência"
|
||||
|
||||
#: gtk/inspector/clipboard.ui:70
|
||||
msgid "Primary"
|
||||
msgstr "Principal"
|
||||
|
||||
#: gtk/inspector/controllers.c:126
|
||||
msgctxt "event phase"
|
||||
msgid "None"
|
||||
@@ -3659,46 +3683,50 @@ msgstr "Classes de estilo"
|
||||
msgid "CSS Property"
|
||||
msgstr "Propriedade CSS"
|
||||
|
||||
#: gtk/inspector/general.c:307 gtk/inspector/general.c:387
|
||||
#: gtk/inspector/general.c:309 gtk/inspector/general.c:389
|
||||
msgctxt "GL version"
|
||||
msgid "None"
|
||||
msgstr "Nenhuma"
|
||||
|
||||
#: gtk/inspector/general.c:316
|
||||
#: gtk/inspector/general.c:318
|
||||
msgctxt "GL version"
|
||||
msgid "Disabled"
|
||||
msgstr "Desativado"
|
||||
|
||||
#: gtk/inspector/general.c:317
|
||||
#: gtk/inspector/general.c:319
|
||||
msgctxt "GL vendor"
|
||||
msgid "Disabled"
|
||||
msgstr "Desativado"
|
||||
|
||||
#: gtk/inspector/general.c:388
|
||||
#: gtk/inspector/general.c:390
|
||||
msgctxt "GL vendor"
|
||||
msgid "None"
|
||||
msgstr "Nenhum"
|
||||
|
||||
#: gtk/inspector/general.c:439
|
||||
#: gtk/inspector/general.c:441
|
||||
msgctxt "Vulkan device"
|
||||
msgid "Disabled"
|
||||
msgstr "Desativado"
|
||||
|
||||
#: gtk/inspector/general.c:440 gtk/inspector/general.c:441
|
||||
#: gtk/inspector/general.c:442 gtk/inspector/general.c:443
|
||||
msgctxt "Vulkan version"
|
||||
msgid "Disabled"
|
||||
msgstr "Desativado"
|
||||
|
||||
#: gtk/inspector/general.c:497
|
||||
#: gtk/inspector/general.c:499
|
||||
msgctxt "Vulkan device"
|
||||
msgid "None"
|
||||
msgstr "Nenhum"
|
||||
|
||||
#: gtk/inspector/general.c:498 gtk/inspector/general.c:499
|
||||
#: gtk/inspector/general.c:500 gtk/inspector/general.c:501
|
||||
msgctxt "Vulkan version"
|
||||
msgid "None"
|
||||
msgstr "Nenhum"
|
||||
|
||||
#: gtk/inspector/general.c:771
|
||||
msgid "IM Context is hardcoded by GTK_IM_MODULE"
|
||||
msgstr "O contexto IM está no código de GTK_IM_MODULE"
|
||||
|
||||
#: gtk/inspector/general.ui:32
|
||||
msgid "GTK Version"
|
||||
msgstr "Versão do GTK"
|
||||
@@ -3719,39 +3747,43 @@ msgstr "Mapa de fontes Pango"
|
||||
msgid "Media Backend"
|
||||
msgstr "Backend de media"
|
||||
|
||||
#: gtk/inspector/general.ui:175
|
||||
#: gtk/inspector/general.ui:162
|
||||
msgid "Input Method"
|
||||
msgstr "Método de introdução"
|
||||
|
||||
#: gtk/inspector/general.ui:201
|
||||
msgid "Prefix"
|
||||
msgstr "Prefixo"
|
||||
|
||||
#: gtk/inspector/general.ui:377
|
||||
#: gtk/inspector/general.ui:403
|
||||
msgid "Display"
|
||||
msgstr "Ecrã"
|
||||
|
||||
#: gtk/inspector/general.ui:404
|
||||
#: gtk/inspector/general.ui:430
|
||||
msgid "RGBA Visual"
|
||||
msgstr "Visual RGBA"
|
||||
|
||||
#: gtk/inspector/general.ui:430
|
||||
#: gtk/inspector/general.ui:456
|
||||
msgid "Composited"
|
||||
msgstr "Composto"
|
||||
|
||||
#: gtk/inspector/general.ui:482
|
||||
#: gtk/inspector/general.ui:508
|
||||
msgid "GL Version"
|
||||
msgstr "Versão GL"
|
||||
|
||||
#: gtk/inspector/general.ui:532
|
||||
#: gtk/inspector/general.ui:558
|
||||
msgid "GL Vendor"
|
||||
msgstr "Vendedor GL"
|
||||
|
||||
#: gtk/inspector/general.ui:572
|
||||
#: gtk/inspector/general.ui:598
|
||||
msgid "Vulkan Device"
|
||||
msgstr "Dispositivo Vulkan"
|
||||
|
||||
#: gtk/inspector/general.ui:599
|
||||
#: gtk/inspector/general.ui:625
|
||||
msgid "Vulkan API version"
|
||||
msgstr "Versão de API Vulkan"
|
||||
|
||||
#: gtk/inspector/general.ui:626
|
||||
#: gtk/inspector/general.ui:652
|
||||
msgid "Vulkan driver version"
|
||||
msgstr "Versão de controlador Vulkan"
|
||||
|
||||
@@ -3817,8 +3849,8 @@ msgid "Surface"
|
||||
msgstr "Surpefície"
|
||||
|
||||
#: gtk/inspector/misc-info.ui:346 gtk/inspector/misc-info.ui:385
|
||||
#: gtk/inspector/misc-info.ui:424 gtk/inspector/prop-editor.c:1111
|
||||
#: gtk/inspector/prop-editor.c:1471 gtk/inspector/window.ui:388
|
||||
#: gtk/inspector/misc-info.ui:424 gtk/inspector/prop-editor.c:1116
|
||||
#: gtk/inspector/prop-editor.c:1476 gtk/inspector/window.ui:396
|
||||
msgid "Properties"
|
||||
msgstr "Propriedades"
|
||||
|
||||
@@ -3895,66 +3927,66 @@ msgstr "%s para %s %p"
|
||||
msgid "%s with value type %s"
|
||||
msgstr "%s com tipo de valor %s"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1179
|
||||
#: gtk/inspector/prop-editor.c:1184
|
||||
#, c-format
|
||||
msgid "Uneditable property type: %s"
|
||||
msgstr "Tipo de propriedade não editável: %s"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1323
|
||||
#: gtk/inspector/prop-editor.c:1328
|
||||
msgctxt "column number"
|
||||
msgid "None"
|
||||
msgstr "Nenhuma"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1360
|
||||
#: gtk/inspector/prop-editor.c:1365
|
||||
msgid "Attribute:"
|
||||
msgstr "Atributo:"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1363
|
||||
#: gtk/inspector/prop-editor.c:1368
|
||||
msgid "Model"
|
||||
msgstr "Modelo"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1368
|
||||
#: gtk/inspector/prop-editor.c:1373
|
||||
msgid "Column:"
|
||||
msgstr "Coluna:"
|
||||
|
||||
#. Translators: %s is a type name, for example
|
||||
#. * Action from 0x2345678 (GtkApplicationWindow)
|
||||
#.
|
||||
#: gtk/inspector/prop-editor.c:1467
|
||||
#: gtk/inspector/prop-editor.c:1472
|
||||
#, c-format
|
||||
msgid "Action from: %p (%s)"
|
||||
msgstr "Ação de: %p (%s)"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1522
|
||||
#: gtk/inspector/prop-editor.c:1527
|
||||
msgid "Reset"
|
||||
msgstr "Repor"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1530
|
||||
#: gtk/inspector/prop-editor.c:1535
|
||||
msgctxt "GtkSettings source"
|
||||
msgid "Default"
|
||||
msgstr "Predefinição"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1533
|
||||
#: gtk/inspector/prop-editor.c:1538
|
||||
msgctxt "GtkSettings source"
|
||||
msgid "Theme"
|
||||
msgstr "Tema"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1536
|
||||
#: gtk/inspector/prop-editor.c:1541
|
||||
msgctxt "GtkSettings source"
|
||||
msgid "XSettings"
|
||||
msgstr "Definições X"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1540
|
||||
#: gtk/inspector/prop-editor.c:1545
|
||||
msgctxt "GtkSettings source"
|
||||
msgid "Application"
|
||||
msgstr "Aplicação"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1543
|
||||
#: gtk/inspector/prop-editor.c:1548
|
||||
msgctxt "GtkSettings source"
|
||||
msgid "Unknown"
|
||||
msgstr "Desconhecido"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1546
|
||||
#: gtk/inspector/prop-editor.c:1551
|
||||
msgid "Source:"
|
||||
msgstr "Origem:"
|
||||
|
||||
@@ -4215,111 +4247,111 @@ msgstr "Mostrar todos os objetos"
|
||||
msgid "Show all Resources"
|
||||
msgstr "Mostrar todos os recursos"
|
||||
|
||||
#: gtk/inspector/window.ui:139
|
||||
#: gtk/inspector/window.ui:147
|
||||
msgid "Collect Statistics"
|
||||
msgstr "Colecionar estatísticas"
|
||||
|
||||
#: gtk/inspector/window.ui:191
|
||||
#: gtk/inspector/window.ui:199
|
||||
msgid "Objects"
|
||||
msgstr "Objetos"
|
||||
|
||||
#: gtk/inspector/window.ui:223
|
||||
#: gtk/inspector/window.ui:231
|
||||
msgid "Toggle Sidebar"
|
||||
msgstr "Ativar/desativar barra lateral"
|
||||
|
||||
#: gtk/inspector/window.ui:245
|
||||
#: gtk/inspector/window.ui:253
|
||||
msgid "Refresh action state"
|
||||
msgstr "Atualizar estado de ação"
|
||||
|
||||
#: gtk/inspector/window.ui:319
|
||||
#: gtk/inspector/window.ui:327
|
||||
msgid "Previous object"
|
||||
msgstr "Objeto anterior"
|
||||
|
||||
#: gtk/inspector/window.ui:326
|
||||
#: gtk/inspector/window.ui:334
|
||||
msgid "Child object"
|
||||
msgstr "Objeto secundário"
|
||||
|
||||
#: gtk/inspector/window.ui:333
|
||||
#: gtk/inspector/window.ui:341
|
||||
msgid "Previous sibling"
|
||||
msgstr "Irmão anterior"
|
||||
|
||||
#: gtk/inspector/window.ui:339
|
||||
#: gtk/inspector/window.ui:347
|
||||
msgid "List Position"
|
||||
msgstr "Lista posição"
|
||||
|
||||
#: gtk/inspector/window.ui:348
|
||||
#: gtk/inspector/window.ui:356
|
||||
msgid "Next sibling"
|
||||
msgstr "Próximo irmão"
|
||||
|
||||
#: gtk/inspector/window.ui:378
|
||||
#: gtk/inspector/window.ui:386
|
||||
msgid "Miscellaneous"
|
||||
msgstr "Vários"
|
||||
|
||||
#: gtk/inspector/window.ui:399
|
||||
#: gtk/inspector/window.ui:407
|
||||
msgid "Layout"
|
||||
msgstr "Disposição"
|
||||
|
||||
#: gtk/inspector/window.ui:410
|
||||
#: gtk/inspector/window.ui:418
|
||||
msgid "CSS Nodes"
|
||||
msgstr "CSS Nodes"
|
||||
|
||||
#: gtk/inspector/window.ui:421
|
||||
#: gtk/inspector/window.ui:429
|
||||
msgid "Size Groups"
|
||||
msgstr "Grupos de tamanho"
|
||||
|
||||
#: gtk/inspector/window.ui:430 gtk/inspector/window.ui:439
|
||||
#: gtk/inspector/window.ui:438 gtk/inspector/window.ui:447
|
||||
msgid "Data"
|
||||
msgstr "Dados"
|
||||
|
||||
#: gtk/inspector/window.ui:449
|
||||
#: gtk/inspector/window.ui:457
|
||||
msgid "Actions"
|
||||
msgstr "Ações"
|
||||
|
||||
#: gtk/inspector/window.ui:460
|
||||
#: gtk/inspector/window.ui:468
|
||||
msgid "Menu"
|
||||
msgstr "Menu"
|
||||
|
||||
#: gtk/inspector/window.ui:469
|
||||
#: gtk/inspector/window.ui:477
|
||||
msgid "Controllers"
|
||||
msgstr "Controladores"
|
||||
|
||||
#: gtk/inspector/window.ui:479
|
||||
#: gtk/inspector/window.ui:487
|
||||
msgid "Magnifier"
|
||||
msgstr "Lupa"
|
||||
|
||||
#: gtk/inspector/window.ui:500
|
||||
#: gtk/inspector/window.ui:508
|
||||
msgid "Accessibility"
|
||||
msgstr "Acessibilidade"
|
||||
|
||||
#: gtk/inspector/window.ui:524
|
||||
#: gtk/inspector/window.ui:532
|
||||
msgid "Global"
|
||||
msgstr "Global"
|
||||
|
||||
#: gtk/inspector/window.ui:537
|
||||
#: gtk/inspector/window.ui:545
|
||||
msgid "Information"
|
||||
msgstr "Informação"
|
||||
|
||||
#: gtk/inspector/window.ui:546
|
||||
#: gtk/inspector/window.ui:554
|
||||
msgid "Settings"
|
||||
msgstr "Definições"
|
||||
|
||||
#: gtk/inspector/window.ui:555
|
||||
#: gtk/inspector/window.ui:563
|
||||
msgid "Resources"
|
||||
msgstr "Recursos"
|
||||
|
||||
#: gtk/inspector/window.ui:566
|
||||
#: gtk/inspector/window.ui:584
|
||||
msgid "Statistics"
|
||||
msgstr "Estatísticas"
|
||||
|
||||
#: gtk/inspector/window.ui:577
|
||||
#: gtk/inspector/window.ui:595
|
||||
msgid "Logging"
|
||||
msgstr "A registar"
|
||||
|
||||
#: gtk/inspector/window.ui:592
|
||||
#: gtk/inspector/window.ui:610
|
||||
msgid "CSS"
|
||||
msgstr "CSS"
|
||||
|
||||
#: gtk/inspector/window.ui:601
|
||||
#: gtk/inspector/window.ui:619
|
||||
msgid "Recorder"
|
||||
msgstr "Gravador"
|
||||
|
||||
@@ -7426,37 +7458,37 @@ msgstr ""
|
||||
msgid "%s:%d: Couldn’t parse value for property '%s': %s\n"
|
||||
msgstr "%s:%d: Não foi possível analisar o valor para a propriedade '%s': %s\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:638
|
||||
#: tools/gtk-builder-tool-simplify.c:646
|
||||
#, c-format
|
||||
msgid "%s:%d: %sproperty %s::%s not found\n"
|
||||
msgstr "%s:%d: %spropriedade %s::%s não encontrada\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2275
|
||||
#: tools/gtk-builder-tool-simplify.c:2283
|
||||
#, c-format
|
||||
msgid "Can’t load “%s”: %s\n"
|
||||
msgstr "Não foi possível carregar “%s”: %s\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2286
|
||||
#: tools/gtk-builder-tool-simplify.c:2294
|
||||
#, c-format
|
||||
msgid "Can’t parse “%s”: %s\n"
|
||||
msgstr "Não foi possível analisar “%s”: %s\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2310
|
||||
#: tools/gtk-builder-tool-simplify.c:2318
|
||||
#, c-format
|
||||
msgid "Failed to read “%s”: %s\n"
|
||||
msgstr "Falha ao ler “%s”: %s\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2316
|
||||
#: tools/gtk-builder-tool-simplify.c:2324
|
||||
#, c-format
|
||||
msgid "Failed to write %s: “%s”\n"
|
||||
msgstr "Falha ao gravar %s: “%s”\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2356
|
||||
#: tools/gtk-builder-tool-simplify.c:2364
|
||||
#, c-format
|
||||
msgid "No .ui file specified\n"
|
||||
msgstr "Nenhum ficheiro .ui especificado\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2362
|
||||
#: tools/gtk-builder-tool-simplify.c:2370
|
||||
#, c-format
|
||||
msgid "Can only simplify a single .ui file without --replace\n"
|
||||
msgstr "Apenas pode simplificar um único ficheiro .ui sem --replace\n"
|
||||
@@ -8569,9 +8601,6 @@ msgstr ""
|
||||
#~ msgid "Unexpected character data on line %d char %d"
|
||||
#~ msgstr "Dados de carácter inesperados na linha %d, carácter %d"
|
||||
|
||||
#~ msgid "Empty"
|
||||
#~ msgstr "Vazio"
|
||||
|
||||
#~ msgid "C_redits"
|
||||
#~ msgstr "C_réditos"
|
||||
|
||||
@@ -9137,10 +9166,6 @@ msgstr ""
|
||||
#~ msgid "Vietnamese (VIQR)"
|
||||
#~ msgstr "Vietnamita (VIQR)"
|
||||
|
||||
#~ msgctxt "input method menu"
|
||||
#~ msgid "X Input Method"
|
||||
#~ msgstr "Método de introdução X"
|
||||
|
||||
#~ msgid "printer offline"
|
||||
#~ msgstr "impressora desligada"
|
||||
|
||||
|
||||
295
po/uk.po
295
po/uk.po
@@ -9,8 +9,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: gtk+\n"
|
||||
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gtk/-/issues/\n"
|
||||
"POT-Creation-Date: 2021-11-06 03:54+0000\n"
|
||||
"PO-Revision-Date: 2021-11-06 06:16+0200\n"
|
||||
"POT-Creation-Date: 2021-12-12 12:57+0000\n"
|
||||
"PO-Revision-Date: 2021-12-12 19:17+0200\n"
|
||||
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
|
||||
"Language-Team: Ukrainian <trans-uk@lists.fedoraproject.org>\n"
|
||||
"Language: uk\n"
|
||||
@@ -57,23 +57,23 @@ msgstr "Цей модуль не підтримує OpenGL"
|
||||
msgid "GL support disabled via GDK_DEBUG"
|
||||
msgstr "Вимкнено підтримування GL через GDK_DEBUG"
|
||||
|
||||
#: gdk/gdkdisplay.c:1569
|
||||
#: gdk/gdkdisplay.c:1544
|
||||
msgid "No EGL configuration available"
|
||||
msgstr "Немає доступних налаштувань EGL"
|
||||
|
||||
#: gdk/gdkdisplay.c:1577
|
||||
#: gdk/gdkdisplay.c:1552
|
||||
msgid "Failed to get EGL configurations"
|
||||
msgstr "Не вдалося отримати налаштування EGL"
|
||||
|
||||
#: gdk/gdkdisplay.c:1607
|
||||
#: gdk/gdkdisplay.c:1582
|
||||
msgid "No EGL configuration with required features found"
|
||||
msgstr "Не знайдено налаштувань EGL із потрібними можливостями"
|
||||
|
||||
#: gdk/gdkdisplay.c:1614
|
||||
#: gdk/gdkdisplay.c:1589
|
||||
msgid "No perfect EGL configuration found"
|
||||
msgstr "Не знайдено ідеальних налаштувань EGL"
|
||||
|
||||
#: gdk/gdkdisplay.c:1656
|
||||
#: gdk/gdkdisplay.c:1631
|
||||
msgid "EGL implementation is missing extension %2$s"
|
||||
msgid_plural "EGL implementation is missing %d extensions: %s"
|
||||
msgstr[0] "У реалізації EGL не вистачає %d розширення %2$s"
|
||||
@@ -81,23 +81,23 @@ msgstr[1] "У реалізації EGL не вистачає %d розширен
|
||||
msgstr[2] "У реалізації EGL не вистачає %d розширень %2$s"
|
||||
msgstr[3] "У реалізації EGL не вистачає розширення %2$s"
|
||||
|
||||
#: gdk/gdkdisplay.c:1689
|
||||
#: gdk/gdkdisplay.c:1664
|
||||
msgid "libEGL not available in this sandbox"
|
||||
msgstr "libEGL є недоступною у цій пісочниці"
|
||||
|
||||
#: gdk/gdkdisplay.c:1690
|
||||
#: gdk/gdkdisplay.c:1665
|
||||
msgid "libEGL not available"
|
||||
msgstr "libEGL є недоступною"
|
||||
|
||||
#: gdk/gdkdisplay.c:1700
|
||||
#: gdk/gdkdisplay.c:1675
|
||||
msgid "Failed to create EGL display"
|
||||
msgstr "Не вдалося створити запис дисплея EGL"
|
||||
|
||||
#: gdk/gdkdisplay.c:1710
|
||||
#: gdk/gdkdisplay.c:1685
|
||||
msgid "Could not initialize EGL display"
|
||||
msgstr "Не вдалося ініціалізувати дисплей EGL"
|
||||
|
||||
#: gdk/gdkdisplay.c:1721
|
||||
#: gdk/gdkdisplay.c:1696
|
||||
#, c-format
|
||||
msgid "EGL version %d.%d is too old. GTK requires %d.%d"
|
||||
msgstr "Версія EGL %d.%d є надто давньою. Для роботи GTK потрібна версія %d.%d"
|
||||
@@ -117,8 +117,8 @@ msgstr ""
|
||||
"У реалізації EGL не передбачено підтримки жодного з дозволених програмних "
|
||||
"інтерфейсів"
|
||||
|
||||
#: gdk/gdkglcontext.c:404 gdk/win32/gdkglcontext-win32-egl.c:401
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:627 gdk/x11/gdkglcontext-glx.c:622
|
||||
#: gdk/gdkglcontext.c:404 gdk/win32/gdkglcontext-win32-wgl.c:624
|
||||
#: gdk/x11/gdkglcontext-glx.c:622
|
||||
msgid "Unable to create a GL context"
|
||||
msgstr "Неможливо створити вміст GL"
|
||||
|
||||
@@ -138,11 +138,11 @@ msgstr "У програмі не передбачено підтримки пр
|
||||
msgid "Trying to use %s, but %s is already in use"
|
||||
msgstr "Намагаємося скористатися %s, але %s вже використано"
|
||||
|
||||
#: gdk/gdksurface.c:1235
|
||||
#: gdk/gdksurface.c:1238
|
||||
msgid "Vulkan support disabled via GDK_DEBUG"
|
||||
msgstr "Вимкнено підтримування Vulkan через GDK_DEBUG"
|
||||
|
||||
#: gdk/gdktexture.c:530
|
||||
#: gdk/gdktexture.c:529
|
||||
msgid "Unknown image format."
|
||||
msgstr "Невідомий формат зображення."
|
||||
|
||||
@@ -550,7 +550,6 @@ msgstr "Непідтримувана глибина, %u, у зображенні
|
||||
|
||||
#: gdk/loaders/gdkpng.c:254
|
||||
#, c-format
|
||||
#| msgid "Unsupportd color type %u in png image"
|
||||
msgid "Unsupported color type %u in png image"
|
||||
msgstr "Непідтримуваний тип кольору, %u, у зображенні png"
|
||||
|
||||
@@ -565,7 +564,7 @@ msgstr "Помилка читання даних у рядку %d"
|
||||
|
||||
#: gdk/macos/gdkmacosclipboard.c:557 gdk/wayland/gdkclipboard-wayland.c:231
|
||||
#: gdk/wayland/gdkdrop-wayland.c:203 gdk/wayland/gdkprimary-wayland.c:312
|
||||
#: gdk/win32/gdkdrop-win32.c:1013 gdk/win32/gdkdrop-win32.c:1058
|
||||
#: gdk/win32/gdkdrop-win32.c:1006 gdk/win32/gdkdrop-win32.c:1051
|
||||
#: gdk/x11/gdkclipboard-x11.c:763 gdk/x11/gdkdrop-x11.c:233
|
||||
msgid "No compatible transfer format found"
|
||||
msgstr "Не знайдено сумісного формату передавання даних"
|
||||
@@ -682,61 +681,58 @@ msgid "Cannot get clipboard data. GetClipboardData() failed: 0x%lx."
|
||||
msgstr ""
|
||||
"Не вдалося отримати дані буфера обміну. Помилка GetClipboardData(): 0x%lx."
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:944
|
||||
#: gdk/win32/gdkdrop-win32.c:937
|
||||
#, c-format
|
||||
msgid "Cannot get DnD data. GlobalLock(0x%p) failed: 0x%lx."
|
||||
msgstr ""
|
||||
"Не вдалося отримати дані перетягування зі скиданням. Помилка GlobalLock(x"
|
||||
"%p): 0x%lx."
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:953
|
||||
#: gdk/win32/gdkdrop-win32.c:946
|
||||
#, c-format
|
||||
msgid "Cannot get DnD data. GlobalSize(0x%p) failed: 0x%lx."
|
||||
msgstr ""
|
||||
"Не вдалося отримати дані перетягування зі скиданням. Помилка GlobalSize(0x"
|
||||
"%p): 0x%lx."
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:964
|
||||
#: gdk/win32/gdkdrop-win32.c:957
|
||||
#, c-format
|
||||
msgid "Cannot get DnD data. Failed to allocate %s bytes to store the data."
|
||||
msgstr ""
|
||||
"Не вдалося отримати дані перетягування зі скиданням. Не вдалося отримати %s "
|
||||
"байтів пам'яті для зберігання даних."
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:1032
|
||||
#: gdk/win32/gdkdrop-win32.c:1025
|
||||
#, c-format
|
||||
msgid "GDK surface 0x%p is not registered as a drop target"
|
||||
msgstr "Площину GDK 0x%p не зареєстровано як ціль скидання"
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:1039
|
||||
#: gdk/win32/gdkdrop-win32.c:1032
|
||||
#, c-format
|
||||
msgid "Target context record 0x%p has no data object"
|
||||
msgstr "Запис контексту цілі 0x%p не містить об'єкта даних"
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:1077
|
||||
#: gdk/win32/gdkdrop-win32.c:1070
|
||||
#, c-format
|
||||
msgid "IDataObject_GetData (0x%x) failed, returning 0x%lx"
|
||||
msgstr "Помилка IDataObject_GetData (0x%x), повернуто 0x%lx"
|
||||
|
||||
#: gdk/win32/gdkdrop-win32.c:1109
|
||||
#: gdk/win32/gdkdrop-win32.c:1102
|
||||
#, c-format
|
||||
msgid "Failed to transmute DnD data W32 format 0x%x to %p (%s)"
|
||||
msgstr ""
|
||||
"Не вдалося перетворити формат W32 даних перетягування зі скиданням 0x%x до "
|
||||
"%p (%s)"
|
||||
|
||||
#: gdk/win32/gdkglcontext-win32-egl.c:215
|
||||
#: gdk/win32/gdkglcontext-win32-egl.c:225
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:593
|
||||
msgid "No available configurations for the given pixel format"
|
||||
msgstr "Немає доступних налаштувань для заданого формату точок"
|
||||
|
||||
#: gdk/win32/gdkglcontext-win32-egl.c:275
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:282
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:299
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:279
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:296
|
||||
msgid "No GL implementation is available"
|
||||
msgstr "Немає жодної реалізації GL"
|
||||
|
||||
#: gdk/win32/gdkglcontext-win32-wgl.c:590
|
||||
msgid "No available configurations for the given pixel format"
|
||||
msgstr "Немає доступних налаштувань для заданого формату точок"
|
||||
|
||||
#: gdk/win32/gdkhdataoutputstream-win32.c:63
|
||||
msgid "writing a closed stream"
|
||||
msgstr "запис до закритого потоку"
|
||||
@@ -2126,7 +2122,7 @@ msgstr "Файл з такою назвою вже існує"
|
||||
#: gtk/gtkmountoperation.c:610 gtk/gtkpagesetupunixdialog.c:283
|
||||
#: gtk/gtkprintbackend.c:642 gtk/gtkprinteroptionwidget.c:713
|
||||
#: gtk/gtkprintunixdialog.c:667 gtk/gtkprintunixdialog.c:823
|
||||
#: gtk/gtkwindow.c:6138 gtk/inspector/css-editor.c:248
|
||||
#: gtk/gtkwindow.c:6218 gtk/inspector/css-editor.c:248
|
||||
#: gtk/inspector/recorder.c:1271
|
||||
msgid "_Cancel"
|
||||
msgstr "_Скасувати"
|
||||
@@ -2215,7 +2211,7 @@ msgid "If you delete an item, it will be permanently lost."
|
||||
msgstr "Якщо вилучити об'єкт, його буде втрачено назавжди."
|
||||
|
||||
#: gtk/gtkfilechooserwidget.c:1210 gtk/gtkfilechooserwidget.c:1826
|
||||
#: gtk/gtklabel.c:5514 gtk/gtktext.c:6062 gtk/gtktextview.c:8900
|
||||
#: gtk/gtklabel.c:5533 gtk/gtktext.c:6064 gtk/gtktextview.c:8920
|
||||
msgid "_Delete"
|
||||
msgstr "В_илучити"
|
||||
|
||||
@@ -2424,56 +2420,56 @@ msgstr "Sans 12"
|
||||
msgid "Pick a Font"
|
||||
msgstr "Виберіть шрифт"
|
||||
|
||||
#: gtk/gtkfontbutton.c:1348
|
||||
#: gtk/gtkfontbutton.c:1363
|
||||
msgctxt "font"
|
||||
msgid "None"
|
||||
msgstr "Немає"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1568
|
||||
#: gtk/gtkfontchooserwidget.c:1569
|
||||
msgid "Width"
|
||||
msgstr "Ширина"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1569
|
||||
#: gtk/gtkfontchooserwidget.c:1570
|
||||
msgid "Weight"
|
||||
msgstr "Вага"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1570
|
||||
#: gtk/gtkfontchooserwidget.c:1571
|
||||
msgid "Italic"
|
||||
msgstr "Курсив"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1571
|
||||
#: gtk/gtkfontchooserwidget.c:1572
|
||||
msgid "Slant"
|
||||
msgstr "Нахил"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:1572
|
||||
#: gtk/gtkfontchooserwidget.c:1573
|
||||
msgid "Optical Size"
|
||||
msgstr "Оптичний розмір"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2118
|
||||
#: gtk/gtkfontchooserwidget.c:2120
|
||||
msgid "Default"
|
||||
msgstr "Типово"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2164
|
||||
#: gtk/gtkfontchooserwidget.c:2166
|
||||
msgid "Ligatures"
|
||||
msgstr "Лігатури"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2165
|
||||
#: gtk/gtkfontchooserwidget.c:2167
|
||||
msgid "Letter Case"
|
||||
msgstr "Розмір літер"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2166
|
||||
#: gtk/gtkfontchooserwidget.c:2168
|
||||
msgid "Number Case"
|
||||
msgstr "Розмір цифр"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2167
|
||||
#: gtk/gtkfontchooserwidget.c:2169
|
||||
msgid "Number Spacing"
|
||||
msgstr "Інтервали між цифрами"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2168
|
||||
#: gtk/gtkfontchooserwidget.c:2170
|
||||
msgid "Number Formatting"
|
||||
msgstr "Форматування чисел"
|
||||
|
||||
#: gtk/gtkfontchooserwidget.c:2169
|
||||
#: gtk/gtkfontchooserwidget.c:2171
|
||||
msgid "Character Variants"
|
||||
msgstr "Варіанти символів"
|
||||
|
||||
@@ -2481,27 +2477,27 @@ msgstr "Варіанти символів"
|
||||
msgid "OpenGL context creation failed"
|
||||
msgstr "Не вдалося створити контекст OpenGL"
|
||||
|
||||
#: gtk/gtklabel.c:5511 gtk/gtktext.c:6050 gtk/gtktextview.c:8888
|
||||
#: gtk/gtklabel.c:5530 gtk/gtktext.c:6052 gtk/gtktextview.c:8908
|
||||
msgid "Cu_t"
|
||||
msgstr "Ви_різати"
|
||||
|
||||
#: gtk/gtklabel.c:5512 gtk/gtktext.c:6054 gtk/gtktextview.c:8892
|
||||
#: gtk/gtklabel.c:5531 gtk/gtktext.c:6056 gtk/gtktextview.c:8912
|
||||
msgid "_Copy"
|
||||
msgstr "_Копіювати"
|
||||
|
||||
#: gtk/gtklabel.c:5513 gtk/gtktext.c:6058 gtk/gtktextview.c:8896
|
||||
#: gtk/gtklabel.c:5532 gtk/gtktext.c:6060 gtk/gtktextview.c:8916
|
||||
msgid "_Paste"
|
||||
msgstr "Вст_авити"
|
||||
|
||||
#: gtk/gtklabel.c:5519 gtk/gtktext.c:6071 gtk/gtktextview.c:8921
|
||||
#: gtk/gtklabel.c:5538 gtk/gtktext.c:6073 gtk/gtktextview.c:8941
|
||||
msgid "Select _All"
|
||||
msgstr "Виді_лити все"
|
||||
|
||||
#: gtk/gtklabel.c:5524
|
||||
#: gtk/gtklabel.c:5543
|
||||
msgid "_Open Link"
|
||||
msgstr "_Відкрити посилання"
|
||||
|
||||
#: gtk/gtklabel.c:5528
|
||||
#: gtk/gtklabel.c:5547
|
||||
msgid "Copy _Link Address"
|
||||
msgstr "Копіювати _адресу посилання"
|
||||
|
||||
@@ -2603,7 +2599,7 @@ msgid "%d:%02d"
|
||||
msgstr "%d:%02d"
|
||||
|
||||
#: gtk/gtkmessagedialog.c:158 gtk/gtkmessagedialog.c:176
|
||||
#: gtk/gtkprintbackend.c:643 gtk/gtkwindow.c:6139
|
||||
#: gtk/gtkprintbackend.c:643 gtk/gtkwindow.c:6219
|
||||
msgid "_OK"
|
||||
msgstr "_Гаразд"
|
||||
|
||||
@@ -3443,7 +3439,7 @@ msgid "Swipe right"
|
||||
msgstr "Проведення праворуч"
|
||||
|
||||
#. Translators: This is the window title for the shortcuts window in normal mode
|
||||
#: gtk/gtkshortcutswindow.c:874 gtk/inspector/window.ui:490
|
||||
#: gtk/gtkshortcutswindow.c:874 gtk/inspector/window.ui:498
|
||||
msgid "Shortcuts"
|
||||
msgstr "Скорочення"
|
||||
|
||||
@@ -3469,15 +3465,15 @@ msgstr "Спробуйте пошукати по-інакшому"
|
||||
msgid "Could not show link"
|
||||
msgstr "Не вдалось показати посилання"
|
||||
|
||||
#: gtk/gtktext.c:6076 gtk/gtktextview.c:8926
|
||||
#: gtk/gtktext.c:6078 gtk/gtktextview.c:8946
|
||||
msgid "Insert _Emoji"
|
||||
msgstr "Вставити _емодзі"
|
||||
|
||||
#: gtk/gtktextview.c:8908
|
||||
#: gtk/gtktextview.c:8928
|
||||
msgid "_Undo"
|
||||
msgstr "_Скасувати"
|
||||
|
||||
#: gtk/gtktextview.c:8912
|
||||
#: gtk/gtktextview.c:8932
|
||||
msgid "_Redo"
|
||||
msgstr "Пов_торити"
|
||||
|
||||
@@ -3504,12 +3500,12 @@ msgctxt "volume percentage"
|
||||
msgid "%d %%"
|
||||
msgstr "%d %%"
|
||||
|
||||
#: gtk/gtkwindow.c:6126
|
||||
#: gtk/gtkwindow.c:6206
|
||||
#, c-format
|
||||
msgid "Do you want to use GTK Inspector?"
|
||||
msgstr "Бажаєте використовувати інспектор GTK?"
|
||||
|
||||
#: gtk/gtkwindow.c:6128
|
||||
#: gtk/gtkwindow.c:6208
|
||||
#, c-format
|
||||
msgid ""
|
||||
"GTK Inspector is an interactive debugger that lets you explore and modify "
|
||||
@@ -3520,7 +3516,7 @@ msgstr ""
|
||||
"редагувати внутрішні частини будь-які програми GTK. Його використання може "
|
||||
"спричинити збої в програмі."
|
||||
|
||||
#: gtk/gtkwindow.c:6133
|
||||
#: gtk/gtkwindow.c:6213
|
||||
msgid "Don’t show this message again"
|
||||
msgstr "Не показувати це повідомлення надалі"
|
||||
|
||||
@@ -3590,6 +3586,39 @@ msgstr "Тип параметра"
|
||||
msgid "State"
|
||||
msgstr "Стан"
|
||||
|
||||
#: gtk/inspector/clipboard.c:149
|
||||
#| msgid "Show All"
|
||||
msgid "Show"
|
||||
msgstr "Показати"
|
||||
|
||||
#: gtk/inspector/clipboard.c:205
|
||||
msgctxt "clipboard"
|
||||
msgid "empty"
|
||||
msgstr ""
|
||||
"порожній"
|
||||
|
||||
#: gtk/inspector/clipboard.c:210
|
||||
msgctxt "clipboard"
|
||||
msgid "local"
|
||||
msgstr ""
|
||||
"локальний"
|
||||
|
||||
#: gtk/inspector/clipboard.c:212
|
||||
msgctxt "clipboard"
|
||||
msgid "remote"
|
||||
msgstr ""
|
||||
"віддалений"
|
||||
|
||||
#: gtk/inspector/clipboard.ui:31 gtk/inspector/window.ui:574
|
||||
#| msgid "Copy to clipboard"
|
||||
msgid "Clipboard"
|
||||
msgstr "Буфер обміну"
|
||||
|
||||
#: gtk/inspector/clipboard.ui:70
|
||||
msgid "Primary"
|
||||
msgstr ""
|
||||
"Основний"
|
||||
|
||||
#: gtk/inspector/controllers.c:126
|
||||
msgctxt "event phase"
|
||||
msgid "None"
|
||||
@@ -3655,46 +3684,50 @@ msgstr "Класи стилів"
|
||||
msgid "CSS Property"
|
||||
msgstr "Властивість CSS"
|
||||
|
||||
#: gtk/inspector/general.c:307 gtk/inspector/general.c:387
|
||||
#: gtk/inspector/general.c:309 gtk/inspector/general.c:389
|
||||
msgctxt "GL version"
|
||||
msgid "None"
|
||||
msgstr "Немає"
|
||||
|
||||
#: gtk/inspector/general.c:316
|
||||
#: gtk/inspector/general.c:318
|
||||
msgctxt "GL version"
|
||||
msgid "Disabled"
|
||||
msgstr "Вимкнено"
|
||||
|
||||
#: gtk/inspector/general.c:317
|
||||
#: gtk/inspector/general.c:319
|
||||
msgctxt "GL vendor"
|
||||
msgid "Disabled"
|
||||
msgstr "Вимкнено"
|
||||
|
||||
#: gtk/inspector/general.c:388
|
||||
#: gtk/inspector/general.c:390
|
||||
msgctxt "GL vendor"
|
||||
msgid "None"
|
||||
msgstr "Немає"
|
||||
|
||||
#: gtk/inspector/general.c:439
|
||||
#: gtk/inspector/general.c:441
|
||||
msgctxt "Vulkan device"
|
||||
msgid "Disabled"
|
||||
msgstr "Вимкнено"
|
||||
|
||||
#: gtk/inspector/general.c:440 gtk/inspector/general.c:441
|
||||
#: gtk/inspector/general.c:442 gtk/inspector/general.c:443
|
||||
msgctxt "Vulkan version"
|
||||
msgid "Disabled"
|
||||
msgstr "Вимкнено"
|
||||
|
||||
#: gtk/inspector/general.c:497
|
||||
#: gtk/inspector/general.c:499
|
||||
msgctxt "Vulkan device"
|
||||
msgid "None"
|
||||
msgstr "Немає"
|
||||
|
||||
#: gtk/inspector/general.c:498 gtk/inspector/general.c:499
|
||||
#: gtk/inspector/general.c:500 gtk/inspector/general.c:501
|
||||
msgctxt "Vulkan version"
|
||||
msgid "None"
|
||||
msgstr "Немає"
|
||||
|
||||
#: gtk/inspector/general.c:771
|
||||
msgid "IM Context is hardcoded by GTK_IM_MODULE"
|
||||
msgstr "Контекст способу введення жорстко встановлено у GTK_IM_MODULE"
|
||||
|
||||
#: gtk/inspector/general.ui:32
|
||||
msgid "GTK Version"
|
||||
msgstr "Версія GTK"
|
||||
@@ -3715,39 +3748,43 @@ msgstr "Мапа шрифтів Pango"
|
||||
msgid "Media Backend"
|
||||
msgstr "Мультимедійний модуль"
|
||||
|
||||
#: gtk/inspector/general.ui:175
|
||||
#: gtk/inspector/general.ui:162
|
||||
msgid "Input Method"
|
||||
msgstr "Спосіб введення"
|
||||
|
||||
#: gtk/inspector/general.ui:201
|
||||
msgid "Prefix"
|
||||
msgstr "Префікс"
|
||||
|
||||
#: gtk/inspector/general.ui:377
|
||||
#: gtk/inspector/general.ui:403
|
||||
msgid "Display"
|
||||
msgstr "Екран"
|
||||
|
||||
#: gtk/inspector/general.ui:404
|
||||
#: gtk/inspector/general.ui:430
|
||||
msgid "RGBA Visual"
|
||||
msgstr "Візуалізація RGBA"
|
||||
|
||||
#: gtk/inspector/general.ui:430
|
||||
#: gtk/inspector/general.ui:456
|
||||
msgid "Composited"
|
||||
msgstr "Складений"
|
||||
|
||||
#: gtk/inspector/general.ui:482
|
||||
#: gtk/inspector/general.ui:508
|
||||
msgid "GL Version"
|
||||
msgstr "Версія GL"
|
||||
|
||||
#: gtk/inspector/general.ui:532
|
||||
#: gtk/inspector/general.ui:558
|
||||
msgid "GL Vendor"
|
||||
msgstr "Постачальник GL"
|
||||
|
||||
#: gtk/inspector/general.ui:572
|
||||
#: gtk/inspector/general.ui:598
|
||||
msgid "Vulkan Device"
|
||||
msgstr "Пристрій Vulkan"
|
||||
|
||||
#: gtk/inspector/general.ui:599
|
||||
#: gtk/inspector/general.ui:625
|
||||
msgid "Vulkan API version"
|
||||
msgstr "Версія інтерфейсу Vulkan"
|
||||
|
||||
#: gtk/inspector/general.ui:626
|
||||
#: gtk/inspector/general.ui:652
|
||||
msgid "Vulkan driver version"
|
||||
msgstr "Версія драйвера Vulkan"
|
||||
|
||||
@@ -3813,8 +3850,8 @@ msgid "Surface"
|
||||
msgstr "Поверхня"
|
||||
|
||||
#: gtk/inspector/misc-info.ui:346 gtk/inspector/misc-info.ui:385
|
||||
#: gtk/inspector/misc-info.ui:424 gtk/inspector/prop-editor.c:1111
|
||||
#: gtk/inspector/prop-editor.c:1471 gtk/inspector/window.ui:388
|
||||
#: gtk/inspector/misc-info.ui:424 gtk/inspector/prop-editor.c:1116
|
||||
#: gtk/inspector/prop-editor.c:1476 gtk/inspector/window.ui:396
|
||||
msgid "Properties"
|
||||
msgstr "Властивості"
|
||||
|
||||
@@ -3891,66 +3928,66 @@ msgstr "%s для %s %p"
|
||||
msgid "%s with value type %s"
|
||||
msgstr "%s із типом значення %s"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1179
|
||||
#: gtk/inspector/prop-editor.c:1184
|
||||
#, c-format
|
||||
msgid "Uneditable property type: %s"
|
||||
msgstr "Неможливо редагувати цей тип властивості: %s"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1323
|
||||
#: gtk/inspector/prop-editor.c:1328
|
||||
msgctxt "column number"
|
||||
msgid "None"
|
||||
msgstr "Немає"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1360
|
||||
#: gtk/inspector/prop-editor.c:1365
|
||||
msgid "Attribute:"
|
||||
msgstr "Атрибут:"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1363
|
||||
#: gtk/inspector/prop-editor.c:1368
|
||||
msgid "Model"
|
||||
msgstr "Модель"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1368
|
||||
#: gtk/inspector/prop-editor.c:1373
|
||||
msgid "Column:"
|
||||
msgstr "Стовпець:"
|
||||
|
||||
#. Translators: %s is a type name, for example
|
||||
#. * Action from 0x2345678 (GtkApplicationWindow)
|
||||
#.
|
||||
#: gtk/inspector/prop-editor.c:1467
|
||||
#: gtk/inspector/prop-editor.c:1472
|
||||
#, c-format
|
||||
msgid "Action from: %p (%s)"
|
||||
msgstr "Джерело дії: %p (%s)"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1522
|
||||
#: gtk/inspector/prop-editor.c:1527
|
||||
msgid "Reset"
|
||||
msgstr "Скинути"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1530
|
||||
#: gtk/inspector/prop-editor.c:1535
|
||||
msgctxt "GtkSettings source"
|
||||
msgid "Default"
|
||||
msgstr "Типове"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1533
|
||||
#: gtk/inspector/prop-editor.c:1538
|
||||
msgctxt "GtkSettings source"
|
||||
msgid "Theme"
|
||||
msgstr "Тема"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1536
|
||||
#: gtk/inspector/prop-editor.c:1541
|
||||
msgctxt "GtkSettings source"
|
||||
msgid "XSettings"
|
||||
msgstr "XSettings"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1540
|
||||
#: gtk/inspector/prop-editor.c:1545
|
||||
msgctxt "GtkSettings source"
|
||||
msgid "Application"
|
||||
msgstr "Програма"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1543
|
||||
#: gtk/inspector/prop-editor.c:1548
|
||||
msgctxt "GtkSettings source"
|
||||
msgid "Unknown"
|
||||
msgstr "Невідоме"
|
||||
|
||||
#: gtk/inspector/prop-editor.c:1546
|
||||
#: gtk/inspector/prop-editor.c:1551
|
||||
msgid "Source:"
|
||||
msgstr "Джерело:"
|
||||
|
||||
@@ -4211,111 +4248,111 @@ msgstr "Показати всі об'єкти"
|
||||
msgid "Show all Resources"
|
||||
msgstr "Показати всі ресурси"
|
||||
|
||||
#: gtk/inspector/window.ui:139
|
||||
#: gtk/inspector/window.ui:147
|
||||
msgid "Collect Statistics"
|
||||
msgstr "Збирати статистику"
|
||||
|
||||
#: gtk/inspector/window.ui:191
|
||||
#: gtk/inspector/window.ui:199
|
||||
msgid "Objects"
|
||||
msgstr "Об'єкти"
|
||||
|
||||
#: gtk/inspector/window.ui:223
|
||||
#: gtk/inspector/window.ui:231
|
||||
msgid "Toggle Sidebar"
|
||||
msgstr "Увімкнути або вимкнути бічну панель"
|
||||
|
||||
#: gtk/inspector/window.ui:245
|
||||
#: gtk/inspector/window.ui:253
|
||||
msgid "Refresh action state"
|
||||
msgstr "Оновити стан дії"
|
||||
|
||||
#: gtk/inspector/window.ui:319
|
||||
#: gtk/inspector/window.ui:327
|
||||
msgid "Previous object"
|
||||
msgstr "Попередній об'єкт"
|
||||
|
||||
#: gtk/inspector/window.ui:326
|
||||
#: gtk/inspector/window.ui:334
|
||||
msgid "Child object"
|
||||
msgstr "Дочірній об'єкт"
|
||||
|
||||
#: gtk/inspector/window.ui:333
|
||||
#: gtk/inspector/window.ui:341
|
||||
msgid "Previous sibling"
|
||||
msgstr "Попередній споріднений об'єкт"
|
||||
|
||||
#: gtk/inspector/window.ui:339
|
||||
#: gtk/inspector/window.ui:347
|
||||
msgid "List Position"
|
||||
msgstr "Позиція у списку"
|
||||
|
||||
#: gtk/inspector/window.ui:348
|
||||
#: gtk/inspector/window.ui:356
|
||||
msgid "Next sibling"
|
||||
msgstr "Наступний споріднений об'єкт"
|
||||
|
||||
#: gtk/inspector/window.ui:378
|
||||
#: gtk/inspector/window.ui:386
|
||||
msgid "Miscellaneous"
|
||||
msgstr "Додатково"
|
||||
|
||||
#: gtk/inspector/window.ui:399
|
||||
#: gtk/inspector/window.ui:407
|
||||
msgid "Layout"
|
||||
msgstr "Компонування"
|
||||
|
||||
#: gtk/inspector/window.ui:410
|
||||
#: gtk/inspector/window.ui:418
|
||||
msgid "CSS Nodes"
|
||||
msgstr "Вузли CSS"
|
||||
|
||||
#: gtk/inspector/window.ui:421
|
||||
#: gtk/inspector/window.ui:429
|
||||
msgid "Size Groups"
|
||||
msgstr "Групи розмірів"
|
||||
|
||||
#: gtk/inspector/window.ui:430 gtk/inspector/window.ui:439
|
||||
#: gtk/inspector/window.ui:438 gtk/inspector/window.ui:447
|
||||
msgid "Data"
|
||||
msgstr "Дата"
|
||||
|
||||
#: gtk/inspector/window.ui:449
|
||||
#: gtk/inspector/window.ui:457
|
||||
msgid "Actions"
|
||||
msgstr "Дії"
|
||||
|
||||
#: gtk/inspector/window.ui:460
|
||||
#: gtk/inspector/window.ui:468
|
||||
msgid "Menu"
|
||||
msgstr "Меню"
|
||||
|
||||
#: gtk/inspector/window.ui:469
|
||||
#: gtk/inspector/window.ui:477
|
||||
msgid "Controllers"
|
||||
msgstr "Контролери"
|
||||
|
||||
#: gtk/inspector/window.ui:479
|
||||
#: gtk/inspector/window.ui:487
|
||||
msgid "Magnifier"
|
||||
msgstr "Лупа"
|
||||
|
||||
#: gtk/inspector/window.ui:500
|
||||
#: gtk/inspector/window.ui:508
|
||||
msgid "Accessibility"
|
||||
msgstr "Доступність"
|
||||
|
||||
#: gtk/inspector/window.ui:524
|
||||
#: gtk/inspector/window.ui:532
|
||||
msgid "Global"
|
||||
msgstr "Загальна"
|
||||
|
||||
#: gtk/inspector/window.ui:537
|
||||
#: gtk/inspector/window.ui:545
|
||||
msgid "Information"
|
||||
msgstr "Інформація"
|
||||
|
||||
#: gtk/inspector/window.ui:546
|
||||
#: gtk/inspector/window.ui:554
|
||||
msgid "Settings"
|
||||
msgstr "Параметри"
|
||||
|
||||
#: gtk/inspector/window.ui:555
|
||||
#: gtk/inspector/window.ui:563
|
||||
msgid "Resources"
|
||||
msgstr "Ресурси"
|
||||
|
||||
#: gtk/inspector/window.ui:566
|
||||
#: gtk/inspector/window.ui:584
|
||||
msgid "Statistics"
|
||||
msgstr "Статистика"
|
||||
|
||||
#: gtk/inspector/window.ui:577
|
||||
#: gtk/inspector/window.ui:595
|
||||
msgid "Logging"
|
||||
msgstr "Журналювання"
|
||||
|
||||
#: gtk/inspector/window.ui:592
|
||||
#: gtk/inspector/window.ui:610
|
||||
msgid "CSS"
|
||||
msgstr "CSS"
|
||||
|
||||
#: gtk/inspector/window.ui:601
|
||||
#: gtk/inspector/window.ui:619
|
||||
msgid "Recorder"
|
||||
msgstr "Записувач"
|
||||
|
||||
@@ -7421,37 +7458,37 @@ msgstr ""
|
||||
msgid "%s:%d: Couldn’t parse value for property '%s': %s\n"
|
||||
msgstr "%s:%d: не вдалося обробити значення для властивості «%s»: %s\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:638
|
||||
#: tools/gtk-builder-tool-simplify.c:646
|
||||
#, c-format
|
||||
msgid "%s:%d: %sproperty %s::%s not found\n"
|
||||
msgstr "%s:%d: %sвластивість %s::%s не знайдено\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2275
|
||||
#: tools/gtk-builder-tool-simplify.c:2283
|
||||
#, c-format
|
||||
msgid "Can’t load “%s”: %s\n"
|
||||
msgstr "Не вдалося завантажити «%s»: %s\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2286
|
||||
#: tools/gtk-builder-tool-simplify.c:2294
|
||||
#, c-format
|
||||
msgid "Can’t parse “%s”: %s\n"
|
||||
msgstr "Не вдалося обробити «%s»: %s\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2310
|
||||
#: tools/gtk-builder-tool-simplify.c:2318
|
||||
#, c-format
|
||||
msgid "Failed to read “%s”: %s\n"
|
||||
msgstr "Не вдалося прочитати «%s»: %s\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2316
|
||||
#: tools/gtk-builder-tool-simplify.c:2324
|
||||
#, c-format
|
||||
msgid "Failed to write %s: “%s”\n"
|
||||
msgstr "Не вдалося записати %s: «%s»\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2356
|
||||
#: tools/gtk-builder-tool-simplify.c:2364
|
||||
#, c-format
|
||||
msgid "No .ui file specified\n"
|
||||
msgstr "Не вказано файла .ui\n"
|
||||
|
||||
#: tools/gtk-builder-tool-simplify.c:2362
|
||||
#: tools/gtk-builder-tool-simplify.c:2370
|
||||
#, c-format
|
||||
msgid "Can only simplify a single .ui file without --replace\n"
|
||||
msgstr "Без --replace можна спрощувати лише один файл .ui\n"
|
||||
|
||||
13
testsuite/gsk/compare/linear-gradient-3d.node
Normal file
13
testsuite/gsk/compare/linear-gradient-3d.node
Normal file
@@ -0,0 +1,13 @@
|
||||
clip {
|
||||
clip: 0 -25 50 50;
|
||||
child: transform {
|
||||
transform: perspective(100) rotateY(45);
|
||||
child: linear-gradient {
|
||||
bounds: 0 -100 200 200;
|
||||
start: 0 -100;
|
||||
end: 0 100;
|
||||
stops: 0.5 red,
|
||||
0.5 lime;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
testsuite/gsk/compare/linear-gradient-3d.png
Normal file
BIN
testsuite/gsk/compare/linear-gradient-3d.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 151 B |
@@ -93,10 +93,10 @@ informative_render_tests = [
|
||||
]
|
||||
|
||||
renderers = [
|
||||
# name exclude term
|
||||
[ 'gl', '' ],
|
||||
[ 'broadway', '-3d' ],
|
||||
[ 'cairo', '-3d' ],
|
||||
# name exclude term
|
||||
[ 'gl', '' ],
|
||||
[ 'broadway', '-3d' ],
|
||||
[ 'cairo', '-3d' ],
|
||||
]
|
||||
|
||||
foreach renderer : renderers
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
* {
|
||||
all: unset;
|
||||
background-color: mintcream;
|
||||
}
|
||||
|
||||
picture {
|
||||
background-color: firebrick;
|
||||
}
|
||||
|
||||
#reference {
|
||||
background-image: image(lime);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-size: 100px 100px;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">200</property>
|
||||
<property name="name">reference</property>
|
||||
<property name="decorated">0</property>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">200</property>
|
||||
<property name="decorated">0</property>
|
||||
<child>
|
||||
<object class="GtkOverlay">
|
||||
<child type="overlay">
|
||||
<object class="GtkPicture">
|
||||
<property name="paintable">green-100x100.png</property>
|
||||
<property name="keep-aspect-ratio">0</property>
|
||||
<property name="can-shrink">1</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<layout>
|
||||
<property name="measure">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -1,23 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">200</property>
|
||||
<property name="default-width">100</property>
|
||||
<property name="default-height">200</property>
|
||||
<property name="decorated">0</property>
|
||||
<child>
|
||||
<object class="GtkOverlay">
|
||||
<child type="overlay">
|
||||
<object class="GtkPicture">
|
||||
<property name="paintable">green-100x100.png</property>
|
||||
<property name="keep-aspect-ratio">0</property>
|
||||
<property name="can-shrink">1</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<layout>
|
||||
<property name="measure">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkPicture">
|
||||
<property name="paintable">green-100x100.png</property>
|
||||
<property name="keep-aspect-ratio">0</property>
|
||||
<property name="can-shrink">1</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
* {
|
||||
all: unset;
|
||||
background-color: mintcream;
|
||||
}
|
||||
|
||||
picture {
|
||||
background-color: firebrick;
|
||||
}
|
||||
|
||||
#reference {
|
||||
background-image: image(lime);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-size: 100px 100px;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="width_request">200</property>
|
||||
<property name="height_request">100</property>
|
||||
<property name="name">reference</property>
|
||||
<property name="decorated">0</property>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="width_request">200</property>
|
||||
<property name="height_request">100</property>
|
||||
<property name="decorated">0</property>
|
||||
<child>
|
||||
<object class="GtkOverlay">
|
||||
<child type="overlay">
|
||||
<object class="GtkPicture">
|
||||
<property name="paintable">green-100x100.png</property>
|
||||
<property name="keep-aspect-ratio">0</property>
|
||||
<property name="can-shrink">1</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<layout>
|
||||
<property name="measure">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user