forked from AuroraMiddleware/gtk
demos/gtk-demo: Add common_cflags to build
With a few exceptions.
This commit is contained in:
parent
049f841900
commit
dc36c21835
@ -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,10 +978,10 @@ 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", (char **)ids, NULL);
|
||||||
|
|
||||||
appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu");
|
appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu");
|
||||||
|
|
||||||
|
@ -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 *
|
||||||
|
Loading…
Reference in New Issue
Block a user