forked from AuroraMiddleware/gtk
Merge branch 'wip/baedert/test-cflags' into 'master'
Pass (almost) all our cflags to tests, testsuite, examples, demos, ... See merge request GNOME/gtk!1516
This commit is contained in:
commit
66a0a8d53e
@ -308,17 +308,17 @@ save_response_cb (GtkNativeDialog *dialog,
|
|||||||
&error);
|
&error);
|
||||||
if (error != NULL)
|
if (error != NULL)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *message_dialog;
|
||||||
|
|
||||||
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
|
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
|
||||||
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
GTK_MESSAGE_INFO,
|
GTK_MESSAGE_INFO,
|
||||||
GTK_BUTTONS_OK,
|
GTK_BUTTONS_OK,
|
||||||
"Saving failed");
|
"Saving failed");
|
||||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
|
||||||
"%s", error->message);
|
"%s", error->message);
|
||||||
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||||
gtk_widget_show (dialog);
|
gtk_widget_show (message_dialog);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ update_weak_position (ConstraintView *self,
|
|||||||
GTK_CONSTRAINT_RELATION_EQ,
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
x,
|
x,
|
||||||
GTK_CONSTRAINT_STRENGTH_WEAK);
|
GTK_CONSTRAINT_STRENGTH_WEAK);
|
||||||
g_object_set_data (G_OBJECT (constraint), "internal", "yes");
|
g_object_set_data (G_OBJECT (constraint), "internal", (char *)"yes");
|
||||||
gtk_constraint_layout_add_constraint (GTK_CONSTRAINT_LAYOUT (manager),
|
gtk_constraint_layout_add_constraint (GTK_CONSTRAINT_LAYOUT (manager),
|
||||||
constraint);
|
constraint);
|
||||||
g_object_set_data (G_OBJECT (child), "x-constraint", constraint);
|
g_object_set_data (G_OBJECT (child), "x-constraint", constraint);
|
||||||
@ -97,7 +97,7 @@ update_weak_position (ConstraintView *self,
|
|||||||
GTK_CONSTRAINT_RELATION_EQ,
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
y,
|
y,
|
||||||
GTK_CONSTRAINT_STRENGTH_WEAK);
|
GTK_CONSTRAINT_STRENGTH_WEAK);
|
||||||
g_object_set_data (G_OBJECT (constraint), "internal", "yes");
|
g_object_set_data (G_OBJECT (constraint), "internal", (char *)"yes");
|
||||||
gtk_constraint_layout_add_constraint (GTK_CONSTRAINT_LAYOUT (manager),
|
gtk_constraint_layout_add_constraint (GTK_CONSTRAINT_LAYOUT (manager),
|
||||||
constraint);
|
constraint);
|
||||||
g_object_set_data (G_OBJECT (child), "y-constraint", constraint);
|
g_object_set_data (G_OBJECT (child), "y-constraint", constraint);
|
||||||
@ -258,7 +258,7 @@ constraint_view_add_guide (ConstraintView *view,
|
|||||||
|
|
||||||
frame = gtk_frame_new (NULL);
|
frame = gtk_frame_new (NULL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "guide");
|
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "guide");
|
||||||
g_object_set_data (G_OBJECT (frame), "internal", "yes");
|
g_object_set_data (G_OBJECT (frame), "internal", (char *)"yes");
|
||||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||||
gtk_widget_insert_after (frame, GTK_WIDGET (view), NULL);
|
gtk_widget_insert_after (frame, GTK_WIDGET (view), NULL);
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ constraint_view_add_guide (ConstraintView *view,
|
|||||||
names[i].attr,
|
names[i].attr,
|
||||||
1.0, 0.0,
|
1.0, 0.0,
|
||||||
GTK_CONSTRAINT_STRENGTH_REQUIRED);
|
GTK_CONSTRAINT_STRENGTH_REQUIRED);
|
||||||
g_object_set_data (G_OBJECT (constraint), "internal", "yes");
|
g_object_set_data (G_OBJECT (constraint), "internal", (char *)"yes");
|
||||||
gtk_constraint_layout_add_constraint (layout, constraint);
|
gtk_constraint_layout_add_constraint (layout, constraint);
|
||||||
g_object_set_data (G_OBJECT (guide), names[i].name, constraint);
|
g_object_set_data (G_OBJECT (guide), names[i].name, constraint);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ get_strength (const char *id)
|
|||||||
return strength;
|
return strength;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
static const char *
|
||||||
get_strength_nick (GtkConstraintStrength strength)
|
get_strength_nick (GtkConstraintStrength strength)
|
||||||
{
|
{
|
||||||
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_STRENGTH);
|
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_STRENGTH);
|
||||||
|
@ -13,6 +13,7 @@ constraint_editor_resources = gnome.compile_resources('constraint_editor_resourc
|
|||||||
|
|
||||||
executable('gtk4-constraint-editor',
|
executable('gtk4-constraint-editor',
|
||||||
constraint_editor_sources, constraint_editor_resources,
|
constraint_editor_sources, constraint_editor_resources,
|
||||||
|
c_args: common_cflags,
|
||||||
dependencies: libgtk_dep,
|
dependencies: libgtk_dep,
|
||||||
include_directories: confinc,
|
include_directories: confinc,
|
||||||
gui_app: true,
|
gui_app: true,
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
typedef GtkApplication DemoApplication;
|
typedef GtkApplication DemoApplication;
|
||||||
typedef GtkApplicationClass DemoApplicationClass;
|
typedef GtkApplicationClass DemoApplicationClass;
|
||||||
|
|
||||||
|
static GType demo_application_get_type (void);
|
||||||
G_DEFINE_TYPE (DemoApplication, demo_application, GTK_TYPE_APPLICATION)
|
G_DEFINE_TYPE (DemoApplication, demo_application, GTK_TYPE_APPLICATION)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -25,6 +26,7 @@ typedef struct {
|
|||||||
} DemoApplicationWindow;
|
} DemoApplicationWindow;
|
||||||
typedef GtkApplicationWindowClass DemoApplicationWindowClass;
|
typedef GtkApplicationWindowClass DemoApplicationWindowClass;
|
||||||
|
|
||||||
|
static GType demo_application_window_get_type (void);
|
||||||
G_DEFINE_TYPE (DemoApplicationWindow, demo_application_window, GTK_TYPE_APPLICATION_WINDOW)
|
G_DEFINE_TYPE (DemoApplicationWindow, demo_application_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||||
|
|
||||||
static void create_window (GApplication *app, const char *contents);
|
static void create_window (GApplication *app, const char *contents);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
static GtkWidget *assistant = NULL;
|
/*static GtkWidget *assistant = NULL;*/
|
||||||
static GtkWidget *progress_bar = NULL;
|
static GtkWidget *progress_bar = NULL;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -27,8 +27,7 @@ apply_changes_gradually (gpointer data)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Close automatically once changes are fully applied. */
|
/* Close automatically once changes are fully applied. */
|
||||||
gtk_widget_destroy (assistant);
|
gtk_widget_destroy (data);
|
||||||
assistant = NULL;
|
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,7 +36,7 @@ static void
|
|||||||
on_assistant_apply (GtkWidget *widget, gpointer data)
|
on_assistant_apply (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
/* Start a timer to simulate changes taking a few seconds to apply. */
|
/* Start a timer to simulate changes taking a few seconds to apply. */
|
||||||
g_timeout_add (100, apply_changes_gradually, NULL);
|
g_timeout_add (100, apply_changes_gradually, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -173,6 +172,8 @@ create_page4 (GtkWidget *assistant)
|
|||||||
GtkWidget*
|
GtkWidget*
|
||||||
do_assistant (GtkWidget *do_widget)
|
do_assistant (GtkWidget *do_widget)
|
||||||
{
|
{
|
||||||
|
static GtkWidget *assistant;
|
||||||
|
|
||||||
if (!assistant)
|
if (!assistant)
|
||||||
{
|
{
|
||||||
assistant = gtk_assistant_new ();
|
assistant = gtk_assistant_new ();
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
|
|
||||||
void
|
static void
|
||||||
copy_button_clicked (GtkWidget *button,
|
copy_button_clicked (GtkWidget *button,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -31,7 +31,7 @@ copy_button_clicked (GtkWidget *button,
|
|||||||
gdk_clipboard_set_text (clipboard, gtk_editable_get_text (GTK_EDITABLE (entry)));
|
gdk_clipboard_set_text (clipboard, gtk_editable_get_text (GTK_EDITABLE (entry)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
paste_received (GObject *source_object,
|
paste_received (GObject *source_object,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@ -75,7 +75,7 @@ paste_received (GObject *source_object,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
paste_button_clicked (GtkWidget *button,
|
paste_button_clicked (GtkWidget *button,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -116,6 +116,9 @@ get_image_paintable (GtkImage *image)
|
|||||||
if (icon == NULL)
|
if (icon == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return GDK_PAINTABLE (icon);
|
return GDK_PAINTABLE (icon);
|
||||||
|
|
||||||
|
case GTK_IMAGE_EMPTY:
|
||||||
|
case GTK_IMAGE_GICON:
|
||||||
default:
|
default:
|
||||||
g_warning ("Image storage type %d not handled",
|
g_warning ("Image storage type %d not handled",
|
||||||
gtk_image_get_storage_type (image));
|
gtk_image_get_storage_type (image));
|
||||||
|
@ -16,7 +16,7 @@ static GtkWidget *frame;
|
|||||||
/* draw callback for the drawing area
|
/* draw callback for the drawing area
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
draw_function (GtkDrawingArea *da,
|
draw_function (GtkDrawingArea *drawing_area,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
|
@ -19,7 +19,7 @@ enum
|
|||||||
static GtkTreeModel *
|
static GtkTreeModel *
|
||||||
create_icon_store (void)
|
create_icon_store (void)
|
||||||
{
|
{
|
||||||
const gchar *icon_names[6] = {
|
const char *icon_names[6] = {
|
||||||
"dialog-warning",
|
"dialog-warning",
|
||||||
"process-stop",
|
"process-stop",
|
||||||
"document-new",
|
"document-new",
|
||||||
@ -27,7 +27,7 @@ create_icon_store (void)
|
|||||||
NULL,
|
NULL,
|
||||||
"document-open"
|
"document-open"
|
||||||
};
|
};
|
||||||
const gchar *labels[6] = {
|
const char *labels[6] = {
|
||||||
N_("Warning"),
|
N_("Warning"),
|
||||||
N_("Stop"),
|
N_("Stop"),
|
||||||
N_("New"),
|
N_("New"),
|
||||||
@ -111,8 +111,8 @@ static GtkTreeModel *
|
|||||||
create_capital_store (void)
|
create_capital_store (void)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
gchar *group;
|
const char *group;
|
||||||
gchar *capital;
|
const char *capital;
|
||||||
} capitals[] = {
|
} capitals[] = {
|
||||||
{ "A - B", NULL },
|
{ "A - B", NULL },
|
||||||
{ NULL, "Albany" },
|
{ NULL, "Albany" },
|
||||||
@ -234,7 +234,7 @@ typedef struct _MaskEntry MaskEntry;
|
|||||||
struct _MaskEntry
|
struct _MaskEntry
|
||||||
{
|
{
|
||||||
GtkEntry entry;
|
GtkEntry entry;
|
||||||
gchar *mask;
|
const char *mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _MaskEntryClass MaskEntryClass;
|
typedef struct _MaskEntryClass MaskEntryClass;
|
||||||
@ -246,6 +246,7 @@ struct _MaskEntryClass
|
|||||||
|
|
||||||
static void mask_entry_editable_init (GtkEditableInterface *iface);
|
static void mask_entry_editable_init (GtkEditableInterface *iface);
|
||||||
|
|
||||||
|
static GType mask_entry_get_type (void);
|
||||||
G_DEFINE_TYPE_WITH_CODE (MaskEntry, mask_entry, GTK_TYPE_ENTRY,
|
G_DEFINE_TYPE_WITH_CODE (MaskEntry, mask_entry, GTK_TYPE_ENTRY,
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
|
||||||
mask_entry_editable_init));
|
mask_entry_editable_init));
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
* These are the available blend modes.
|
* These are the available blend modes.
|
||||||
*/
|
*/
|
||||||
struct {
|
struct {
|
||||||
gchar *name;
|
const char *name;
|
||||||
gchar *id;
|
const char *id;
|
||||||
} blend_modes[] =
|
} blend_modes[] =
|
||||||
{
|
{
|
||||||
{ "Color", "color" },
|
{ "Color", "color" },
|
||||||
|
@ -58,7 +58,7 @@ apply_css (GtkWidget *widget, GtkStyleProvider *provider)
|
|||||||
gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
|
gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
static GtkWidget *
|
||||||
create_toolbar (void)
|
create_toolbar (void)
|
||||||
{
|
{
|
||||||
GtkWidget *toolbar;
|
GtkWidget *toolbar;
|
||||||
|
@ -42,7 +42,7 @@ free_demo_widget (gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define GTK_TYPE_DEMO_WIDGET (gtk_demo_widget_get_type ())
|
#define GTK_TYPE_DEMO_WIDGET (gtk_demo_widget_get_type ())
|
||||||
|
static GType gtk_demo_widget_get_type (void);
|
||||||
G_DEFINE_BOXED_TYPE (GtkDemoWidget, gtk_demo_widget, copy_demo_widget, free_demo_widget)
|
G_DEFINE_BOXED_TYPE (GtkDemoWidget, gtk_demo_widget, copy_demo_widget, free_demo_widget)
|
||||||
|
|
||||||
static GtkDemoWidget *
|
static GtkDemoWidget *
|
||||||
|
@ -275,6 +275,9 @@ cell_edited (GtkCellRendererText *cell,
|
|||||||
g_array_index (articles, Item, i).product, -1);
|
g_array_index (articles, Item, i).product, -1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (path);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
/* Creates a tree model containing the completions */
|
/* Creates a tree model containing the completions */
|
||||||
GtkTreeModel *
|
static GtkTreeModel *
|
||||||
create_completion_model (void)
|
create_completion_model (void)
|
||||||
{
|
{
|
||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
|
@ -37,6 +37,7 @@ get_random_icon_name (GtkIconTheme *theme)
|
|||||||
return icon_names[g_random_int_range(0, n_icon_names)];
|
return icon_names[g_random_int_range(0, n_icon_names)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Can't be static because it's also used in iconscroll.c */
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
create_icon (void)
|
create_icon (void)
|
||||||
{
|
{
|
||||||
|
@ -25,14 +25,14 @@
|
|||||||
|
|
||||||
#define MAKE_TAG(a,b,c,d) (unsigned int)(((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
|
#define MAKE_TAG(a,b,c,d) (unsigned int)(((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
|
||||||
|
|
||||||
static GtkWidget *label;
|
static GtkWidget *the_label;
|
||||||
static GtkWidget *settings;
|
static GtkWidget *settings;
|
||||||
static GtkWidget *description;
|
static GtkWidget *description;
|
||||||
static GtkWidget *font;
|
static GtkWidget *font;
|
||||||
static GtkWidget *script_lang;
|
static GtkWidget *script_lang;
|
||||||
static GtkWidget *resetbutton;
|
static GtkWidget *resetbutton;
|
||||||
static GtkWidget *stack;
|
static GtkWidget *stack;
|
||||||
static GtkWidget *entry;
|
static GtkWidget *the_entry;
|
||||||
static GtkWidget *variations_heading;
|
static GtkWidget *variations_heading;
|
||||||
static GtkWidget *variations_grid;
|
static GtkWidget *variations_grid;
|
||||||
static GtkWidget *instance_combo;
|
static GtkWidget *instance_combo;
|
||||||
@ -301,9 +301,9 @@ update_display (void)
|
|||||||
char *font_desc;
|
char *font_desc;
|
||||||
char *features;
|
char *features;
|
||||||
|
|
||||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
text = gtk_editable_get_text (GTK_EDITABLE (the_entry));
|
||||||
|
|
||||||
if (gtk_label_get_selection_bounds (GTK_LABEL (label), &ins, &bound))
|
if (gtk_label_get_selection_bounds (GTK_LABEL (the_label), &ins, &bound))
|
||||||
{
|
{
|
||||||
start = g_utf8_offset_to_pointer (text, ins) - text;
|
start = g_utf8_offset_to_pointer (text, ins) - text;
|
||||||
end = g_utf8_offset_to_pointer (text, bound) - text;
|
end = g_utf8_offset_to_pointer (text, bound) - text;
|
||||||
@ -409,8 +409,8 @@ update_display (void)
|
|||||||
|
|
||||||
gtk_label_set_text (GTK_LABEL (description), font_desc);
|
gtk_label_set_text (GTK_LABEL (description), font_desc);
|
||||||
gtk_label_set_text (GTK_LABEL (settings), features);
|
gtk_label_set_text (GTK_LABEL (settings), features);
|
||||||
gtk_label_set_text (GTK_LABEL (label), text);
|
gtk_label_set_text (GTK_LABEL (the_label), text);
|
||||||
gtk_label_set_attributes (GTK_LABEL (label), attrs);
|
gtk_label_set_attributes (GTK_LABEL (the_label), attrs);
|
||||||
|
|
||||||
g_free (font_desc);
|
g_free (font_desc);
|
||||||
pango_font_description_free (desc);
|
pango_font_description_free (desc);
|
||||||
@ -548,7 +548,7 @@ update_script_combo (void)
|
|||||||
{
|
{
|
||||||
const char *langname;
|
const char *langname;
|
||||||
char langbuf[5];
|
char langbuf[5];
|
||||||
GtkTreeIter iter;
|
GtkTreeIter tree_iter;
|
||||||
|
|
||||||
if (pair->lang_tag == HB_OT_TAG_DEFAULT_LANGUAGE)
|
if (pair->lang_tag == HB_OT_TAG_DEFAULT_LANGUAGE)
|
||||||
langname = NC_("Language", "Default");
|
langname = NC_("Language", "Default");
|
||||||
@ -563,7 +563,7 @@ update_script_combo (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_list_store_insert_with_values (store, &iter, -1,
|
gtk_list_store_insert_with_values (store, &tree_iter, -1,
|
||||||
0, langname,
|
0, langname,
|
||||||
1, pair->script_index,
|
1, pair->script_index,
|
||||||
2, pair->lang_index,
|
2, pair->lang_index,
|
||||||
@ -572,7 +572,7 @@ update_script_combo (void)
|
|||||||
if (pair->lang_tag == active)
|
if (pair->lang_tag == active)
|
||||||
{
|
{
|
||||||
have_active = TRUE;
|
have_active = TRUE;
|
||||||
active_iter = iter;
|
active_iter = tree_iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -751,7 +751,7 @@ add_font_variations (GString *s)
|
|||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
Axis *axis;
|
Axis *axis;
|
||||||
char buf[G_ASCII_DTOSTR_BUF_SIZE];
|
char buf[G_ASCII_DTOSTR_BUF_SIZE];
|
||||||
char *sep = "";
|
const char *sep = "";
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, axes);
|
g_hash_table_iter_init (&iter, axes);
|
||||||
while (g_hash_table_iter_next (&iter, (gpointer *)NULL, (gpointer *)&axis))
|
while (g_hash_table_iter_next (&iter, (gpointer *)NULL, (gpointer *)&axis))
|
||||||
@ -1129,7 +1129,7 @@ font_features_reset_features (void)
|
|||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
gtk_label_select_region (GTK_LABEL (label), 0, 0);
|
gtk_label_select_region (GTK_LABEL (the_label), 0, 0);
|
||||||
|
|
||||||
g_list_free_full (ranges, free_range);
|
g_list_free_full (ranges, free_range);
|
||||||
ranges = NULL;
|
ranges = NULL;
|
||||||
@ -1156,9 +1156,9 @@ static char *text;
|
|||||||
static void
|
static void
|
||||||
switch_to_entry (void)
|
switch_to_entry (void)
|
||||||
{
|
{
|
||||||
text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry)));
|
text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (the_entry)));
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), "entry");
|
gtk_stack_set_visible_child_name (GTK_STACK (stack), "entry");
|
||||||
gtk_widget_grab_focus (entry);
|
gtk_widget_grab_focus (the_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1217,20 +1217,20 @@ do_font_features (GtkWidget *do_widget)
|
|||||||
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||||
feature_list = GTK_WIDGET (gtk_builder_get_object (builder, "feature_list"));
|
feature_list = GTK_WIDGET (gtk_builder_get_object (builder, "feature_list"));
|
||||||
label = GTK_WIDGET (gtk_builder_get_object (builder, "label"));
|
the_label = GTK_WIDGET (gtk_builder_get_object (builder, "label"));
|
||||||
settings = GTK_WIDGET (gtk_builder_get_object (builder, "settings"));
|
settings = GTK_WIDGET (gtk_builder_get_object (builder, "settings"));
|
||||||
description = GTK_WIDGET (gtk_builder_get_object (builder, "description"));
|
description = GTK_WIDGET (gtk_builder_get_object (builder, "description"));
|
||||||
resetbutton = GTK_WIDGET (gtk_builder_get_object (builder, "reset"));
|
resetbutton = GTK_WIDGET (gtk_builder_get_object (builder, "reset"));
|
||||||
font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
|
font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
|
||||||
script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));
|
script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));
|
||||||
stack = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
|
stack = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
|
||||||
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
the_entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
||||||
edit_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "edit_toggle"));
|
edit_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "edit_toggle"));
|
||||||
|
|
||||||
controller = gtk_event_controller_key_new ();
|
controller = gtk_event_controller_key_new ();
|
||||||
g_object_set_data_full (G_OBJECT (entry), "controller", g_object_ref (controller), g_object_unref);
|
g_object_set_data_full (G_OBJECT (the_entry), "controller", g_object_ref (controller), g_object_unref);
|
||||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), entry);
|
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), the_entry);
|
||||||
gtk_widget_add_controller (entry, controller);
|
gtk_widget_add_controller (the_entry, controller);
|
||||||
|
|
||||||
add_check_group (feature_list, _("Kerning"), (const char *[]){ "kern", NULL });
|
add_check_group (feature_list, _("Kerning"), (const char *[]){ "kern", NULL });
|
||||||
add_check_group (feature_list, _("Ligatures"), (const char *[]){ "liga",
|
add_check_group (feature_list, _("Ligatures"), (const char *[]){ "liga",
|
||||||
|
@ -43,7 +43,6 @@ update_image (void)
|
|||||||
cairo_font_options_t *fopt;
|
cairo_font_options_t *fopt;
|
||||||
cairo_hint_style_t hintstyle;
|
cairo_hint_style_t hintstyle;
|
||||||
cairo_hint_metrics_t hintmetrics;
|
cairo_hint_metrics_t hintmetrics;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!context)
|
if (!context)
|
||||||
context = gtk_widget_create_pango_context (image);
|
context = gtk_widget_create_pango_context (image);
|
||||||
@ -116,6 +115,7 @@ update_image (void)
|
|||||||
|
|
||||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_grid)))
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_grid)))
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
cairo_set_source_rgba (cr, 0.2, 0, 0, 0.2);
|
cairo_set_source_rgba (cr, 0.2, 0, 0, 0.2);
|
||||||
for (i = 1; i < ink.height + 20; i++)
|
for (i = 1; i < ink.height + 20; i++)
|
||||||
{
|
{
|
||||||
|
@ -17,9 +17,9 @@ typedef struct _Demo Demo;
|
|||||||
|
|
||||||
struct _Demo
|
struct _Demo
|
||||||
{
|
{
|
||||||
gchar *name;
|
const char *name;
|
||||||
gchar *title;
|
const char *title;
|
||||||
gchar *filename;
|
const char *filename;
|
||||||
GDoDemoFunc func;
|
GDoDemoFunc func;
|
||||||
Demo *children;
|
Demo *children;
|
||||||
};
|
};
|
||||||
|
@ -383,7 +383,7 @@ close_window (GtkWidget *widget)
|
|||||||
rotation_angles[Z_AXIS] = 0.0;
|
rotation_angles[Z_AXIS] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
static GtkWidget *
|
||||||
create_glarea_window (GtkWidget *do_widget)
|
create_glarea_window (GtkWidget *do_widget)
|
||||||
{
|
{
|
||||||
GtkWidget *window, *box, *button, *controls;
|
GtkWidget *window, *box, *button, *controls;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
static void
|
static void
|
||||||
insert_link (GtkTextBuffer *buffer,
|
insert_link (GtkTextBuffer *buffer,
|
||||||
GtkTextIter *iter,
|
GtkTextIter *iter,
|
||||||
gchar *text,
|
const char *text,
|
||||||
gint page)
|
gint page)
|
||||||
{
|
{
|
||||||
GtkTextTag *tag;
|
GtkTextTag *tag;
|
||||||
|
@ -16,10 +16,9 @@ typedef struct
|
|||||||
{
|
{
|
||||||
const gboolean fixed;
|
const gboolean fixed;
|
||||||
const guint number;
|
const guint number;
|
||||||
const gchar *severity;
|
const char *severity;
|
||||||
const gchar *description;
|
const char *description;
|
||||||
}
|
} Bug;
|
||||||
Bug;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -34,7 +33,7 @@ enum
|
|||||||
NUM_COLUMNS
|
NUM_COLUMNS
|
||||||
};
|
};
|
||||||
|
|
||||||
static Bug data[] =
|
static Bug bugs[] =
|
||||||
{
|
{
|
||||||
{ FALSE, 60482, "Normal", "scrollable notebooks and hidden tabs" },
|
{ FALSE, 60482, "Normal", "scrollable notebooks and hidden tabs" },
|
||||||
{ FALSE, 60620, "Critical", "gdk_surface_clear_area (gdksurface-win32.c) is not thread-safe" },
|
{ FALSE, 60620, "Critical", "gdk_surface_clear_area (gdksurface-win32.c) is not thread-safe" },
|
||||||
@ -98,9 +97,9 @@ create_model (void)
|
|||||||
G_TYPE_BOOLEAN);
|
G_TYPE_BOOLEAN);
|
||||||
|
|
||||||
/* add data to the list store */
|
/* add data to the list store */
|
||||||
for (i = 0; i < G_N_ELEMENTS (data); i++)
|
for (i = 0; i < G_N_ELEMENTS (bugs); i++)
|
||||||
{
|
{
|
||||||
gchar *icon_name;
|
const char *icon_name;
|
||||||
gboolean sensitive;
|
gboolean sensitive;
|
||||||
|
|
||||||
if (i == 1 || i == 3)
|
if (i == 1 || i == 3)
|
||||||
@ -113,10 +112,10 @@ create_model (void)
|
|||||||
sensitive = TRUE;
|
sensitive = TRUE;
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
COLUMN_FIXED, data[i].fixed,
|
COLUMN_FIXED, bugs[i].fixed,
|
||||||
COLUMN_NUMBER, data[i].number,
|
COLUMN_NUMBER, bugs[i].number,
|
||||||
COLUMN_SEVERITY, data[i].severity,
|
COLUMN_SEVERITY, bugs[i].severity,
|
||||||
COLUMN_DESCRIPTION, data[i].description,
|
COLUMN_DESCRIPTION, bugs[i].description,
|
||||||
COLUMN_PULSE, 0,
|
COLUMN_PULSE, 0,
|
||||||
COLUMN_ICON, icon_name,
|
COLUMN_ICON, icon_name,
|
||||||
COLUMN_ACTIVE, FALSE,
|
COLUMN_ACTIVE, FALSE,
|
||||||
@ -129,23 +128,23 @@ create_model (void)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
fixed_toggled (GtkCellRendererToggle *cell,
|
fixed_toggled (GtkCellRendererToggle *cell,
|
||||||
gchar *path_str,
|
char *path_str,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model = (GtkTreeModel *)data;
|
GtkTreeModel *tree_model = (GtkTreeModel *)data;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
|
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
|
||||||
gboolean fixed;
|
gboolean fixed;
|
||||||
|
|
||||||
/* get toggled iter */
|
/* get toggled iter */
|
||||||
gtk_tree_model_get_iter (model, &iter, path);
|
gtk_tree_model_get_iter (tree_model, &iter, path);
|
||||||
gtk_tree_model_get (model, &iter, COLUMN_FIXED, &fixed, -1);
|
gtk_tree_model_get (tree_model, &iter, COLUMN_FIXED, &fixed, -1);
|
||||||
|
|
||||||
/* do something with the value */
|
/* do something with the value */
|
||||||
fixed ^= 1;
|
fixed ^= 1;
|
||||||
|
|
||||||
/* set new value */
|
/* set new value */
|
||||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_FIXED, fixed, -1);
|
gtk_list_store_set (GTK_LIST_STORE (tree_model), &iter, COLUMN_FIXED, fixed, -1);
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (path);
|
||||||
@ -156,7 +155,6 @@ add_columns (GtkTreeView *treeview)
|
|||||||
{
|
{
|
||||||
GtkCellRenderer *renderer;
|
GtkCellRenderer *renderer;
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn *column;
|
||||||
GtkTreeModel *model = gtk_tree_view_get_model (treeview);
|
|
||||||
|
|
||||||
/* column for fixed toggles */
|
/* column for fixed toggles */
|
||||||
renderer = gtk_cell_renderer_toggle_new ();
|
renderer = gtk_cell_renderer_toggle_new ();
|
||||||
|
@ -205,14 +205,14 @@ enum {
|
|||||||
STATE_IN_COMMENT
|
STATE_IN_COMMENT
|
||||||
};
|
};
|
||||||
|
|
||||||
static gchar *tokens[] =
|
static const char *tokens[] =
|
||||||
{
|
{
|
||||||
"/*",
|
"/*",
|
||||||
"\"",
|
"\"",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static gchar *types[] =
|
static const char *types[] =
|
||||||
{
|
{
|
||||||
"static",
|
"static",
|
||||||
"const ",
|
"const ",
|
||||||
@ -337,7 +337,7 @@ static gchar *types[] =
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static gchar *control[] =
|
static const char *control[] =
|
||||||
{
|
{
|
||||||
" if ",
|
" if ",
|
||||||
" while ",
|
" while ",
|
||||||
@ -351,11 +351,11 @@ static gchar *control[] =
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
void
|
void
|
||||||
parse_chars (gchar *text,
|
parse_chars (gchar *text,
|
||||||
gchar **end_ptr,
|
gchar **end_ptr,
|
||||||
gint *state,
|
gint *state,
|
||||||
gchar **tag,
|
const char **tag,
|
||||||
gboolean start)
|
gboolean start)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
gchar *next_token;
|
gchar *next_token;
|
||||||
@ -494,7 +494,7 @@ fontify (GtkTextBuffer *source_buffer)
|
|||||||
gint state;
|
gint state;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
gchar *start_ptr, *end_ptr;
|
gchar *start_ptr, *end_ptr;
|
||||||
gchar *tag;
|
const char *tag;
|
||||||
|
|
||||||
gtk_text_buffer_create_tag (source_buffer, "source",
|
gtk_text_buffer_create_tag (source_buffer, "source",
|
||||||
"font", "monospace",
|
"font", "monospace",
|
||||||
@ -868,7 +868,7 @@ load_file (const gchar *demoname,
|
|||||||
|
|
||||||
p = lines[i];
|
p = lines[i];
|
||||||
state++;
|
state++;
|
||||||
/* Fall through */
|
G_GNUC_FALLTHROUGH;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
/* Reading program body */
|
/* Reading program body */
|
||||||
@ -876,6 +876,9 @@ load_file (const gchar *demoname,
|
|||||||
if (lines[i+1] != NULL)
|
if (lines[i+1] != NULL)
|
||||||
gtk_text_buffer_insert (source_buffer, &start, "\n", 1);
|
gtk_text_buffer_insert (source_buffer, &start, "\n", 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,7 +978,7 @@ startup (GApplication *app)
|
|||||||
{
|
{
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GMenuModel *appmenu;
|
GMenuModel *appmenu;
|
||||||
gchar *ids[] = { "appmenu", NULL };
|
const char *ids[] = { "appmenu", NULL };
|
||||||
|
|
||||||
builder = gtk_builder_new ();
|
builder = gtk_builder_new ();
|
||||||
gtk_builder_add_objects_from_resource (builder, "/ui/appmenu.ui", ids, NULL);
|
gtk_builder_add_objects_from_resource (builder, "/ui/appmenu.ui", ids, NULL);
|
||||||
|
@ -112,9 +112,16 @@ gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
|
|||||||
'demo.gresource.xml',
|
'demo.gresource.xml',
|
||||||
source_dir: '.')
|
source_dir: '.')
|
||||||
|
|
||||||
|
demo_cflags = []
|
||||||
|
foreach flag: common_cflags
|
||||||
|
if flag not in ['-Werror=missing-prototypes', '-Werror=missing-declarations', '-fvisibility=hidden']
|
||||||
|
demo_cflags += flag
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
|
||||||
executable('gtk4-demo',
|
executable('gtk4-demo',
|
||||||
demos, demos_h, extra_demo_sources, gtkdemo_resources,
|
demos, demos_h, extra_demo_sources, gtkdemo_resources,
|
||||||
c_args: gtkdemo_args,
|
c_args: gtkdemo_args + demo_cflags,
|
||||||
dependencies: gtkdemo_deps,
|
dependencies: gtkdemo_deps,
|
||||||
include_directories: confinc,
|
include_directories: confinc,
|
||||||
gui_app: true,
|
gui_app: true,
|
||||||
@ -123,7 +130,7 @@ executable('gtk4-demo',
|
|||||||
|
|
||||||
executable('gtk4-demo-application',
|
executable('gtk4-demo-application',
|
||||||
'application.c', gtkdemo_resources,
|
'application.c', gtkdemo_resources,
|
||||||
c_args: gtkdemo_args,
|
c_args: gtkdemo_args + common_cflags,
|
||||||
dependencies: gtkdemo_deps,
|
dependencies: gtkdemo_deps,
|
||||||
include_directories: confinc,
|
include_directories: confinc,
|
||||||
gui_app: true,
|
gui_app: true,
|
||||||
|
@ -47,6 +47,7 @@ static const gchar *pad_colors[] = {
|
|||||||
"orange"
|
"orange"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static GType drawing_area_get_type (void);
|
||||||
G_DEFINE_TYPE (DrawingArea, drawing_area, GTK_TYPE_WIDGET)
|
G_DEFINE_TYPE (DrawingArea, drawing_area, GTK_TYPE_WIDGET)
|
||||||
|
|
||||||
static void drawing_area_set_color (DrawingArea *area,
|
static void drawing_area_set_color (DrawingArea *area,
|
||||||
@ -340,7 +341,7 @@ drawing_area_init (DrawingArea *area)
|
|||||||
area->draw_color = (GdkRGBA) { 0, 0, 0, 1 };
|
area->draw_color = (GdkRGBA) { 0, 0, 0, 1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
static GtkWidget *
|
||||||
drawing_area_new (void)
|
drawing_area_new (void)
|
||||||
{
|
{
|
||||||
return g_object_new (drawing_area_get_type (), NULL);
|
return g_object_new (drawing_area_get_type (), NULL);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
void
|
static void
|
||||||
toggle_resize (GtkWidget *widget,
|
toggle_resize (GtkWidget *widget,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
@ -47,7 +47,7 @@ toggle_resize (GtkWidget *widget,
|
|||||||
g_object_unref (child);
|
g_object_unref (child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
toggle_shrink (GtkWidget *widget,
|
toggle_shrink (GtkWidget *widget,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
@ -81,7 +81,7 @@ toggle_shrink (GtkWidget *widget,
|
|||||||
g_object_unref (child);
|
g_object_unref (child);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
static GtkWidget *
|
||||||
create_pane_options (GtkPaned *paned,
|
create_pane_options (GtkPaned *paned,
|
||||||
const gchar *frame_label,
|
const gchar *frame_label,
|
||||||
const gchar *label1,
|
const gchar *label1,
|
||||||
|
@ -28,26 +28,23 @@ fancy_shape_renderer (cairo_t *cr,
|
|||||||
(double) attr->ink_rect.width / PANGO_SCALE,
|
(double) attr->ink_rect.width / PANGO_SCALE,
|
||||||
(double) attr->ink_rect.height / PANGO_SCALE);
|
(double) attr->ink_rect.height / PANGO_SCALE);
|
||||||
|
|
||||||
switch (GPOINTER_TO_UINT (attr->data))
|
if (GPOINTER_TO_UINT (attr->data) == 0x2664) /* U+2665 BLACK HEART SUIT */
|
||||||
{
|
{
|
||||||
case 0x2665: /* U+2665 BLACK HEART SUIT */
|
cairo_move_to (cr, .5, .0);
|
||||||
{
|
cairo_line_to (cr, .9, -.4);
|
||||||
cairo_move_to (cr, .5, .0);
|
cairo_curve_to (cr, 1.1, -.8, .5, -.9, .5, -.5);
|
||||||
cairo_line_to (cr, .9, -.4);
|
cairo_curve_to (cr, .5, -.9, -.1, -.8, .1, -.4);
|
||||||
cairo_curve_to (cr, 1.1, -.8, .5, -.9, .5, -.5);
|
cairo_close_path (cr);
|
||||||
cairo_curve_to (cr, .5, -.9, -.1, -.8, .1, -.4);
|
|
||||||
cairo_close_path (cr);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!do_path) {
|
if (!do_path)
|
||||||
cairo_set_source_rgb (cr, 1., 0., 0.);
|
{
|
||||||
cairo_fill (cr);
|
cairo_set_source_rgb (cr, 1., 0., 0.);
|
||||||
}
|
cairo_fill (cr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PangoAttrList *
|
static PangoAttrList *
|
||||||
create_fancy_attr_list_for_layout (PangoLayout *layout)
|
create_fancy_attr_list_for_layout (PangoLayout *layout)
|
||||||
{
|
{
|
||||||
PangoAttrList *attrs;
|
PangoAttrList *attrs;
|
||||||
@ -145,13 +142,13 @@ rotated_text_draw (GtkDrawingArea *da,
|
|||||||
/* Draw the layout N_WORDS times in a circle */
|
/* Draw the layout N_WORDS times in a circle */
|
||||||
for (i = 0; i < N_WORDS; i++)
|
for (i = 0; i < N_WORDS; i++)
|
||||||
{
|
{
|
||||||
int width, height;
|
int layout_width, layout_height;
|
||||||
|
|
||||||
/* Inform Pango to re-layout the text with the new transformation matrix */
|
/* Inform Pango to re-layout the text with the new transformation matrix */
|
||||||
pango_cairo_update_layout (cr, layout);
|
pango_cairo_update_layout (cr, layout);
|
||||||
|
|
||||||
pango_layout_get_pixel_size (layout, &width, &height);
|
pango_layout_get_pixel_size (layout, &layout_width, &layout_height);
|
||||||
cairo_move_to (cr, - width / 2, - RADIUS * .9);
|
cairo_move_to (cr, - layout_width / 2, - RADIUS * .9);
|
||||||
pango_cairo_show_layout (cr, layout);
|
pango_cairo_show_layout (cr, layout);
|
||||||
|
|
||||||
/* Rotate for the next turn */
|
/* Rotate for the next turn */
|
||||||
|
@ -185,13 +185,13 @@ text_changed (GObject *object,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkEntry *entry = GTK_ENTRY (object);
|
GtkEntry *entry = GTK_ENTRY (object);
|
||||||
GActionMap *actions = data;
|
GActionMap *action_map = data;
|
||||||
GAction *action;
|
GAction *action;
|
||||||
gboolean has_text;
|
gboolean has_text;
|
||||||
|
|
||||||
has_text = gtk_entry_get_text_length (entry) > 0;
|
has_text = gtk_entry_get_text_length (entry) > 0;
|
||||||
|
|
||||||
action = g_action_map_lookup_action (actions, "clear");
|
action = g_action_map_lookup_action (action_map, "clear");
|
||||||
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), has_text);
|
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), has_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ puzzle_button_pressed (GtkGestureClick *gesture,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
start_puzzle (GdkPaintable *puzzle)
|
start_puzzle (GdkPaintable *paintable)
|
||||||
{
|
{
|
||||||
GtkWidget *picture, *grid;
|
GtkWidget *picture, *grid;
|
||||||
GtkEventController *controller;
|
GtkEventController *controller;
|
||||||
@ -293,7 +293,7 @@ start_puzzle (GdkPaintable *puzzle)
|
|||||||
grid = gtk_grid_new ();
|
grid = gtk_grid_new ();
|
||||||
gtk_widget_set_can_focus (grid, TRUE);
|
gtk_widget_set_can_focus (grid, TRUE);
|
||||||
gtk_container_add (GTK_CONTAINER (frame), grid);
|
gtk_container_add (GTK_CONTAINER (frame), grid);
|
||||||
aspect_ratio = gdk_paintable_get_intrinsic_aspect_ratio (puzzle);
|
aspect_ratio = gdk_paintable_get_intrinsic_aspect_ratio (paintable);
|
||||||
if (aspect_ratio == 0.0)
|
if (aspect_ratio == 0.0)
|
||||||
aspect_ratio = 1.0;
|
aspect_ratio = 1.0;
|
||||||
gtk_aspect_frame_set (GTK_ASPECT_FRAME (frame), 0.5, 0.5, aspect_ratio, FALSE);
|
gtk_aspect_frame_set (GTK_ASPECT_FRAME (frame), 0.5, 0.5, aspect_ratio, FALSE);
|
||||||
@ -332,7 +332,7 @@ start_puzzle (GdkPaintable *puzzle)
|
|||||||
if (x == pos_x && y == pos_y)
|
if (x == pos_x && y == pos_y)
|
||||||
piece = NULL;
|
piece = NULL;
|
||||||
else
|
else
|
||||||
piece = gtk_puzzle_piece_new (puzzle,
|
piece = gtk_puzzle_piece_new (paintable,
|
||||||
x, y,
|
x, y,
|
||||||
width, height);
|
width, height);
|
||||||
picture = gtk_picture_new_for_paintable (piece);
|
picture = gtk_picture_new_for_paintable (piece);
|
||||||
@ -390,7 +390,7 @@ reconfigure (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_choice (GtkWidget *choices,
|
add_choice (GtkWidget *container,
|
||||||
GdkPaintable *paintable)
|
GdkPaintable *paintable)
|
||||||
{
|
{
|
||||||
GtkWidget *icon;
|
GtkWidget *icon;
|
||||||
@ -398,7 +398,7 @@ add_choice (GtkWidget *choices,
|
|||||||
icon = gtk_image_new_from_paintable (paintable);
|
icon = gtk_image_new_from_paintable (paintable);
|
||||||
gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_LARGE);
|
gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_LARGE);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (choices), icon);
|
gtk_container_add (GTK_CONTAINER (container), icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
|
@ -106,7 +106,7 @@ spinbutton_time_spin_output (GtkSpinButton *spin_button)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *month[12] = {
|
static const char *month[12] = {
|
||||||
"January",
|
"January",
|
||||||
"February",
|
"February",
|
||||||
"March",
|
"March",
|
||||||
|
@ -48,9 +48,9 @@ static void
|
|||||||
fullscreen_clicked_cb (GtkWidget *button,
|
fullscreen_clicked_cb (GtkWidget *button,
|
||||||
gpointer unused)
|
gpointer unused)
|
||||||
{
|
{
|
||||||
GtkWidget *window = GTK_WIDGET (gtk_widget_get_root (button));
|
GtkWidget *widget_window = GTK_WIDGET (gtk_widget_get_root (button));
|
||||||
|
|
||||||
gtk_window_fullscreen (GTK_WINDOW (window));
|
gtk_window_fullscreen (GTK_WINDOW (widget_window));
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
|
@ -383,6 +383,8 @@ get_image_paintable (GtkImage *image)
|
|||||||
if (icon == NULL)
|
if (icon == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return GDK_PAINTABLE (icon);
|
return GDK_PAINTABLE (icon);
|
||||||
|
case GTK_IMAGE_GICON:
|
||||||
|
case GTK_IMAGE_EMPTY:
|
||||||
default:
|
default:
|
||||||
g_warning ("Image storage type %d not handled",
|
g_warning ("Image storage type %d not handled",
|
||||||
gtk_image_get_storage_type (image));
|
gtk_image_get_storage_type (image));
|
||||||
|
@ -11,6 +11,7 @@ iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
|
|||||||
|
|
||||||
executable('gtk4-icon-browser',
|
executable('gtk4-icon-browser',
|
||||||
iconbrowser_sources, iconbrowser_resources,
|
iconbrowser_sources, iconbrowser_resources,
|
||||||
|
c_args: common_cflags,
|
||||||
dependencies: libgtk_dep,
|
dependencies: libgtk_dep,
|
||||||
include_directories: confinc,
|
include_directories: confinc,
|
||||||
gui_app: true,
|
gui_app: true,
|
||||||
|
@ -13,7 +13,9 @@ executable('gtk4-node-editor',
|
|||||||
node_editor_sources, node_editor_resources,
|
node_editor_sources, node_editor_resources,
|
||||||
dependencies: libgtk_dep,
|
dependencies: libgtk_dep,
|
||||||
include_directories: confinc,
|
include_directories: confinc,
|
||||||
c_args: ['-DNODE_EDITOR_SOURCE_DIR="@0@/../../testsuite/gsk/compare/"'.format(meson.current_source_dir())],
|
c_args: [
|
||||||
|
'-DNODE_EDITOR_SOURCE_DIR="@0@/../../testsuite/gsk/compare/"'.format(meson.current_source_dir())
|
||||||
|
] + common_cflags,
|
||||||
gui_app: true,
|
gui_app: true,
|
||||||
link_args: extra_demo_ldflags,
|
link_args: extra_demo_ldflags,
|
||||||
install: false)
|
install: false)
|
||||||
|
@ -425,17 +425,17 @@ save_response_cb (GtkWidget *dialog,
|
|||||||
&error);
|
&error);
|
||||||
if (error != NULL)
|
if (error != NULL)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *message_dialog;
|
||||||
|
|
||||||
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
|
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
|
||||||
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
GTK_MESSAGE_INFO,
|
GTK_MESSAGE_INFO,
|
||||||
GTK_BUTTONS_OK,
|
GTK_BUTTONS_OK,
|
||||||
"Saving failed");
|
"Saving failed");
|
||||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
|
||||||
"%s", error->message);
|
"%s", error->message);
|
||||||
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||||
gtk_widget_show (dialog);
|
gtk_widget_show (message_dialog);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
|
|||||||
|
|
||||||
executable('gtk4-widget-factory',
|
executable('gtk4-widget-factory',
|
||||||
'widget-factory.c', widgetfactory_resources,
|
'widget-factory.c', widgetfactory_resources,
|
||||||
|
c_args: common_cflags,
|
||||||
dependencies: libgtk_dep,
|
dependencies: libgtk_dep,
|
||||||
include_directories: confinc,
|
include_directories: confinc,
|
||||||
gui_app: true,
|
gui_app: true,
|
||||||
|
@ -1075,6 +1075,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef GtkTextViewClass MyTextViewClass;
|
typedef GtkTextViewClass MyTextViewClass;
|
||||||
|
|
||||||
|
static GType my_text_view_get_type (void);
|
||||||
G_DEFINE_TYPE (MyTextView, my_text_view, GTK_TYPE_TEXT_VIEW)
|
G_DEFINE_TYPE (MyTextView, my_text_view, GTK_TYPE_TEXT_VIEW)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1446,6 +1447,7 @@ struct _GTestPermissionClass
|
|||||||
GPermissionClass parent_class;
|
GPermissionClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static GType g_test_permission_get_type (void);
|
||||||
G_DEFINE_TYPE (GTestPermission, g_test_permission, G_TYPE_PERMISSION)
|
G_DEFINE_TYPE (GTestPermission, g_test_permission, G_TYPE_PERMISSION)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1484,7 +1486,7 @@ acquire_async (GPermission *permission,
|
|||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
acquire_finish (GPermission *permission,
|
acquire_finish (GPermission *permission,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
@ -1513,7 +1515,7 @@ release_async (GPermission *permission,
|
|||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
release_finish (GPermission *permission,
|
release_finish (GPermission *permission,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error)
|
GError **error)
|
||||||
|
@ -17,7 +17,7 @@ foreach ex : examples
|
|||||||
'-DGDK_DISABLE_DEPRECATED',
|
'-DGDK_DISABLE_DEPRECATED',
|
||||||
'-DGTK_DISABLE_DEPRECATED',
|
'-DGTK_DISABLE_DEPRECATED',
|
||||||
'-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir()),
|
'-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir()),
|
||||||
],
|
] + common_cflags,
|
||||||
dependencies: libgtk_dep)
|
dependencies: libgtk_dep)
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
@ -135,6 +135,7 @@ plug_man_open (GApplication *application,
|
|||||||
typedef GtkApplication PlugMan;
|
typedef GtkApplication PlugMan;
|
||||||
typedef GtkApplicationClass PlugManClass;
|
typedef GtkApplicationClass PlugManClass;
|
||||||
|
|
||||||
|
static GType plug_man_get_type (void);
|
||||||
G_DEFINE_TYPE (PlugMan, plug_man, GTK_TYPE_APPLICATION)
|
G_DEFINE_TYPE (PlugMan, plug_man, GTK_TYPE_APPLICATION)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -376,10 +377,10 @@ configure_plugins (GSimpleAction *action,
|
|||||||
dialog = (GtkWidget *)gtk_builder_get_object (builder, "plugin-dialog");
|
dialog = (GtkWidget *)gtk_builder_get_object (builder, "plugin-dialog");
|
||||||
check = (GtkWidget *)gtk_builder_get_object (builder, "red-plugin");
|
check = (GtkWidget *)gtk_builder_get_object (builder, "red-plugin");
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("red"));
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("red"));
|
||||||
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), "red");
|
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), (char *) "red");
|
||||||
check = (GtkWidget *)gtk_builder_get_object (builder, "black-plugin");
|
check = (GtkWidget *)gtk_builder_get_object (builder, "black-plugin");
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("black"));
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("black"));
|
||||||
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), "black");
|
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), (char *) "black");
|
||||||
|
|
||||||
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||||
|
|
||||||
@ -481,7 +482,7 @@ plug_man_class_init (PlugManClass *class)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlugMan *
|
static PlugMan *
|
||||||
plug_man_new (void)
|
plug_man_new (void)
|
||||||
{
|
{
|
||||||
return g_object_new (plug_man_get_type (),
|
return g_object_new (plug_man_get_type (),
|
||||||
|
@ -70,6 +70,7 @@ open (GApplication *application,
|
|||||||
typedef GtkApplication MenuButton;
|
typedef GtkApplication MenuButton;
|
||||||
typedef GtkApplicationClass MenuButtonClass;
|
typedef GtkApplicationClass MenuButtonClass;
|
||||||
|
|
||||||
|
static GType menu_button_get_type (void);
|
||||||
G_DEFINE_TYPE (MenuButton, menu_button, GTK_TYPE_APPLICATION)
|
G_DEFINE_TYPE (MenuButton, menu_button, GTK_TYPE_APPLICATION)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -176,7 +177,7 @@ menu_button_class_init (MenuButtonClass *class)
|
|||||||
application_class->open = open;
|
application_class->open = open;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuButton *
|
static MenuButton *
|
||||||
menu_button_new (void)
|
menu_button_new (void)
|
||||||
{
|
{
|
||||||
return g_object_new (menu_button_get_type (),
|
return g_object_new (menu_button_get_type (),
|
||||||
|
@ -1151,7 +1151,7 @@ gtk_builder_add_from_file (GtkBuilder *builder,
|
|||||||
gboolean
|
gboolean
|
||||||
gtk_builder_add_objects_from_file (GtkBuilder *builder,
|
gtk_builder_add_objects_from_file (GtkBuilder *builder,
|
||||||
const gchar *filename,
|
const gchar *filename,
|
||||||
gchar **object_ids,
|
const char **object_ids,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GtkBuilderPrivate *priv = gtk_builder_get_instance_private (builder);
|
GtkBuilderPrivate *priv = gtk_builder_get_instance_private (builder);
|
||||||
@ -1352,7 +1352,7 @@ gtk_builder_add_from_resource (GtkBuilder *builder,
|
|||||||
gboolean
|
gboolean
|
||||||
gtk_builder_add_objects_from_resource (GtkBuilder *builder,
|
gtk_builder_add_objects_from_resource (GtkBuilder *builder,
|
||||||
const gchar *resource_path,
|
const gchar *resource_path,
|
||||||
gchar **object_ids,
|
const char **object_ids,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GtkBuilderPrivate *priv = gtk_builder_get_instance_private (builder);
|
GtkBuilderPrivate *priv = gtk_builder_get_instance_private (builder);
|
||||||
@ -1483,7 +1483,7 @@ gboolean
|
|||||||
gtk_builder_add_objects_from_string (GtkBuilder *builder,
|
gtk_builder_add_objects_from_string (GtkBuilder *builder,
|
||||||
const gchar *buffer,
|
const gchar *buffer,
|
||||||
gssize length,
|
gssize length,
|
||||||
gchar **object_ids,
|
const char **object_ids,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GtkBuilderPrivate *priv = gtk_builder_get_instance_private (builder);
|
GtkBuilderPrivate *priv = gtk_builder_get_instance_private (builder);
|
||||||
|
@ -114,18 +114,18 @@ gboolean gtk_builder_add_from_string (GtkBuilder *builder,
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gtk_builder_add_objects_from_file (GtkBuilder *builder,
|
gboolean gtk_builder_add_objects_from_file (GtkBuilder *builder,
|
||||||
const gchar *filename,
|
const gchar *filename,
|
||||||
gchar **object_ids,
|
const char **object_ids,
|
||||||
GError **error);
|
GError **error);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gtk_builder_add_objects_from_resource(GtkBuilder *builder,
|
gboolean gtk_builder_add_objects_from_resource(GtkBuilder *builder,
|
||||||
const gchar *resource_path,
|
const gchar *resource_path,
|
||||||
gchar **object_ids,
|
const char **object_ids,
|
||||||
GError **error);
|
GError **error);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gtk_builder_add_objects_from_string (GtkBuilder *builder,
|
gboolean gtk_builder_add_objects_from_string (GtkBuilder *builder,
|
||||||
const gchar *buffer,
|
const gchar *buffer,
|
||||||
gssize length,
|
gssize length,
|
||||||
gchar **object_ids,
|
const char **object_ids,
|
||||||
GError **error);
|
GError **error);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GObject* gtk_builder_get_object (GtkBuilder *builder,
|
GObject* gtk_builder_get_object (GtkBuilder *builder,
|
||||||
|
@ -1542,7 +1542,7 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
|
|||||||
const gchar *filename,
|
const gchar *filename,
|
||||||
const gchar *buffer,
|
const gchar *buffer,
|
||||||
gssize length,
|
gssize length,
|
||||||
gchar **requested_objs,
|
const char **requested_objs,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar* domain;
|
const gchar* domain;
|
||||||
|
@ -134,7 +134,7 @@ typedef struct {
|
|||||||
GSList *finalizers;
|
GSList *finalizers;
|
||||||
GSList *custom_finalizers;
|
GSList *custom_finalizers;
|
||||||
|
|
||||||
char **requested_objects; /* NULL if all the objects are requested */
|
const char **requested_objects; /* NULL if all the objects are requested */
|
||||||
gboolean inside_requested_object;
|
gboolean inside_requested_object;
|
||||||
gint requested_object_level;
|
gint requested_object_level;
|
||||||
gint cur_object_level;
|
gint cur_object_level;
|
||||||
@ -160,7 +160,7 @@ void _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
|
|||||||
const gchar *filename,
|
const gchar *filename,
|
||||||
const gchar *buffer,
|
const gchar *buffer,
|
||||||
gssize length,
|
gssize length,
|
||||||
gchar **requested_objs,
|
const char **requested_objs,
|
||||||
GError **error);
|
GError **error);
|
||||||
GObject * _gtk_builder_construct (GtkBuilder *builder,
|
GObject * _gtk_builder_construct (GtkBuilder *builder,
|
||||||
ObjectInfo *info,
|
ObjectInfo *info,
|
||||||
|
@ -7175,7 +7175,8 @@ list_selection_changed (GtkTreeSelection *selection,
|
|||||||
if (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view)) == NULL)
|
if (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view)) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (priv->location_entry)
|
if (priv->location_entry &&
|
||||||
|
priv->browse_files_model)
|
||||||
update_chooser_entry (impl);
|
update_chooser_entry (impl);
|
||||||
|
|
||||||
location_bar_update (impl);
|
location_bar_update (impl);
|
||||||
|
@ -1641,7 +1641,7 @@ _gtk_gesture_get_pointer_emulating_sequence (GtkGesture *gesture,
|
|||||||
case GDK_TOUCH_END:
|
case GDK_TOUCH_END:
|
||||||
if (!gdk_touch_event_get_emulating_pointer (data->event))
|
if (!gdk_touch_event_get_emulating_pointer (data->event))
|
||||||
continue;
|
continue;
|
||||||
/* Fall through */
|
G_GNUC_FALLTHROUGH;
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
case GDK_BUTTON_RELEASE:
|
case GDK_BUTTON_RELEASE:
|
||||||
case GDK_MOTION_NOTIFY:
|
case GDK_MOTION_NOTIFY:
|
||||||
|
@ -84,7 +84,7 @@ struct _GtkPadController {
|
|||||||
GActionGroup *action_group;
|
GActionGroup *action_group;
|
||||||
GdkDevice *pad;
|
GdkDevice *pad;
|
||||||
|
|
||||||
GList *entries;
|
GArray *action_entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkPadControllerClass {
|
struct _GtkPadControllerClass {
|
||||||
@ -98,42 +98,31 @@ enum {
|
|||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GtkPadActionType type;
|
||||||
|
int index;
|
||||||
|
int mode;
|
||||||
|
char *label;
|
||||||
|
char *action_name;
|
||||||
|
} ActionEntryData;
|
||||||
|
|
||||||
static GParamSpec *pspecs[N_PROPS] = { NULL };
|
static GParamSpec *pspecs[N_PROPS] = { NULL };
|
||||||
|
|
||||||
G_DEFINE_TYPE (GtkPadController, gtk_pad_controller, GTK_TYPE_EVENT_CONTROLLER)
|
G_DEFINE_TYPE (GtkPadController, gtk_pad_controller, GTK_TYPE_EVENT_CONTROLLER)
|
||||||
|
|
||||||
static GtkPadActionEntry *
|
static const ActionEntryData *
|
||||||
gtk_pad_action_entry_copy (const GtkPadActionEntry *entry)
|
|
||||||
{
|
|
||||||
GtkPadActionEntry *copy;
|
|
||||||
|
|
||||||
copy = g_slice_new0 (GtkPadActionEntry);
|
|
||||||
*copy = *entry;
|
|
||||||
copy->label = g_strdup (entry->label);
|
|
||||||
copy->action_name = g_strdup (entry->action_name);
|
|
||||||
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_pad_action_entry_free (GtkPadActionEntry *entry)
|
|
||||||
{
|
|
||||||
g_free (entry->label);
|
|
||||||
g_free (entry->action_name);
|
|
||||||
g_slice_free (GtkPadActionEntry, entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const GtkPadActionEntry *
|
|
||||||
gtk_pad_action_find_match (GtkPadController *controller,
|
gtk_pad_action_find_match (GtkPadController *controller,
|
||||||
GtkPadActionType type,
|
GtkPadActionType type,
|
||||||
gint index,
|
gint index,
|
||||||
gint mode)
|
gint mode)
|
||||||
{
|
{
|
||||||
GList *l;
|
guint i;
|
||||||
|
|
||||||
for (l = controller->entries; l; l = l->next)
|
for (i = 0; i < controller->action_entries->len; i++)
|
||||||
{
|
{
|
||||||
GtkPadActionEntry *entry = l->data;
|
const ActionEntryData *entry = &g_array_index (controller->action_entries,
|
||||||
|
ActionEntryData, i);
|
||||||
gboolean match_index = FALSE, match_mode = FALSE;
|
gboolean match_index = FALSE, match_mode = FALSE;
|
||||||
|
|
||||||
if (entry->type != type)
|
if (entry->type != type)
|
||||||
@ -151,7 +140,7 @@ gtk_pad_action_find_match (GtkPadController *controller,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_pad_controller_activate_action (GtkPadController *controller,
|
gtk_pad_controller_activate_action (GtkPadController *controller,
|
||||||
const GtkPadActionEntry *entry)
|
const ActionEntryData *entry)
|
||||||
{
|
{
|
||||||
g_action_group_activate_action (controller->action_group,
|
g_action_group_activate_action (controller->action_group,
|
||||||
entry->action_name,
|
entry->action_name,
|
||||||
@ -160,7 +149,7 @@ gtk_pad_controller_activate_action (GtkPadController *controller,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_pad_controller_activate_action_with_axis (GtkPadController *controller,
|
gtk_pad_controller_activate_action_with_axis (GtkPadController *controller,
|
||||||
const GtkPadActionEntry *entry,
|
const ActionEntryData *entry,
|
||||||
gdouble value)
|
gdouble value)
|
||||||
{
|
{
|
||||||
g_action_group_activate_action (controller->action_group,
|
g_action_group_activate_action (controller->action_group,
|
||||||
@ -177,7 +166,7 @@ gtk_pad_controller_handle_mode_switch (GtkPadController *controller,
|
|||||||
#ifdef GDK_WINDOWING_WAYLAND
|
#ifdef GDK_WINDOWING_WAYLAND
|
||||||
if (GDK_IS_WAYLAND_DISPLAY (gdk_device_get_display (pad)))
|
if (GDK_IS_WAYLAND_DISPLAY (gdk_device_get_display (pad)))
|
||||||
{
|
{
|
||||||
const GtkPadActionEntry *entry;
|
const ActionEntryData *entry;
|
||||||
gint elem, idx, n_features;
|
gint elem, idx, n_features;
|
||||||
|
|
||||||
for (elem = GTK_PAD_ACTION_BUTTON; elem <= GTK_PAD_ACTION_STRIP; elem++)
|
for (elem = GTK_PAD_ACTION_BUTTON; elem <= GTK_PAD_ACTION_STRIP; elem++)
|
||||||
@ -235,7 +224,7 @@ gtk_pad_controller_handle_event (GtkEventController *controller,
|
|||||||
{
|
{
|
||||||
GtkPadController *pad_controller = GTK_PAD_CONTROLLER (controller);
|
GtkPadController *pad_controller = GTK_PAD_CONTROLLER (controller);
|
||||||
GdkEventType event_type = gdk_event_get_event_type (event);
|
GdkEventType event_type = gdk_event_get_event_type (event);
|
||||||
const GtkPadActionEntry *entry;
|
const ActionEntryData *entry;
|
||||||
GtkPadActionType type;
|
GtkPadActionType type;
|
||||||
guint index, mode, group;
|
guint index, mode, group;
|
||||||
gdouble value = 0;
|
gdouble value = 0;
|
||||||
@ -346,8 +335,17 @@ static void
|
|||||||
gtk_pad_controller_finalize (GObject *object)
|
gtk_pad_controller_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GtkPadController *controller = GTK_PAD_CONTROLLER (object);
|
GtkPadController *controller = GTK_PAD_CONTROLLER (object);
|
||||||
|
guint i;
|
||||||
|
|
||||||
g_list_free_full (controller->entries, (GDestroyNotify) gtk_pad_action_entry_free);
|
for (i = 0; i < controller->action_entries->len; i++)
|
||||||
|
{
|
||||||
|
const ActionEntryData *entry = &g_array_index (controller->action_entries,
|
||||||
|
ActionEntryData, i);
|
||||||
|
|
||||||
|
g_free (entry->label);
|
||||||
|
g_free (entry->action_name);
|
||||||
|
}
|
||||||
|
g_array_free (controller->action_entries, TRUE);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_pad_controller_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gtk_pad_controller_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@ -385,6 +383,7 @@ gtk_pad_controller_class_init (GtkPadControllerClass *klass)
|
|||||||
static void
|
static void
|
||||||
gtk_pad_controller_init (GtkPadController *controller)
|
gtk_pad_controller_init (GtkPadController *controller)
|
||||||
{
|
{
|
||||||
|
controller->action_entries = g_array_new (FALSE, TRUE, sizeof (ActionEntryData));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -444,11 +443,25 @@ static void
|
|||||||
gtk_pad_controller_add_entry (GtkPadController *controller,
|
gtk_pad_controller_add_entry (GtkPadController *controller,
|
||||||
const GtkPadActionEntry *entry)
|
const GtkPadActionEntry *entry)
|
||||||
{
|
{
|
||||||
GtkPadActionEntry *copy;
|
guint i;
|
||||||
|
const ActionEntryData new_entry = {
|
||||||
|
.type = entry->type,
|
||||||
|
.index = entry->index,
|
||||||
|
.mode = entry->mode,
|
||||||
|
.label= g_strdup (entry->label),
|
||||||
|
.action_name = g_strdup (entry->action_name)
|
||||||
|
};
|
||||||
|
|
||||||
copy = gtk_pad_action_entry_copy (entry);
|
g_array_set_size (controller->action_entries, controller->action_entries->len + 1);
|
||||||
controller->entries = g_list_insert_sorted (controller->entries, copy,
|
|
||||||
(GCompareFunc) entry_compare_func);
|
for (i = 0; i < controller->action_entries->len; i++)
|
||||||
|
{
|
||||||
|
if (entry_compare_func (&new_entry,
|
||||||
|
&g_array_index (controller->action_entries, ActionEntryData, i)) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_array_insert_val (controller->action_entries, i, new_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -496,13 +509,12 @@ gtk_pad_controller_set_action_entries (GtkPadController *controller,
|
|||||||
void
|
void
|
||||||
gtk_pad_controller_set_action (GtkPadController *controller,
|
gtk_pad_controller_set_action (GtkPadController *controller,
|
||||||
GtkPadActionType type,
|
GtkPadActionType type,
|
||||||
gint index,
|
int index,
|
||||||
gint mode,
|
int mode,
|
||||||
const gchar *label,
|
const char *label,
|
||||||
const gchar *action_name)
|
const char *action_name)
|
||||||
{
|
{
|
||||||
GtkPadActionEntry entry = { type, index, mode,
|
const GtkPadActionEntry entry = { type, index, mode, label, action_name };
|
||||||
(gchar *) label, (gchar *) action_name };
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_PAD_CONTROLLER (controller));
|
g_return_if_fail (GTK_IS_PAD_CONTROLLER (controller));
|
||||||
g_return_if_fail (type <= GTK_PAD_ACTION_STRIP);
|
g_return_if_fail (type <= GTK_PAD_ACTION_STRIP);
|
||||||
|
@ -68,10 +68,10 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
struct _GtkPadActionEntry {
|
struct _GtkPadActionEntry {
|
||||||
GtkPadActionType type;
|
GtkPadActionType type;
|
||||||
gint index;
|
int index;
|
||||||
gint mode;
|
int mode;
|
||||||
gchar *label;
|
const char *label;
|
||||||
gchar *action_name;
|
const char *action_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
@ -3631,7 +3631,7 @@ gtk_text_move_cursor (GtkText *self,
|
|||||||
case GTK_MOVEMENT_WORDS:
|
case GTK_MOVEMENT_WORDS:
|
||||||
if (priv->resolved_dir == PANGO_DIRECTION_RTL)
|
if (priv->resolved_dir == PANGO_DIRECTION_RTL)
|
||||||
count *= -1;
|
count *= -1;
|
||||||
/* Fall through */
|
G_GNUC_FALLTHROUGH;
|
||||||
|
|
||||||
case GTK_MOVEMENT_LOGICAL_POSITIONS:
|
case GTK_MOVEMENT_LOGICAL_POSITIONS:
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
|
@ -237,6 +237,7 @@ if cc.get_id() == 'msvc'
|
|||||||
elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
||||||
test_cflags = [
|
test_cflags = [
|
||||||
'-fno-strict-aliasing',
|
'-fno-strict-aliasing',
|
||||||
|
'-Wno-typedef-redefinition',
|
||||||
'-Wcast-align',
|
'-Wcast-align',
|
||||||
'-Wduplicated-branches',
|
'-Wduplicated-branches',
|
||||||
'-Wduplicated-cond',
|
'-Wduplicated-cond',
|
||||||
|
@ -130,7 +130,7 @@ on_frame_clock_after_paint (GdkFrameClock *frame_clock,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
on_window_realize (GtkWidget *window,
|
on_window_realize (GtkWidget *window,
|
||||||
FrameStats *frame_stats)
|
FrameStats *frame_stats)
|
||||||
{
|
{
|
||||||
@ -139,7 +139,7 @@ on_window_realize (GtkWidget *window,
|
|||||||
G_CALLBACK (on_frame_clock_after_paint), frame_stats);
|
G_CALLBACK (on_frame_clock_after_paint), frame_stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
on_window_unrealize (GtkWidget *window,
|
on_window_unrealize (GtkWidget *window,
|
||||||
FrameStats *frame_stats)
|
FrameStats *frame_stats)
|
||||||
{
|
{
|
||||||
@ -149,7 +149,7 @@ on_window_unrealize (GtkWidget *window,
|
|||||||
frame_stats->frame_clock = NULL;
|
frame_stats->frame_clock = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
on_window_destroy (GtkWidget *window,
|
on_window_destroy (GtkWidget *window,
|
||||||
FrameStats *stats)
|
FrameStats *stats)
|
||||||
{
|
{
|
||||||
|
@ -511,7 +511,7 @@ invert(GLfloat *m)
|
|||||||
* @param zNear the near clipping plane
|
* @param zNear the near clipping plane
|
||||||
* @param zFar the far clipping plane
|
* @param zFar the far clipping plane
|
||||||
*/
|
*/
|
||||||
void perspective(GLfloat *m, GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
|
static void perspective(GLfloat *m, GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
|
||||||
{
|
{
|
||||||
GLfloat tmp[16];
|
GLfloat tmp[16];
|
||||||
double sine, cosine, cotangent, deltaZ;
|
double sine, cosine, cotangent, deltaZ;
|
||||||
|
@ -22,6 +22,7 @@ typedef struct
|
|||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
} MyObjectClass;
|
} MyObjectClass;
|
||||||
|
|
||||||
|
static GType my_object_get_type (void);
|
||||||
G_DEFINE_TYPE (MyObject, my_object, G_TYPE_OBJECT)
|
G_DEFINE_TYPE (MyObject, my_object, G_TYPE_OBJECT)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -145,7 +145,7 @@ foreach t: gtk_tests
|
|||||||
test_srcs = ['@0@.c'.format(test_name), t.get(1, [])]
|
test_srcs = ['@0@.c'.format(test_name), t.get(1, [])]
|
||||||
executable(test_name, test_srcs,
|
executable(test_name, test_srcs,
|
||||||
include_directories: [confinc, gdkinc],
|
include_directories: [confinc, gdkinc],
|
||||||
c_args: test_args,
|
c_args: test_args + common_cflags,
|
||||||
dependencies: [libgtk_dep, libm])
|
dependencies: [libgtk_dep, libm])
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
@ -682,14 +682,14 @@ static const gchar ui_info[] =
|
|||||||
"</interface>";
|
"</interface>";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
buffer_changed_callback (GtkTextBuffer *buffer)
|
buffer_changed_callback (GtkTextBuffer *text_buffer)
|
||||||
{
|
{
|
||||||
file_changed = TRUE;
|
file_changed = TRUE;
|
||||||
update_statusbar ();
|
update_statusbar ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mark_set_callback (GtkTextBuffer *buffer,
|
mark_set_callback (GtkTextBuffer *text_buffer,
|
||||||
const GtkTextIter *new_location,
|
const GtkTextIter *new_location,
|
||||||
GtkTextMark *mark,
|
GtkTextMark *mark,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -78,7 +78,7 @@ hsv_to_rgb (GdkRGBA *rgba,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GskRenderNode *
|
static GskRenderNode *
|
||||||
rounded_borders (guint n)
|
rounded_borders (guint n)
|
||||||
{
|
{
|
||||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||||
@ -112,7 +112,7 @@ rounded_borders (guint n)
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
GskRenderNode *
|
static GskRenderNode *
|
||||||
rounded_backgrounds (guint n)
|
rounded_backgrounds (guint n)
|
||||||
{
|
{
|
||||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||||
@ -145,7 +145,7 @@ rounded_backgrounds (guint n)
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
GskRenderNode *
|
static GskRenderNode *
|
||||||
colors (guint n)
|
colors (guint n)
|
||||||
{
|
{
|
||||||
GskRenderNode **nodes = g_new (GskRenderNode *, 10 * n);
|
GskRenderNode **nodes = g_new (GskRenderNode *, 10 * n);
|
||||||
@ -174,7 +174,7 @@ colors (guint n)
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
GskRenderNode *
|
static GskRenderNode *
|
||||||
clipped_colors (guint n)
|
clipped_colors (guint n)
|
||||||
{
|
{
|
||||||
GskRenderNode **nodes = g_newa (GskRenderNode *,n);
|
GskRenderNode **nodes = g_newa (GskRenderNode *,n);
|
||||||
@ -241,7 +241,7 @@ compare_color_stops (gconstpointer a,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GskRenderNode *
|
static GskRenderNode *
|
||||||
linear_gradient (guint n)
|
linear_gradient (guint n)
|
||||||
{
|
{
|
||||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||||
@ -306,7 +306,7 @@ linear_gradient (guint n)
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
GskRenderNode *
|
static GskRenderNode *
|
||||||
borders (guint n)
|
borders (guint n)
|
||||||
{
|
{
|
||||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||||
@ -355,7 +355,7 @@ const char *example =
|
|||||||
"Beware the Jubjub bird, and shun\n"
|
"Beware the Jubjub bird, and shun\n"
|
||||||
"The frumious Bandersnatch!'";
|
"The frumious Bandersnatch!'";
|
||||||
|
|
||||||
GskRenderNode *
|
static GskRenderNode *
|
||||||
text (guint n)
|
text (guint n)
|
||||||
{
|
{
|
||||||
GPtrArray *nodes;
|
GPtrArray *nodes;
|
||||||
@ -447,7 +447,7 @@ text (guint n)
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
GskRenderNode *
|
static GskRenderNode *
|
||||||
cairo_node (guint n)
|
cairo_node (guint n)
|
||||||
{
|
{
|
||||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||||
@ -472,7 +472,7 @@ cairo_node (guint n)
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
GskRenderNode *
|
static GskRenderNode *
|
||||||
box_shadows (guint n)
|
box_shadows (guint n)
|
||||||
{
|
{
|
||||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||||
@ -540,7 +540,7 @@ main (int argc, char **argv)
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GskRenderNode *node;
|
GskRenderNode *node;
|
||||||
GPatternSpec *matcher;
|
GPatternSpec *matcher;
|
||||||
char *pattern;
|
const char *pattern;
|
||||||
guint i, n;
|
guint i, n;
|
||||||
|
|
||||||
gtk_init ();
|
gtk_init ();
|
||||||
|
@ -17,6 +17,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef GtkTextViewClass MyTextViewClass;
|
typedef GtkTextViewClass MyTextViewClass;
|
||||||
|
|
||||||
|
static GType my_text_view_get_type (void);
|
||||||
G_DEFINE_TYPE (MyTextView, my_text_view, GTK_TYPE_TEXT_VIEW)
|
G_DEFINE_TYPE (MyTextView, my_text_view, GTK_TYPE_TEXT_VIEW)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -27,7 +28,7 @@ my_text_view_class_init (MyTextViewClass *tv_class) {}
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
GtkWidget *
|
static GtkWidget *
|
||||||
create_widget_factory_content (void)
|
create_widget_factory_content (void)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@ -64,7 +65,7 @@ set_adjustment_to_fraction (GtkAdjustment *adjustment,
|
|||||||
fraction * (upper - page_size));
|
fraction * (upper - page_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
scroll_viewport (GtkWidget *viewport,
|
scroll_viewport (GtkWidget *viewport,
|
||||||
GdkFrameClock *frame_clock,
|
GdkFrameClock *frame_clock,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
|
@ -187,8 +187,8 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
if (write_to_filename != NULL)
|
if (write_to_filename != NULL)
|
||||||
{
|
{
|
||||||
GdkSurface *window = gdk_surface_new_toplevel (gdk_display_get_default(), 10 , 10);
|
GdkSurface *surface = gdk_surface_new_toplevel (gdk_display_get_default(), 10 , 10);
|
||||||
GskRenderer *renderer = gsk_renderer_new_for_surface (window);
|
GskRenderer *renderer = gsk_renderer_new_for_surface (surface);
|
||||||
GdkTexture *texture = gsk_renderer_render_texture (renderer, GTK_NODE_VIEW (nodeview)->node, NULL);
|
GdkTexture *texture = gsk_renderer_render_texture (renderer, GTK_NODE_VIEW (nodeview)->node, NULL);
|
||||||
|
|
||||||
g_message ("Writing .node file to .png using %s", G_OBJECT_TYPE_NAME (renderer));
|
g_message ("Writing .node file to .png using %s", G_OBJECT_TYPE_NAME (renderer));
|
||||||
@ -201,7 +201,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
g_object_unref (texture);
|
g_object_unref (texture);
|
||||||
g_object_unref (renderer);
|
g_object_unref (renderer);
|
||||||
g_object_unref (window);
|
g_object_unref (surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compare_node)
|
if (compare_node)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
hello (void)
|
hello (void)
|
||||||
{
|
{
|
||||||
g_print ("hello world\n");
|
g_print ("hello world\n");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* XPM */
|
/* XPM */
|
||||||
static char *openfile[] = {
|
static const char *openfile[] = {
|
||||||
/* width height num_colors chars_per_pixel */
|
/* width height num_colors chars_per_pixel */
|
||||||
" 20 19 66 2",
|
" 20 19 66 2",
|
||||||
/* colors */
|
/* colors */
|
||||||
|
@ -62,9 +62,9 @@ static void
|
|||||||
quit_cb (GtkWidget *widget,
|
quit_cb (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gboolean *done = data;
|
gboolean *is_done = data;
|
||||||
|
|
||||||
*done = TRUE;
|
*is_done = TRUE;
|
||||||
|
|
||||||
g_main_context_wakeup (NULL);
|
g_main_context_wakeup (NULL);
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,12 @@ static GtkWidget *toplevel, *button, *box;
|
|||||||
static GtkWidget *sel_image, *sel_name;
|
static GtkWidget *sel_image, *sel_name;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
combo_changed_cb (GtkAppChooserButton *button,
|
combo_changed_cb (GtkAppChooserButton *chooser_button,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GAppInfo *app_info;
|
GAppInfo *app_info;
|
||||||
|
|
||||||
app_info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (button));
|
app_info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (chooser_button));
|
||||||
|
|
||||||
if (app_info == NULL)
|
if (app_info == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -677,7 +677,7 @@ create_page_flipping_assistant (GtkWidget *widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
gchar *text;
|
const char *text;
|
||||||
void (*func) (GtkWidget *widget);
|
void (*func) (GtkWidget *widget);
|
||||||
} buttons[] =
|
} buttons[] =
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
static char *baseline_pos_str[] = {
|
static const char *baseline_pos_str[] = {
|
||||||
"BASELINE_POSITION_TOP",
|
"BASELINE_POSITION_TOP",
|
||||||
"BASELINE_POSITION_CENTER",
|
"BASELINE_POSITION_CENTER",
|
||||||
"BASELINE_POSITION_BOTTOM"
|
"BASELINE_POSITION_BOTTOM"
|
||||||
@ -114,7 +114,7 @@ main (int argc,
|
|||||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||||
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
||||||
|
|
||||||
char *aligns_names[] = { "FILL", "BASELINE" };
|
const char *aligns_names[] = { "FILL", "BASELINE" };
|
||||||
GtkAlign aligns[] = { GTK_ALIGN_FILL, GTK_ALIGN_BASELINE};
|
GtkAlign aligns[] = { GTK_ALIGN_FILL, GTK_ALIGN_BASELINE};
|
||||||
|
|
||||||
label = gtk_label_new (aligns_names[j]);
|
label = gtk_label_new (aligns_names[j]);
|
||||||
@ -251,7 +251,7 @@ main (int argc,
|
|||||||
|
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
char *labels[] = { "Normal:", "Baseline (top):", "Baseline (center):", "Baseline (bottom):"};
|
const char *labels[] = { "Normal:", "Baseline (top):", "Baseline (center):", "Baseline (bottom):"};
|
||||||
label = gtk_label_new (labels[j]);
|
label = gtk_label_new (labels[j]);
|
||||||
|
|
||||||
gtk_grid_attach (GTK_GRID (grid),
|
gtk_grid_attach (GTK_GRID (grid),
|
||||||
|
@ -17,7 +17,7 @@ struct _GtkBlurBoxClass
|
|||||||
};
|
};
|
||||||
typedef struct _GtkBlurBoxClass GtkBlurBoxClass;
|
typedef struct _GtkBlurBoxClass GtkBlurBoxClass;
|
||||||
|
|
||||||
|
static GType gtk_blur_box_get_type (void);
|
||||||
G_DEFINE_TYPE (GtkBlurBox, gtk_blur_box, GTK_TYPE_BOX)
|
G_DEFINE_TYPE (GtkBlurBox, gtk_blur_box, GTK_TYPE_BOX)
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ enum
|
|||||||
|
|
||||||
static char *
|
static char *
|
||||||
calendar_date_to_string (CalendarData *data,
|
calendar_date_to_string (CalendarData *data,
|
||||||
char *format)
|
const char *format)
|
||||||
{
|
{
|
||||||
GDateTime *date;
|
GDateTime *date;
|
||||||
char *str;
|
char *str;
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
#define NUM_COLS 17 /* change this when adding columns */
|
#define NUM_COLS 17 /* change this when adding columns */
|
||||||
|
|
||||||
struct cell_params {
|
struct cell_params {
|
||||||
char *description; /* 0 */
|
const char *description; /* 0 */
|
||||||
char *test; /* 1 */
|
const char *test; /* 1 */
|
||||||
int xpad; /* 2 */
|
int xpad; /* 2 */
|
||||||
int ypad; /* 3 */
|
int ypad; /* 3 */
|
||||||
double xalign; /* 4 */
|
double xalign; /* 4 */
|
||||||
|
@ -61,13 +61,13 @@ main (int argc, char *argv[])
|
|||||||
const gchar *c[9] = { "red", "maroon", "yellow", "green", "blue", "magenta", "DarkOliveGreen4", "khaki2", "thistle1" };
|
const gchar *c[9] = { "red", "maroon", "yellow", "green", "blue", "magenta", "DarkOliveGreen4", "khaki2", "thistle1" };
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
GdkRGBA colors[9*9];
|
GdkRGBA colors[9*9];
|
||||||
gint i,j;
|
gint k,j;
|
||||||
gdouble f[5] = { 0.2, 0.35, 0.5, 0.65, 0.8 };
|
gdouble f[5] = { 0.2, 0.35, 0.5, 0.65, 0.8 };
|
||||||
|
|
||||||
g_print ("setting custom palette\n");
|
g_print ("setting custom palette\n");
|
||||||
for (i = 0; i < 9; i++)
|
for (k = 0; k < 9; k++)
|
||||||
{
|
{
|
||||||
gdk_rgba_parse (&color, c[i]);
|
gdk_rgba_parse (&color, c[k]);
|
||||||
for (j = 0; j < 5; j++)
|
for (j = 0; j < 5; j++)
|
||||||
{
|
{
|
||||||
colors[i*9 + j].red = f[j]*color.red;
|
colors[i*9 + j].red = f[j]*color.red;
|
||||||
|
@ -33,9 +33,9 @@ test_init (void)
|
|||||||
g_setenv ("GTK_IM_MODULE_FILE", "../modules/input/immodules.cache", TRUE);
|
g_setenv ("GTK_IM_MODULE_FILE", "../modules/input/immodules.cache", TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
G_GNUC_PRINTF (1, 2) static void
|
||||||
combochange_log (const char *fmt,
|
combochange_log (const char *fmt,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
|
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
|
||||||
GtkTextIter iter;
|
GtkTextIter iter;
|
||||||
@ -204,6 +204,8 @@ animation_timer (gpointer data)
|
|||||||
case 2:
|
case 2:
|
||||||
on_reorder ();
|
on_reorder ();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
n_animations--;
|
n_animations--;
|
||||||
|
@ -200,6 +200,7 @@ typedef struct {
|
|||||||
GtkDialogClass parent_class;
|
GtkDialogClass parent_class;
|
||||||
} MyDialogClass;
|
} MyDialogClass;
|
||||||
|
|
||||||
|
static GType my_dialog_get_type (void);
|
||||||
G_DEFINE_TYPE (MyDialog, my_dialog, GTK_TYPE_DIALOG);
|
G_DEFINE_TYPE (MyDialog, my_dialog, GTK_TYPE_DIALOG);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -270,6 +271,7 @@ typedef struct {
|
|||||||
GtkDialogClass parent_class;
|
GtkDialogClass parent_class;
|
||||||
} MyDialog2Class;
|
} MyDialog2Class;
|
||||||
|
|
||||||
|
static GType my_dialog2_get_type (void);
|
||||||
G_DEFINE_TYPE (MyDialog2, my_dialog2, GTK_TYPE_DIALOG);
|
G_DEFINE_TYPE (MyDialog2, my_dialog2, GTK_TYPE_DIALOG);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -307,7 +307,7 @@ action_make_unique (GdkDragAction action)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkDragAction
|
static GdkDragAction
|
||||||
trash_drag_enter (GtkDropTarget *dest,
|
trash_drag_enter (GtkDropTarget *dest,
|
||||||
GdkDrop *drop,
|
GdkDrop *drop,
|
||||||
double x,
|
double x,
|
||||||
@ -325,7 +325,7 @@ trash_drag_enter (GtkDropTarget *dest,
|
|||||||
return action_make_unique (gdk_drop_get_actions (drop));;
|
return action_make_unique (gdk_drop_get_actions (drop));;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkDragAction
|
static GdkDragAction
|
||||||
trash_drag_leave (GtkDropTarget *dest,
|
trash_drag_leave (GtkDropTarget *dest,
|
||||||
GdkDrop *drop,
|
GdkDrop *drop,
|
||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
@ -341,7 +341,7 @@ trash_drag_leave (GtkDropTarget *dest,
|
|||||||
return action_make_unique (gdk_drop_get_actions (drop));
|
return action_make_unique (gdk_drop_get_actions (drop));
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
trash_drag_drop (GtkDropTarget *dest,
|
trash_drag_drop (GtkDropTarget *dest,
|
||||||
GdkDrop *drop,
|
GdkDrop *drop,
|
||||||
double x,
|
double x,
|
||||||
@ -359,7 +359,7 @@ trash_drag_drop (GtkDropTarget *dest,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
label_drag_drop (GtkDropTarget *dest,
|
label_drag_drop (GtkDropTarget *dest,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
int x,
|
int x,
|
||||||
@ -381,7 +381,7 @@ static gboolean in_popup = FALSE;
|
|||||||
static guint popdown_timer = 0;
|
static guint popdown_timer = 0;
|
||||||
static guint popup_timer = 0;
|
static guint popup_timer = 0;
|
||||||
|
|
||||||
gint
|
static int
|
||||||
popdown_cb (gpointer data)
|
popdown_cb (gpointer data)
|
||||||
{
|
{
|
||||||
popdown_timer = 0;
|
popdown_timer = 0;
|
||||||
@ -392,7 +392,7 @@ popdown_cb (gpointer data)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
popup_enter (GtkDropTarget *dest)
|
popup_enter (GtkDropTarget *dest)
|
||||||
{
|
{
|
||||||
g_print ("popup enter\n");
|
g_print ("popup enter\n");
|
||||||
@ -408,7 +408,7 @@ popup_enter (GtkDropTarget *dest)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
popup_leave (GtkDropTarget *dest)
|
popup_leave (GtkDropTarget *dest)
|
||||||
{
|
{
|
||||||
g_print ("popup leave\n");
|
g_print ("popup leave\n");
|
||||||
@ -430,7 +430,7 @@ popup_drop (GtkDropTarget *dest)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
popup_cb (gpointer data)
|
popup_cb (gpointer data)
|
||||||
{
|
{
|
||||||
if (!popped_up)
|
if (!popped_up)
|
||||||
@ -474,16 +474,7 @@ popup_cb (gpointer data)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static void
|
||||||
popsite_motion (GtkDropTarget *dest,
|
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
GtkWidget *widget)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
popsite_enter (GtkDropControllerMotion *motion)
|
popsite_enter (GtkDropControllerMotion *motion)
|
||||||
{
|
{
|
||||||
g_print ("popsite enter\n");
|
g_print ("popsite enter\n");
|
||||||
@ -491,7 +482,7 @@ popsite_enter (GtkDropControllerMotion *motion)
|
|||||||
popup_timer = g_timeout_add (500, popup_cb, NULL);
|
popup_timer = g_timeout_add (500, popup_cb, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
popsite_leave (GtkDropControllerMotion *motion)
|
popsite_leave (GtkDropControllerMotion *motion)
|
||||||
{
|
{
|
||||||
g_print ("popsite leave\n");
|
g_print ("popsite leave\n");
|
||||||
@ -502,14 +493,7 @@ popsite_leave (GtkDropControllerMotion *motion)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
source_drag_data_delete (GtkWidget *widget,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
g_print ("Delete the data!\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
test_init (void)
|
test_init (void)
|
||||||
{
|
{
|
||||||
if (g_file_test ("../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
|
if (g_file_test ("../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
|
||||||
|
@ -79,6 +79,8 @@ get_image_texture (GtkImage *image)
|
|||||||
0);
|
0);
|
||||||
paintable = GDK_PAINTABLE (icon);
|
paintable = GDK_PAINTABLE (icon);
|
||||||
break;
|
break;
|
||||||
|
case GTK_IMAGE_GICON:
|
||||||
|
case GTK_IMAGE_EMPTY:
|
||||||
default:
|
default:
|
||||||
g_warning ("Image storage type %d not handled",
|
g_warning ("Image storage type %d not handled",
|
||||||
gtk_image_get_storage_type (image));
|
gtk_image_get_storage_type (image));
|
||||||
@ -323,7 +325,7 @@ drag_cancel (GtkDragSource *source,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
static GtkWidget *
|
||||||
make_image (const gchar *icon_name, int hotspot)
|
make_image (const gchar *icon_name, int hotspot)
|
||||||
{
|
{
|
||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
/* Don't copy this bad example; inline RGB data is always a better
|
/* Don't copy this bad example; inline RGB data is always a better
|
||||||
* idea than inline XPMs.
|
* idea than inline XPMs.
|
||||||
*/
|
*/
|
||||||
static char *book_closed_xpm[] = {
|
static const char *book_closed_xpm[] = {
|
||||||
"16 16 6 1",
|
"16 16 6 1",
|
||||||
" c None s None",
|
" c None s None",
|
||||||
". c black",
|
". c black",
|
||||||
@ -54,7 +54,7 @@ static GtkWidget *window = NULL;
|
|||||||
|
|
||||||
|
|
||||||
/* Creates a tree model containing the completions */
|
/* Creates a tree model containing the completions */
|
||||||
GtkTreeModel *
|
static GtkTreeModel *
|
||||||
create_simple_completion_model (void)
|
create_simple_completion_model (void)
|
||||||
{
|
{
|
||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
@ -120,7 +120,7 @@ create_simple_completion_model (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Creates a tree model containing the completions */
|
/* Creates a tree model containing the completions */
|
||||||
GtkTreeModel *
|
static GtkTreeModel *
|
||||||
create_completion_model (void)
|
create_completion_model (void)
|
||||||
{
|
{
|
||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
@ -192,7 +192,7 @@ activated_cb (GtkEntryCompletion *completion,
|
|||||||
|
|
||||||
static gint timer_count = 0;
|
static gint timer_count = 0;
|
||||||
|
|
||||||
static gchar *dynamic_completions[] = {
|
static const char *dynamic_completions[] = {
|
||||||
"GNOME",
|
"GNOME",
|
||||||
"gnominious",
|
"gnominious",
|
||||||
"Gnomonic projection",
|
"Gnomonic projection",
|
||||||
@ -269,7 +269,7 @@ animation_timer (GtkEntryCompletion *completion)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
match_selected_cb (GtkEntryCompletion *completion,
|
match_selected_cb (GtkEntryCompletion *completion,
|
||||||
GtkTreeModel *model,
|
GtkTreeModel *model,
|
||||||
GtkTreeIter *iter)
|
GtkTreeIter *iter)
|
||||||
@ -297,7 +297,7 @@ quit_cb (GtkWidget *widget,
|
|||||||
g_main_context_wakeup (NULL);
|
g_main_context_wakeup (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
|
@ -140,123 +140,6 @@ filter_changed (GtkFileChooserDialog *dialog,
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#define _(s) (s)
|
#define _(s) (s)
|
||||||
|
|
||||||
static void
|
|
||||||
size_prepared_cb (GdkPixbufLoader *loader,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
int *data)
|
|
||||||
{
|
|
||||||
int des_width = data[0];
|
|
||||||
int des_height = data[1];
|
|
||||||
|
|
||||||
if (des_height >= height && des_width >= width) {
|
|
||||||
/* Nothing */
|
|
||||||
} else if ((double)height * des_width > (double)width * des_height) {
|
|
||||||
width = 0.5 + (double)width * des_height / (double)height;
|
|
||||||
height = des_height;
|
|
||||||
} else {
|
|
||||||
height = 0.5 + (double)height * des_width / (double)width;
|
|
||||||
width = des_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
gdk_pixbuf_loader_set_size (loader, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
GdkPixbuf *
|
|
||||||
my_new_from_file_at_size (const char *filename,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
GdkPixbufLoader *loader;
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
int info[2];
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
guchar buffer [4096];
|
|
||||||
int length;
|
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
g_return_val_if_fail (filename != NULL, NULL);
|
|
||||||
g_return_val_if_fail (width > 0 && height > 0, NULL);
|
|
||||||
|
|
||||||
if (stat (filename, &st) != 0) {
|
|
||||||
int errsv = errno;
|
|
||||||
|
|
||||||
g_set_error (error,
|
|
||||||
G_FILE_ERROR,
|
|
||||||
g_file_error_from_errno (errsv),
|
|
||||||
_("Could not get information for file '%s': %s"),
|
|
||||||
filename, g_strerror (errsv));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!S_ISREG (st.st_mode))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
f = fopen (filename, "rb");
|
|
||||||
if (!f) {
|
|
||||||
int errsv = errno;
|
|
||||||
|
|
||||||
g_set_error (error,
|
|
||||||
G_FILE_ERROR,
|
|
||||||
g_file_error_from_errno (errsv),
|
|
||||||
_("Failed to open file '%s': %s"),
|
|
||||||
filename, g_strerror (errsv));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
loader = gdk_pixbuf_loader_new ();
|
|
||||||
#ifdef DONT_PRESERVE_ASPECT
|
|
||||||
gdk_pixbuf_loader_set_size (loader, width, height);
|
|
||||||
#else
|
|
||||||
info[0] = width;
|
|
||||||
info[1] = height;
|
|
||||||
g_signal_connect (loader, "size-prepared", G_CALLBACK (size_prepared_cb), info);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (!feof (f)) {
|
|
||||||
length = fread (buffer, 1, sizeof (buffer), f);
|
|
||||||
if (length > 0)
|
|
||||||
if (!gdk_pixbuf_loader_write (loader, buffer, length, error)) {
|
|
||||||
gdk_pixbuf_loader_close (loader, NULL);
|
|
||||||
fclose (f);
|
|
||||||
g_object_unref (loader);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose (f);
|
|
||||||
|
|
||||||
g_assert (*error == NULL);
|
|
||||||
if (!gdk_pixbuf_loader_close (loader, error)) {
|
|
||||||
g_object_unref (loader);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
|
||||||
|
|
||||||
if (!pixbuf) {
|
|
||||||
g_object_unref (loader);
|
|
||||||
|
|
||||||
/* did the loader set an error? */
|
|
||||||
if (*error != NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
g_set_error (error,
|
|
||||||
GDK_PIXBUF_ERROR,
|
|
||||||
GDK_PIXBUF_ERROR_FAILED,
|
|
||||||
_("Failed to load image '%s': reason not known, probably a corrupt image file"),
|
|
||||||
filename);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_ref (pixbuf);
|
|
||||||
|
|
||||||
g_object_unref (loader);
|
|
||||||
|
|
||||||
return pixbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_current_folder (GtkFileChooser *chooser,
|
set_current_folder (GtkFileChooser *chooser,
|
||||||
@ -487,6 +370,8 @@ main (int argc, char **argv)
|
|||||||
_("_Save"), GTK_RESPONSE_OK,
|
_("_Save"), GTK_RESPONSE_OK,
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
static gchar *backend = "gtk+";
|
static const char *backend = "gtk+";
|
||||||
static gboolean rtl = FALSE;
|
static gboolean rtl = FALSE;
|
||||||
static GOptionEntry entries[] = {
|
static GOptionEntry entries[] = {
|
||||||
{ "backend", 'b', 0, G_OPTION_ARG_STRING, &backend, "The filesystem backend to use.", "gtk+" },
|
{ "backend", 'b', 0, G_OPTION_ARG_STRING, &backend, "The filesystem backend to use.", "gtk+" },
|
||||||
|
@ -94,6 +94,8 @@ populate_flowbox_focus (GtkFlowBox *flowbox)
|
|||||||
widget = gtk_label_new ("bla");
|
widget = gtk_label_new ("bla");
|
||||||
sensitive = FALSE;
|
sensitive = FALSE;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (box), widget);
|
gtk_container_add (GTK_CONTAINER (box), widget);
|
||||||
|
@ -4,26 +4,34 @@ GtkWidget *label;
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
change_label_button ()
|
change_label_button (GSimpleAction *action,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gtk_label_set_label (GTK_LABEL (label), "Text set from button");
|
gtk_label_set_label (GTK_LABEL (label), "Text set from button");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
normal_menu_item ()
|
normal_menu_item (GSimpleAction *action,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gtk_label_set_label (GTK_LABEL (label), "Text set from normal menu item");
|
gtk_label_set_label (GTK_LABEL (label), "Text set from normal menu item");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
toggle_menu_item ()
|
toggle_menu_item (GSimpleAction *action,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
|
||||||
gtk_label_set_label (GTK_LABEL (label), "Text set from toggle menu item");
|
gtk_label_set_label (GTK_LABEL (label), "Text set from toggle menu item");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
submenu_item ()
|
submenu_item (GSimpleAction *action,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gtk_label_set_label (GTK_LABEL (label), "Text set from submenu item");
|
gtk_label_set_label (GTK_LABEL (label), "Text set from submenu item");
|
||||||
}
|
}
|
||||||
|
@ -349,17 +349,17 @@ create_action_treeview (GActionGroup *group)
|
|||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn *column;
|
||||||
GtkCellRenderer *cell;
|
GtkCellRenderer *cell;
|
||||||
gchar **actions;
|
gchar **group_actions;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||||
actions = g_action_group_list_actions (group);
|
group_actions = g_action_group_list_actions (group);
|
||||||
for (i = 0; actions[i]; i++)
|
for (i = 0; group_actions[i]; i++)
|
||||||
{
|
{
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter, 0, actions[i], -1);
|
gtk_list_store_set (store, &iter, 0, group_actions[i], -1);
|
||||||
}
|
}
|
||||||
g_strfreev (actions);
|
g_strfreev (group_actions);
|
||||||
g_object_set_data (G_OBJECT (store), "group", group);
|
g_object_set_data (G_OBJECT (store), "group", group);
|
||||||
|
|
||||||
tv = gtk_tree_view_new ();
|
tv = gtk_tree_view_new ();
|
||||||
|
104
tests/testgtk.c
104
tests/testgtk.c
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
static gboolean done = FALSE;
|
static gboolean done = FALSE;
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
file_exists (const char *filename)
|
file_exists (const char *filename)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
@ -60,7 +60,7 @@ file_exists (const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
build_option_menu (gchar *items[],
|
build_option_menu (const char *items[],
|
||||||
gint num_items,
|
gint num_items,
|
||||||
gint history,
|
gint history,
|
||||||
void (*func) (GtkWidget *widget, gpointer data),
|
void (*func) (GtkWidget *widget, gpointer data),
|
||||||
@ -91,7 +91,7 @@ typedef struct sTreeButtons {
|
|||||||
/* end of tree section */
|
/* end of tree section */
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
build_option_menu (gchar *items[],
|
build_option_menu (const char *items[],
|
||||||
gint num_items,
|
gint num_items,
|
||||||
gint history,
|
gint history,
|
||||||
void (*func)(GtkWidget *widget, gpointer data),
|
void (*func)(GtkWidget *widget, gpointer data),
|
||||||
@ -180,7 +180,7 @@ on_composited_changed (GdkDisplay *display,
|
|||||||
gtk_widget_queue_draw (GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (label))));
|
gtk_widget_queue_draw (GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (label))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_alpha_window (GtkWidget *widget)
|
create_alpha_window (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window;
|
static GtkWidget *window;
|
||||||
@ -599,8 +599,8 @@ create_radio_buttons (GtkWidget *widget)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static GtkWidget*
|
static GtkWidget*
|
||||||
new_pixbuf (char *filename,
|
new_pixbuf (const char *filename,
|
||||||
GdkSurface *window)
|
GdkSurface *window)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
@ -674,7 +674,7 @@ statusbar_popped (GtkStatusbar *statusbar,
|
|||||||
static void
|
static void
|
||||||
statusbar_contexts (GtkStatusbar *statusbar)
|
statusbar_contexts (GtkStatusbar *statusbar)
|
||||||
{
|
{
|
||||||
gchar *string;
|
const char *string;
|
||||||
|
|
||||||
string = "any context";
|
string = "any context";
|
||||||
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
|
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
|
||||||
@ -916,7 +916,7 @@ activate_link (GtkWidget *label, const gchar *uri, gpointer data)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_labels (GtkWidget *widget)
|
static void create_labels (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
@ -1132,7 +1132,7 @@ on_rotated_text_draw (GtkDrawingArea *drawing_area,
|
|||||||
n_words = G_N_ELEMENTS (words);
|
n_words = G_N_ELEMENTS (words);
|
||||||
for (i = 0; i < n_words; i++)
|
for (i = 0; i < n_words; i++)
|
||||||
{
|
{
|
||||||
int width, height;
|
int layout_width, layout_height;
|
||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
|
|
||||||
@ -1140,9 +1140,9 @@ on_rotated_text_draw (GtkDrawingArea *drawing_area,
|
|||||||
pango_cairo_update_layout (cr, layout);
|
pango_cairo_update_layout (cr, layout);
|
||||||
|
|
||||||
pango_layout_set_text (layout, words[i], -1);
|
pango_layout_set_text (layout, words[i], -1);
|
||||||
pango_layout_get_size (layout, &width, &height);
|
pango_layout_get_size (layout, &layout_width, &layout_height);
|
||||||
|
|
||||||
cairo_move_to (cr, - width / 2 / PANGO_SCALE, - DEFAULT_TEXT_RADIUS);
|
cairo_move_to (cr, - layout_width / 2 / PANGO_SCALE, - DEFAULT_TEXT_RADIUS);
|
||||||
pango_cairo_show_layout (cr, layout);
|
pango_cairo_show_layout (cr, layout);
|
||||||
|
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
@ -2509,7 +2509,7 @@ spin_button_month_input_func (GtkSpinButton *spin_button,
|
|||||||
gdouble *new_val)
|
gdouble *new_val)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
static gchar *month[12] = { "January", "February", "March", "April",
|
static const char *month[12] = { "January", "February", "March", "April",
|
||||||
"May", "June", "July", "August",
|
"May", "June", "July", "August",
|
||||||
"September", "October", "November", "December" };
|
"September", "October", "November", "December" };
|
||||||
gchar *tmp1, *tmp2;
|
gchar *tmp1, *tmp2;
|
||||||
@ -2541,7 +2541,7 @@ spin_button_month_output_func (GtkSpinButton *spin_button)
|
|||||||
GtkAdjustment *adjustment;
|
GtkAdjustment *adjustment;
|
||||||
gdouble value;
|
gdouble value;
|
||||||
gint i;
|
gint i;
|
||||||
static gchar *month[12] = { "January", "February", "March", "April",
|
static const char *month[12] = { "January", "February", "March", "April",
|
||||||
"May", "June", "July", "August", "September",
|
"May", "June", "July", "August", "September",
|
||||||
"October", "November", "December" };
|
"October", "November", "December" };
|
||||||
|
|
||||||
@ -3168,7 +3168,7 @@ create_cursors (GtkWidget *widget)
|
|||||||
* GtkColorSelection
|
* GtkColorSelection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_color_selection (GtkWidget *widget)
|
create_color_selection (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
@ -3206,7 +3206,7 @@ create_color_selection (GtkWidget *widget)
|
|||||||
gtk_widget_destroy (window);
|
gtk_widget_destroy (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
flipping_toggled_cb (GtkWidget *widget, gpointer data)
|
flipping_toggled_cb (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
int state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
|
int state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
|
||||||
@ -3243,7 +3243,7 @@ orientable_toggle_orientation (GtkOrientable *orientable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
flipping_orientation_toggled_cb (GtkWidget *widget, gpointer data)
|
flipping_orientation_toggled_cb (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *content_area;
|
GtkWidget *content_area;
|
||||||
@ -3285,7 +3285,7 @@ create_forward_back (const char *title,
|
|||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_flipping (GtkWidget *widget)
|
create_flipping (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
@ -3345,7 +3345,7 @@ create_flipping (GtkWidget *widget)
|
|||||||
* GtkFontSelection
|
* GtkFontSelection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_font_selection (GtkWidget *widget)
|
create_font_selection (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
@ -3530,13 +3530,13 @@ screen_display_check (GtkWidget *widget, ScreenDisplaySelection *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
screen_display_destroy_diag (GtkWidget *widget, GtkWidget *data)
|
screen_display_destroy_diag (GtkWidget *widget, GtkWidget *data)
|
||||||
{
|
{
|
||||||
gtk_widget_destroy (data);
|
gtk_widget_destroy (data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_display_screen (GtkWidget *widget)
|
create_display_screen (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkWidget *grid, *frame, *window, *combo_dpy, *vbox;
|
GtkWidget *grid, *frame, *window, *combo_dpy, *vbox;
|
||||||
@ -3966,6 +3966,8 @@ notebook_type_changed (GtkWidget *optionmenu,
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gtk_notebook_get_n_pages (notebook) == 15)
|
if (gtk_notebook_get_n_pages (notebook) == 15)
|
||||||
@ -3994,7 +3996,7 @@ create_notebook (GtkWidget *widget)
|
|||||||
GtkWidget *omenu;
|
GtkWidget *omenu;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
|
|
||||||
static gchar *items[] =
|
static const char *items[] =
|
||||||
{
|
{
|
||||||
"Standard",
|
"Standard",
|
||||||
"No tabs",
|
"No tabs",
|
||||||
@ -4103,7 +4105,7 @@ create_notebook (GtkWidget *widget)
|
|||||||
* GtkPanes
|
* GtkPanes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
static void
|
||||||
toggle_resize (GtkWidget *widget, GtkWidget *child)
|
toggle_resize (GtkWidget *widget, GtkWidget *child)
|
||||||
{
|
{
|
||||||
GtkPaned *paned = GTK_PANED (gtk_widget_get_parent (child));
|
GtkPaned *paned = GTK_PANED (gtk_widget_get_parent (child));
|
||||||
@ -4117,7 +4119,7 @@ toggle_resize (GtkWidget *widget, GtkWidget *child)
|
|||||||
g_object_set (paned, prop, !resize, NULL);
|
g_object_set (paned, prop, !resize, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
toggle_shrink (GtkWidget *widget, GtkWidget *child)
|
toggle_shrink (GtkWidget *widget, GtkWidget *child)
|
||||||
{
|
{
|
||||||
GtkPaned *paned = GTK_PANED (gtk_widget_get_parent (child));
|
GtkPaned *paned = GTK_PANED (gtk_widget_get_parent (child));
|
||||||
@ -4131,7 +4133,7 @@ toggle_shrink (GtkWidget *widget, GtkWidget *child)
|
|||||||
g_object_set (paned, prop, !resize, NULL);
|
g_object_set (paned, prop, !resize, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
static GtkWidget *
|
||||||
create_pane_options (GtkPaned *paned,
|
create_pane_options (GtkPaned *paned,
|
||||||
const gchar *frame_label,
|
const gchar *frame_label,
|
||||||
const gchar *label1,
|
const gchar *label1,
|
||||||
@ -4190,7 +4192,7 @@ create_pane_options (GtkPaned *paned,
|
|||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_panes (GtkWidget *widget)
|
create_panes (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
@ -4642,7 +4644,7 @@ create_paned_keyboard_navigation (GtkWidget *widget)
|
|||||||
* WM Hints demo
|
* WM Hints demo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_wmhints (GtkWidget *widget)
|
create_wmhints (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
@ -4828,7 +4830,7 @@ tracking_label (GtkWidget *window)
|
|||||||
return hbox;
|
return hbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
keep_window_above (GtkToggleButton *togglebutton, gpointer data)
|
keep_window_above (GtkToggleButton *togglebutton, gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *button = g_object_get_data (G_OBJECT (togglebutton), "radio");
|
GtkWidget *button = g_object_get_data (G_OBJECT (togglebutton), "radio");
|
||||||
@ -4840,7 +4842,7 @@ keep_window_above (GtkToggleButton *togglebutton, gpointer data)
|
|||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
keep_window_below (GtkToggleButton *togglebutton, gpointer data)
|
keep_window_below (GtkToggleButton *togglebutton, gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *button = g_object_get_data (G_OBJECT (togglebutton), "radio");
|
GtkWidget *button = g_object_get_data (G_OBJECT (togglebutton), "radio");
|
||||||
@ -4949,7 +4951,7 @@ get_state_controls (GtkWidget *window)
|
|||||||
return vbox;
|
return vbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_surface_states (GtkWidget *widget)
|
create_surface_states (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
@ -5240,7 +5242,7 @@ window_controls (GtkWidget *window)
|
|||||||
return control_window;
|
return control_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_window_sizing (GtkWidget *widget)
|
create_window_sizing (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
@ -5302,7 +5304,7 @@ typedef struct _ProgressData {
|
|||||||
gboolean activity;
|
gboolean activity;
|
||||||
} ProgressData;
|
} ProgressData;
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
progress_timeout (gpointer data)
|
progress_timeout (gpointer data)
|
||||||
{
|
{
|
||||||
ProgressData *pdata = data;
|
ProgressData *pdata = data;
|
||||||
@ -5421,7 +5423,7 @@ entry_changed (GtkWidget *widget, ProgressData *pdata)
|
|||||||
gtk_editable_get_text (GTK_EDITABLE (pdata->entry)));
|
gtk_editable_get_text (GTK_EDITABLE (pdata->entry)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_progress_bar (GtkWidget *widget)
|
create_progress_bar (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkWidget *content_area;
|
GtkWidget *content_area;
|
||||||
@ -5434,7 +5436,7 @@ create_progress_bar (GtkWidget *widget)
|
|||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
static ProgressData *pdata = NULL;
|
static ProgressData *pdata = NULL;
|
||||||
|
|
||||||
static gchar *items1[] =
|
static const char *items1[] =
|
||||||
{
|
{
|
||||||
"Left-Right",
|
"Left-Right",
|
||||||
"Right-Left",
|
"Right-Left",
|
||||||
@ -5442,7 +5444,7 @@ create_progress_bar (GtkWidget *widget)
|
|||||||
"Top-Bottom"
|
"Top-Bottom"
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *ellipsize_items[] = {
|
static const char *ellipsize_items[] = {
|
||||||
"None", // PANGO_ELLIPSIZE_NONE,
|
"None", // PANGO_ELLIPSIZE_NONE,
|
||||||
"Start", // PANGO_ELLIPSIZE_START,
|
"Start", // PANGO_ELLIPSIZE_START,
|
||||||
"Middle", // PANGO_ELLIPSIZE_MIDDLE,
|
"Middle", // PANGO_ELLIPSIZE_MIDDLE,
|
||||||
@ -5578,7 +5580,7 @@ create_progress_bar (GtkWidget *widget)
|
|||||||
|
|
||||||
static int timer = 0;
|
static int timer = 0;
|
||||||
|
|
||||||
gint
|
static int
|
||||||
timeout_test (GtkWidget *label)
|
timeout_test (GtkWidget *label)
|
||||||
{
|
{
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
@ -5590,7 +5592,7 @@ timeout_test (GtkWidget *label)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
start_timeout_test (GtkWidget *widget,
|
start_timeout_test (GtkWidget *widget,
|
||||||
GtkWidget *label)
|
GtkWidget *label)
|
||||||
{
|
{
|
||||||
@ -5600,7 +5602,7 @@ start_timeout_test (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
stop_timeout_test (GtkWidget *widget,
|
stop_timeout_test (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
@ -5611,7 +5613,7 @@ stop_timeout_test (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
destroy_timeout_test (GtkWidget *widget,
|
destroy_timeout_test (GtkWidget *widget,
|
||||||
GtkWidget **window)
|
GtkWidget **window)
|
||||||
{
|
{
|
||||||
@ -5620,7 +5622,7 @@ destroy_timeout_test (GtkWidget *widget,
|
|||||||
*window = NULL;
|
*window = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_timeout_test (GtkWidget *widget)
|
create_timeout_test (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
@ -5912,6 +5914,8 @@ native_filter_changed (GtkWidget *combo,
|
|||||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (native), filter);
|
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (native), filter);
|
||||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (native), filter);
|
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (native), filter);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5922,7 +5926,7 @@ destroy_native (GtkFileChooserNative *native)
|
|||||||
g_object_unref (native);
|
g_object_unref (native);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_native_dialogs (GtkWidget *widget)
|
create_native_dialogs (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
@ -6028,7 +6032,7 @@ create_native_dialogs (GtkWidget *widget)
|
|||||||
* Main Window and Exit
|
* Main Window and Exit
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
static void
|
||||||
do_exit (GtkWidget *widget, GtkWidget *window)
|
do_exit (GtkWidget *widget, GtkWidget *window)
|
||||||
{
|
{
|
||||||
gtk_widget_destroy (window);
|
gtk_widget_destroy (window);
|
||||||
@ -6037,7 +6041,7 @@ do_exit (GtkWidget *widget, GtkWidget *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
char *label;
|
const char *label;
|
||||||
void (*func) (GtkWidget *widget);
|
void (*func) (GtkWidget *widget);
|
||||||
gboolean do_not_benchmark;
|
gboolean do_not_benchmark;
|
||||||
} buttons[] =
|
} buttons[] =
|
||||||
@ -6083,16 +6087,16 @@ int nbuttons = sizeof (buttons) / sizeof (buttons[0]);
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
quit_cb (GtkWidget *widget,
|
quit_cb (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gboolean *done = data;
|
gboolean *is_done = user_data;
|
||||||
|
|
||||||
*done = TRUE;
|
*is_done = TRUE;
|
||||||
|
|
||||||
g_main_context_wakeup (NULL);
|
g_main_context_wakeup (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
create_main_window (void)
|
create_main_window (void)
|
||||||
{
|
{
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
@ -6203,8 +6207,8 @@ bench_iteration (GtkWidget *widget, void (* fn) (GtkWidget *widget))
|
|||||||
while (g_main_context_iteration (NULL, FALSE));
|
while (g_main_context_iteration (NULL, FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
do_real_bench (GtkWidget *widget, void (* fn) (GtkWidget *widget), char *name, int num)
|
do_real_bench (GtkWidget *widget, void (* fn) (GtkWidget *widget), const char *name, int num)
|
||||||
{
|
{
|
||||||
GTimeVal tv0, tv1;
|
GTimeVal tv0, tv1;
|
||||||
double dt_first;
|
double dt_first;
|
||||||
@ -6239,7 +6243,7 @@ do_real_bench (GtkWidget *widget, void (* fn) (GtkWidget *widget), char *name, i
|
|||||||
g_print ("%10.1f\n", dt_first);
|
g_print ("%10.1f\n", dt_first);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
do_bench (char* what, int num)
|
do_bench (char* what, int num)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -6276,7 +6280,7 @@ do_bench (char* what, int num)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
usage (void)
|
usage (void)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Usage: testgtk [--bench ALL|<bench>[:<count>]]\n");
|
fprintf (stderr, "Usage: testgtk [--bench ALL|<bench>[:<count>]]\n");
|
||||||
|
@ -74,11 +74,11 @@ static gboolean done = FALSE;
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
quit_cb (GtkWidget *widget,
|
quit_cb (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gboolean *done = data;
|
gboolean *is_done = user_data;
|
||||||
|
|
||||||
*done = TRUE;
|
*is_done = TRUE;
|
||||||
|
|
||||||
g_main_context_wakeup (NULL);
|
g_main_context_wakeup (NULL);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ int
|
|||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GtkIconTheme *icon_theme;
|
GtkIconTheme *icon_theme;
|
||||||
GtkIconPaintable *icon;
|
|
||||||
char *themename;
|
char *themename;
|
||||||
int size = 48;
|
int size = 48;
|
||||||
int scale = 1;
|
int scale = 1;
|
||||||
@ -127,6 +126,7 @@ main (int argc, char *argv[])
|
|||||||
else if (strcmp (argv[1], "lookup") == 0)
|
else if (strcmp (argv[1], "lookup") == 0)
|
||||||
{
|
{
|
||||||
GFile *file;
|
GFile *file;
|
||||||
|
GtkIconPaintable *icon;
|
||||||
|
|
||||||
if (argc < 4)
|
if (argc < 4)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ visible_func (GtkTreeModel *model,
|
|||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkTreeModel *
|
static GtkTreeModel *
|
||||||
get_filter_model (gboolean first)
|
get_filter_model (gboolean first)
|
||||||
{
|
{
|
||||||
GtkTreeModelFilter *model;
|
GtkTreeModelFilter *model;
|
||||||
|
@ -10,11 +10,11 @@ static gboolean done = FALSE;
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
quit_cb (GtkWidget *widget,
|
quit_cb (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gboolean *done = data;
|
gboolean *is_done = user_data;
|
||||||
|
|
||||||
*done = TRUE;
|
*is_done = TRUE;
|
||||||
|
|
||||||
g_main_context_wakeup (NULL);
|
g_main_context_wakeup (NULL);
|
||||||
}
|
}
|
||||||
@ -56,16 +56,16 @@ kinetic_scrolling (void)
|
|||||||
button_grid = gtk_grid_new ();
|
button_grid = gtk_grid_new ();
|
||||||
for (i = 0; i < 80; i++)
|
for (i = 0; i < 80; i++)
|
||||||
{
|
{
|
||||||
gchar *label = g_strdup_printf ("Button number %d", i);
|
char *button_label = g_strdup_printf ("Button number %d", i);
|
||||||
|
|
||||||
button = gtk_button_new_with_label (label);
|
button = gtk_button_new_with_label (button_label);
|
||||||
gtk_grid_attach (GTK_GRID (button_grid), button, 0, i, 1, 1);
|
gtk_grid_attach (GTK_GRID (button_grid), button, 0, i, 1, 1);
|
||||||
gtk_widget_set_hexpand (button, TRUE);
|
gtk_widget_set_hexpand (button, TRUE);
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
g_signal_connect (button, "clicked",
|
g_signal_connect (button, "clicked",
|
||||||
G_CALLBACK (on_button_clicked),
|
G_CALLBACK (on_button_clicked),
|
||||||
GINT_TO_POINTER (i));
|
GINT_TO_POINTER (i));
|
||||||
g_free (label);
|
g_free (button_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
swindow = gtk_scrolled_window_new (NULL, NULL);
|
swindow = gtk_scrolled_window_new (NULL, NULL);
|
||||||
@ -99,10 +99,10 @@ kinetic_scrolling (void)
|
|||||||
for (i = 0; i < 80; i++)
|
for (i = 0; i < 80; i++)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
gchar *label = g_strdup_printf ("Row number %d", i);
|
gchar *iter_label = g_strdup_printf ("Row number %d", i);
|
||||||
|
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter, 0, label, -1);
|
gtk_list_store_set (store, &iter, 0, iter_label, -1);
|
||||||
g_free (label);
|
g_free (label);
|
||||||
}
|
}
|
||||||
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store));
|
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store));
|
||||||
|
@ -30,6 +30,7 @@ const char *css =
|
|||||||
"background-color: red;"
|
"background-color: red;"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
|
static GType row_get_type (void);
|
||||||
G_DEFINE_TYPE (Row, row, GTK_TYPE_LIST_BOX_ROW)
|
G_DEFINE_TYPE (Row, row, GTK_TYPE_LIST_BOX_ROW)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -42,7 +43,7 @@ row_class_init (RowClass *class)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
static GtkWidget *
|
||||||
row_new (const gchar* text, gint sort_id) {
|
row_new (const gchar* text, gint sort_id) {
|
||||||
Row *row;
|
Row *row;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef GtkApplicationClass TestAppClass;
|
typedef GtkApplicationClass TestAppClass;
|
||||||
|
|
||||||
|
static GType test_app_get_type (void);
|
||||||
G_DEFINE_TYPE (TestApp, test_app, GTK_TYPE_APPLICATION)
|
G_DEFINE_TYPE (TestApp, test_app, GTK_TYPE_APPLICATION)
|
||||||
|
|
||||||
static GtkWidget *create_row (const gchar *label);
|
static GtkWidget *create_row (const gchar *label);
|
||||||
@ -193,7 +194,7 @@ test_app_class_init (TestAppClass *class)
|
|||||||
G_APPLICATION_CLASS (class)->activate = test_app_activate;
|
G_APPLICATION_CLASS (class)->activate = test_app_activate;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestApp *
|
static TestApp *
|
||||||
test_app_new (void)
|
test_app_new (void)
|
||||||
{
|
{
|
||||||
TestApp *test_app;
|
TestApp *test_app;
|
||||||
|
@ -43,6 +43,7 @@ struct _GTestPermissionClass
|
|||||||
GPermissionClass parent_class;
|
GPermissionClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static GType g_test_permission_get_type (void);
|
||||||
G_DEFINE_TYPE (GTestPermission, g_test_permission, G_TYPE_PERMISSION)
|
G_DEFINE_TYPE (GTestPermission, g_test_permission, G_TYPE_PERMISSION)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -101,7 +102,7 @@ acquire_async (GPermission *permission,
|
|||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
acquire_finish (GPermission *permission,
|
acquire_finish (GPermission *permission,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error)
|
GError **error)
|
||||||
@ -135,7 +136,7 @@ release_async (GPermission *permission,
|
|||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
release_finish (GPermission *permission,
|
release_finish (GPermission *permission,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error)
|
GError **error)
|
||||||
@ -158,7 +159,7 @@ g_test_permission_class_init (GTestPermissionClass *class)
|
|||||||
permission_class->release_finish = release_finish;
|
permission_class->release_finish = release_finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
g_test_permission_set_success (GTestPermission *permission,
|
g_test_permission_set_success (GTestPermission *permission,
|
||||||
gboolean success)
|
gboolean success)
|
||||||
{
|
{
|
||||||
|
@ -108,15 +108,15 @@ int main (int argc, char **argv)
|
|||||||
/* Button with GMenuModel */
|
/* Button with GMenuModel */
|
||||||
menu = g_menu_new ();
|
menu = g_menu_new ();
|
||||||
for (i = 5; i > 0; i--) {
|
for (i = 5; i > 0; i--) {
|
||||||
char *label;
|
char *item_label;
|
||||||
GMenuItem *item;
|
GMenuItem *item;
|
||||||
label = g_strdup_printf ("Item _%d", i);
|
item_label = g_strdup_printf ("Item _%d", i);
|
||||||
item = g_menu_item_new (label, NULL);
|
item = g_menu_item_new (item_label, NULL);
|
||||||
if (i == 3)
|
if (i == 3)
|
||||||
g_menu_item_set_attribute (item, "icon", "s", "preferences-desktop-locale-symbolic");
|
g_menu_item_set_attribute (item, "icon", "s", "preferences-desktop-locale-symbolic");
|
||||||
g_menu_insert_item (menu, 0, item);
|
g_menu_insert_item (menu, 0, item);
|
||||||
g_object_unref (item);
|
g_object_unref (item);
|
||||||
g_free (label);
|
g_free (item_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
button = gtk_menu_button_new ();
|
button = gtk_menu_button_new ();
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
*/
|
*/
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
static gpointer GROUP_A = "GROUP_A";
|
static gconstpointer GROUP_A = "GROUP_A";
|
||||||
static gpointer GROUP_B = "GROUP_B";
|
static gconstpointer GROUP_B = "GROUP_B";
|
||||||
|
|
||||||
gchar *tabs1 [] = {
|
const char *tabs1 [] = {
|
||||||
"aaaaaaaaaa",
|
"aaaaaaaaaa",
|
||||||
"bbbbbbbbbb",
|
"bbbbbbbbbb",
|
||||||
"cccccccccc",
|
"cccccccccc",
|
||||||
@ -31,7 +31,7 @@ gchar *tabs1 [] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
gchar *tabs2 [] = {
|
const char *tabs2 [] = {
|
||||||
"1",
|
"1",
|
||||||
"2",
|
"2",
|
||||||
"3",
|
"3",
|
||||||
@ -40,13 +40,13 @@ gchar *tabs2 [] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
gchar *tabs3 [] = {
|
const char *tabs3 [] = {
|
||||||
"foo",
|
"foo",
|
||||||
"bar",
|
"bar",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
gchar *tabs4 [] = {
|
const char *tabs4 [] = {
|
||||||
"beer",
|
"beer",
|
||||||
"water",
|
"water",
|
||||||
"lemonade",
|
"lemonade",
|
||||||
@ -133,8 +133,8 @@ action_clicked_cb (GtkWidget *button,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget*
|
static GtkWidget*
|
||||||
create_notebook (gchar **labels,
|
create_notebook (const char **labels,
|
||||||
const gchar *group,
|
const char *group,
|
||||||
GtkPositionType pos)
|
GtkPositionType pos)
|
||||||
{
|
{
|
||||||
GtkWidget *notebook, *title, *page, *action_widget;
|
GtkWidget *notebook, *title, *page, *action_widget;
|
||||||
@ -174,7 +174,7 @@ create_notebook (gchar **labels,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget*
|
static GtkWidget*
|
||||||
create_notebook_non_dragable_content (gchar **labels,
|
create_notebook_non_dragable_content (const char **labels,
|
||||||
const gchar *group,
|
const gchar *group,
|
||||||
GtkPositionType pos)
|
GtkPositionType pos)
|
||||||
{
|
{
|
||||||
@ -225,7 +225,7 @@ create_notebook_non_dragable_content (gchar **labels,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget*
|
static GtkWidget*
|
||||||
create_notebook_with_notebooks (gchar **labels,
|
create_notebook_with_notebooks (const char **labels,
|
||||||
const gchar *group,
|
const gchar *group,
|
||||||
GtkPositionType pos)
|
GtkPositionType pos)
|
||||||
{
|
{
|
||||||
|
@ -364,7 +364,7 @@ test_chase (void)
|
|||||||
GtkWidget *sw;
|
GtkWidget *sw;
|
||||||
GtkWidget *text;
|
GtkWidget *text;
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
GtkTextBuffer *buffer;
|
GtkTextBuffer *text_buffer;
|
||||||
gchar *contents;
|
gchar *contents;
|
||||||
gsize len;
|
gsize len;
|
||||||
GtkEventController *controller;
|
GtkEventController *controller;
|
||||||
@ -381,15 +381,15 @@ test_chase (void)
|
|||||||
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
||||||
|
|
||||||
text = gtk_text_view_new ();
|
text = gtk_text_view_new ();
|
||||||
buffer = gtk_text_buffer_new (NULL);
|
text_buffer = gtk_text_buffer_new (NULL);
|
||||||
if (!g_file_get_contents ("testoverlay.c", &contents, &len, NULL))
|
if (!g_file_get_contents ("testoverlay.c", &contents, &len, NULL))
|
||||||
{
|
{
|
||||||
contents = g_strdup ("Text should go here...");
|
contents = g_strdup ("Text should go here...");
|
||||||
len = strlen (contents);
|
len = strlen (contents);
|
||||||
}
|
}
|
||||||
gtk_text_buffer_set_text (buffer, contents, len);
|
gtk_text_buffer_set_text (text_buffer, contents, len);
|
||||||
g_free (contents);
|
g_free (contents);
|
||||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text), buffer);
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text), text_buffer);
|
||||||
|
|
||||||
gtk_widget_set_hexpand (text, TRUE);
|
gtk_widget_set_hexpand (text, TRUE);
|
||||||
gtk_widget_set_vexpand (text, TRUE);
|
gtk_widget_set_vexpand (text, TRUE);
|
||||||
|
@ -9,7 +9,7 @@ int overall_alpha = 255;
|
|||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GtkWidget *darea;
|
GtkWidget *darea;
|
||||||
|
|
||||||
void
|
static void
|
||||||
set_interp_type (GtkWidget *widget, gpointer data)
|
set_interp_type (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
guint types[] = { GDK_INTERP_NEAREST,
|
guint types[] = { GDK_INTERP_NEAREST,
|
||||||
@ -21,7 +21,7 @@ set_interp_type (GtkWidget *widget, gpointer data)
|
|||||||
gtk_widget_queue_draw (darea);
|
gtk_widget_queue_draw (darea);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
overall_changed_cb (GtkAdjustment *adjustment, gpointer data)
|
overall_changed_cb (GtkAdjustment *adjustment, gpointer data)
|
||||||
{
|
{
|
||||||
if (gtk_adjustment_get_value (adjustment) != overall_alpha)
|
if (gtk_adjustment_get_value (adjustment) != overall_alpha)
|
||||||
@ -32,7 +32,7 @@ overall_changed_cb (GtkAdjustment *adjustment, gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
draw_func (GtkDrawingArea *darea,
|
draw_func (GtkDrawingArea *area,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
|
@ -12,6 +12,7 @@ typedef struct {
|
|||||||
GtkListBoxRowClass parent_class;
|
GtkListBoxRowClass parent_class;
|
||||||
} SelectableRowClass;
|
} SelectableRowClass;
|
||||||
|
|
||||||
|
static GType selectable_row_get_type (void);
|
||||||
G_DEFINE_TYPE (SelectableRow, selectable_row, GTK_TYPE_LIST_BOX_ROW)
|
G_DEFINE_TYPE (SelectableRow, selectable_row, GTK_TYPE_LIST_BOX_ROW)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -34,7 +35,7 @@ selectable_row_init (SelectableRow *row)
|
|||||||
gtk_container_add (GTK_CONTAINER (row->revealer), row->check);
|
gtk_container_add (GTK_CONTAINER (row->revealer), row->check);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
selectable_row_add (SelectableRow *row, GtkWidget *child)
|
selectable_row_add (SelectableRow *row, GtkWidget *child)
|
||||||
{
|
{
|
||||||
gtk_container_add (GTK_CONTAINER (row->box), child);
|
gtk_container_add (GTK_CONTAINER (row->box), child);
|
||||||
@ -73,7 +74,7 @@ selectable_row_class_init (SelectableRowClass *class)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
static GtkWidget *
|
||||||
selectable_row_new (void)
|
selectable_row_new (void)
|
||||||
{
|
{
|
||||||
return GTK_WIDGET (g_object_new (selectable_row_get_type (), NULL));
|
return GTK_WIDGET (g_object_new (selectable_row_get_type (), NULL));
|
||||||
|
@ -49,58 +49,58 @@ toggle_transitions (GtkWidget *combo, gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_back_button_clicked (GtkButton *button, GtkStack *stack)
|
on_back_button_clicked (GtkButton *button, gpointer user_data)
|
||||||
{
|
{
|
||||||
const gchar *seq[] = { "1", "2", "3" };
|
const gchar *seq[] = { "1", "2", "3" };
|
||||||
const gchar *vis;
|
const gchar *vis;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
vis = gtk_stack_get_visible_child_name (stack);
|
vis = gtk_stack_get_visible_child_name (GTK_STACK (stack));
|
||||||
|
|
||||||
for (i = 1; i < G_N_ELEMENTS (seq); i++)
|
for (i = 1; i < G_N_ELEMENTS (seq); i++)
|
||||||
{
|
{
|
||||||
if (g_strcmp0 (vis, seq[i]) == 0)
|
if (g_strcmp0 (vis, seq[i]) == 0)
|
||||||
{
|
{
|
||||||
gtk_stack_set_visible_child_full (stack, seq[i - 1], GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT);
|
gtk_stack_set_visible_child_full (GTK_STACK (stack), seq[i - 1], GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_forward_button_clicked (GtkButton *button, GtkStack *stack)
|
on_forward_button_clicked (GtkButton *button, gpointer user_data)
|
||||||
{
|
{
|
||||||
const gchar *seq[] = { "1", "2", "3" };
|
const gchar *seq[] = { "1", "2", "3" };
|
||||||
const gchar *vis;
|
const gchar *vis;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
vis = gtk_stack_get_visible_child_name (stack);
|
vis = gtk_stack_get_visible_child_name (GTK_STACK (stack));
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (seq) - 1; i++)
|
for (i = 0; i < G_N_ELEMENTS (seq) - 1; i++)
|
||||||
{
|
{
|
||||||
if (g_strcmp0 (vis, seq[i]) == 0)
|
if (g_strcmp0 (vis, seq[i]) == 0)
|
||||||
{
|
{
|
||||||
gtk_stack_set_visible_child_full (stack, seq[i + 1], GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT);
|
gtk_stack_set_visible_child_full (GTK_STACK (stack), seq[i + 1], GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_back_button_sensitivity (GtkStack *stack, GParamSpec *pspec, GtkWidget *button)
|
update_back_button_sensitivity (GtkStack *_stack, GParamSpec *pspec, GtkWidget *button)
|
||||||
{
|
{
|
||||||
const gchar *vis;
|
const gchar *vis;
|
||||||
|
|
||||||
vis = gtk_stack_get_visible_child_name (stack);
|
vis = gtk_stack_get_visible_child_name (GTK_STACK (stack));
|
||||||
gtk_widget_set_sensitive (button, g_strcmp0 (vis, "1") != 0);
|
gtk_widget_set_sensitive (button, g_strcmp0 (vis, "1") != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_forward_button_sensitivity (GtkStack *stack, GParamSpec *pspec, GtkWidget *button)
|
update_forward_button_sensitivity (GtkStack *_stack, GParamSpec *pspec, GtkWidget *button)
|
||||||
{
|
{
|
||||||
const gchar *vis;
|
const gchar *vis;
|
||||||
|
|
||||||
vis = gtk_stack_get_visible_child_name (stack);
|
vis = gtk_stack_get_visible_child_name (GTK_STACK (stack));
|
||||||
gtk_widget_set_sensitive (button, g_strcmp0 (vis, "3") != 0);
|
gtk_widget_set_sensitive (button, g_strcmp0 (vis, "3") != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,19 +4,21 @@
|
|||||||
static GtkWidget *header_stack;
|
static GtkWidget *header_stack;
|
||||||
static GtkWidget *page_stack;
|
static GtkWidget *page_stack;
|
||||||
|
|
||||||
void
|
#if 0
|
||||||
|
static void
|
||||||
back_to_main (GtkButton *button)
|
back_to_main (GtkButton *button)
|
||||||
{
|
{
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (header_stack), "main");
|
gtk_stack_set_visible_child_name (GTK_STACK (header_stack), "main");
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (page_stack), "page1");
|
gtk_stack_set_visible_child_name (GTK_STACK (page_stack), "page1");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
go_to_secondary (GtkButton *button)
|
go_to_secondary (GtkButton *button)
|
||||||
{
|
{
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (header_stack), "secondary");
|
gtk_stack_set_visible_child_name (GTK_STACK (header_stack), "secondary");
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (page_stack), "secondary");
|
gtk_stack_set_visible_child_name (GTK_STACK (page_stack), "secondary");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
@ -37,6 +39,8 @@ main (int argc, char *argv[])
|
|||||||
header_stack = (GtkWidget *)gtk_builder_get_object (builder, "header_stack");
|
header_stack = (GtkWidget *)gtk_builder_get_object (builder, "header_stack");
|
||||||
page_stack = (GtkWidget *)gtk_builder_get_object (builder, "page_stack");
|
page_stack = (GtkWidget *)gtk_builder_get_object (builder, "page_stack");
|
||||||
|
|
||||||
|
g_assert (header_stack);
|
||||||
|
|
||||||
gtk_window_present (GTK_WINDOW (win));
|
gtk_window_present (GTK_WINDOW (win));
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<signal name="clicked" handler="go_to_secondary"/>
|
<signal name="clicked" handler="go_to_secondary"/>
|
||||||
</object>
|
</object>
|
||||||
<packing/>
|
|
||||||
</child>
|
</child>
|
||||||
<child type="title">
|
<child type="title">
|
||||||
<object class="GtkStackSwitcher">
|
<object class="GtkStackSwitcher">
|
||||||
@ -38,7 +37,6 @@
|
|||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<signal name="clicked" handler="back_to_main"/>
|
<signal name="clicked" handler="back_to_main"/>
|
||||||
</object>
|
</object>
|
||||||
<packing/>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
|
@ -11,6 +11,7 @@ typedef struct {
|
|||||||
GtkTextViewClass parent_class;
|
GtkTextViewClass parent_class;
|
||||||
} MyTextViewClass;
|
} MyTextViewClass;
|
||||||
|
|
||||||
|
static GType my_text_view_get_type (void);
|
||||||
G_DEFINE_TYPE (MyTextView, my_text_view, GTK_TYPE_TEXT_VIEW);
|
G_DEFINE_TYPE (MyTextView, my_text_view, GTK_TYPE_TEXT_VIEW);
|
||||||
|
|
||||||
static void snapshot_background (GtkWidget *widget, GtkSnapshot *snapshot);
|
static void snapshot_background (GtkWidget *widget, GtkSnapshot *snapshot);
|
||||||
|
@ -37,6 +37,7 @@ struct _MyTooltipClass
|
|||||||
GtkBinClass parent_class;
|
GtkBinClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static GType my_tooltip_get_type (void);
|
||||||
G_DEFINE_TYPE (MyTooltip, my_tooltip, GTK_TYPE_BIN)
|
G_DEFINE_TYPE (MyTooltip, my_tooltip, GTK_TYPE_BIN)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -76,6 +76,19 @@ struct _ViewColumnModelClass
|
|||||||
GtkListStoreClass parent_class;
|
GtkListStoreClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void view_column_model_tree_model_init (GtkTreeModelIface *iface);
|
||||||
|
static void view_column_model_drag_source_init (GtkTreeDragSourceIface *iface);
|
||||||
|
static void view_column_model_drag_dest_init (GtkTreeDragDestIface *iface);
|
||||||
|
|
||||||
|
|
||||||
|
static GType view_column_model_get_type (void);
|
||||||
|
G_DEFINE_TYPE_WITH_CODE (ViewColumnModel, view_column_model, GTK_TYPE_LIST_STORE,
|
||||||
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, view_column_model_tree_model_init)
|
||||||
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE, view_column_model_drag_source_init)
|
||||||
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_DEST, view_column_model_drag_dest_init))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void view_column_model_init (ViewColumnModel *model)
|
static void view_column_model_init (ViewColumnModel *model)
|
||||||
{
|
{
|
||||||
model->stamp = g_random_int ();
|
model->stamp = g_random_int ();
|
||||||
@ -368,11 +381,6 @@ view_column_model_class_init (ViewColumnModelClass *klass)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (ViewColumnModel, view_column_model, GTK_TYPE_LIST_STORE,
|
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, view_column_model_tree_model_init)
|
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE, view_column_model_drag_source_init)
|
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_DEST, view_column_model_drag_dest_init))
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_columns (GtkTreeView *view, ViewColumnModel *view_model)
|
update_columns (GtkTreeView *view, ViewColumnModel *view_model)
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ typedef GtkListStoreClass MyModelClass;
|
|||||||
|
|
||||||
static void my_model_drag_source_init (GtkTreeDragSourceIface *iface);
|
static void my_model_drag_source_init (GtkTreeDragSourceIface *iface);
|
||||||
|
|
||||||
|
static GType my_model_get_type (void);
|
||||||
G_DEFINE_TYPE_WITH_CODE (MyModel, my_model, GTK_TYPE_LIST_STORE,
|
G_DEFINE_TYPE_WITH_CODE (MyModel, my_model, GTK_TYPE_LIST_STORE,
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE,
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE,
|
||||||
my_model_drag_source_init))
|
my_model_drag_source_init))
|
||||||
|
@ -204,6 +204,8 @@ create_control (GtkWidget *box, gint number, gint cntl, CallbackData *data)
|
|||||||
name = g_strdup_printf ("Fix size Cell #%d", number);
|
name = g_strdup_printf ("Fix size Cell #%d", number);
|
||||||
callback = G_CALLBACK (fixed_cell_toggled);
|
callback = G_CALLBACK (fixed_cell_toggled);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
checkbutton = gtk_check_button_new_with_label (name);
|
checkbutton = gtk_check_button_new_with_label (name);
|
||||||
|
@ -28,7 +28,7 @@ enum
|
|||||||
NUM_COLUMNS
|
NUM_COLUMNS
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *words[] =
|
static const char *words[] =
|
||||||
{
|
{
|
||||||
"Boom",
|
"Boom",
|
||||||
"Borp",
|
"Borp",
|
||||||
@ -102,6 +102,8 @@ futz_row (void)
|
|||||||
TEXT_COLUMN, words[g_rand_int_range (grand, 0, NUM_WORDS)],
|
TEXT_COLUMN, words[g_rand_int_range (grand, 0, NUM_WORDS)],
|
||||||
-1);
|
-1);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,16 +61,16 @@ start_enumerate (GListStore *store)
|
|||||||
static void
|
static void
|
||||||
got_files (GObject *enumerate,
|
got_files (GObject *enumerate,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
gpointer store)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GList *l, *files;
|
GList *l, *files;
|
||||||
GFile *file = g_object_get_data (store, "file");
|
GFile *file = g_object_get_data (user_data, "file");
|
||||||
GPtrArray *array;
|
GPtrArray *array;
|
||||||
|
|
||||||
files = g_file_enumerator_next_files_finish (G_FILE_ENUMERATOR (enumerate), res, NULL);
|
files = g_file_enumerator_next_files_finish (G_FILE_ENUMERATOR (enumerate), res, NULL);
|
||||||
if (files == NULL)
|
if (files == NULL)
|
||||||
{
|
{
|
||||||
g_object_unref (store);
|
g_object_unref (user_data);
|
||||||
if (pending)
|
if (pending)
|
||||||
{
|
{
|
||||||
GListStore *store = pending->data;
|
GListStore *store = pending->data;
|
||||||
@ -94,7 +94,7 @@ got_files (GObject *enumerate,
|
|||||||
}
|
}
|
||||||
g_list_free (files);
|
g_list_free (files);
|
||||||
|
|
||||||
g_list_store_splice (store, g_list_model_get_n_items (store), 0, array->pdata, array->len);
|
g_list_store_splice (user_data, g_list_model_get_n_items (user_data), 0, array->pdata, array->len);
|
||||||
g_ptr_array_unref (array);
|
g_ptr_array_unref (array);
|
||||||
|
|
||||||
g_file_enumerator_next_files_async (G_FILE_ENUMERATOR (enumerate),
|
g_file_enumerator_next_files_async (G_FILE_ENUMERATOR (enumerate),
|
||||||
@ -102,7 +102,7 @@ got_files (GObject *enumerate,
|
|||||||
G_PRIORITY_DEFAULT_IDLE,
|
G_PRIORITY_DEFAULT_IDLE,
|
||||||
NULL,
|
NULL,
|
||||||
got_files,
|
got_files,
|
||||||
store);
|
user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user