mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 09:40:10 +00:00
tests: Add common_cflags to build
And fix all the errors and warnings resulting from that See #2491
This commit is contained in:
parent
0e8850bf84
commit
d1cd6aacba
@ -130,7 +130,7 @@ on_frame_clock_after_paint (GdkFrameClock *frame_clock,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
on_window_realize (GtkWidget *window,
|
||||
FrameStats *frame_stats)
|
||||
{
|
||||
@ -139,7 +139,7 @@ on_window_realize (GtkWidget *window,
|
||||
G_CALLBACK (on_frame_clock_after_paint), frame_stats);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
on_window_unrealize (GtkWidget *window,
|
||||
FrameStats *frame_stats)
|
||||
{
|
||||
@ -149,7 +149,7 @@ on_window_unrealize (GtkWidget *window,
|
||||
frame_stats->frame_clock = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
on_window_destroy (GtkWidget *window,
|
||||
FrameStats *stats)
|
||||
{
|
||||
|
@ -511,7 +511,7 @@ invert(GLfloat *m)
|
||||
* @param zNear the near 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];
|
||||
double sine, cosine, cotangent, deltaZ;
|
||||
|
@ -22,6 +22,7 @@ typedef struct
|
||||
GObjectClass parent_class;
|
||||
} MyObjectClass;
|
||||
|
||||
static GType my_object_get_type (void);
|
||||
G_DEFINE_TYPE (MyObject, my_object, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
|
@ -145,7 +145,7 @@ foreach t: gtk_tests
|
||||
test_srcs = ['@0@.c'.format(test_name), t.get(1, [])]
|
||||
executable(test_name, test_srcs,
|
||||
include_directories: [confinc, gdkinc],
|
||||
c_args: test_args,
|
||||
c_args: test_args + common_cflags,
|
||||
dependencies: [libgtk_dep, libm])
|
||||
endforeach
|
||||
|
||||
|
@ -682,14 +682,14 @@ static const gchar ui_info[] =
|
||||
"</interface>";
|
||||
|
||||
static void
|
||||
buffer_changed_callback (GtkTextBuffer *buffer)
|
||||
buffer_changed_callback (GtkTextBuffer *text_buffer)
|
||||
{
|
||||
file_changed = TRUE;
|
||||
update_statusbar ();
|
||||
}
|
||||
|
||||
static void
|
||||
mark_set_callback (GtkTextBuffer *buffer,
|
||||
mark_set_callback (GtkTextBuffer *text_buffer,
|
||||
const GtkTextIter *new_location,
|
||||
GtkTextMark *mark,
|
||||
gpointer data)
|
||||
|
@ -78,7 +78,7 @@ hsv_to_rgb (GdkRGBA *rgba,
|
||||
}
|
||||
}
|
||||
|
||||
GskRenderNode *
|
||||
static GskRenderNode *
|
||||
rounded_borders (guint n)
|
||||
{
|
||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||
@ -112,7 +112,7 @@ rounded_borders (guint n)
|
||||
return container;
|
||||
}
|
||||
|
||||
GskRenderNode *
|
||||
static GskRenderNode *
|
||||
rounded_backgrounds (guint n)
|
||||
{
|
||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||
@ -145,7 +145,7 @@ rounded_backgrounds (guint n)
|
||||
return container;
|
||||
}
|
||||
|
||||
GskRenderNode *
|
||||
static GskRenderNode *
|
||||
colors (guint n)
|
||||
{
|
||||
GskRenderNode **nodes = g_new (GskRenderNode *, 10 * n);
|
||||
@ -174,7 +174,7 @@ colors (guint n)
|
||||
return container;
|
||||
}
|
||||
|
||||
GskRenderNode *
|
||||
static GskRenderNode *
|
||||
clipped_colors (guint n)
|
||||
{
|
||||
GskRenderNode **nodes = g_newa (GskRenderNode *,n);
|
||||
@ -241,7 +241,7 @@ compare_color_stops (gconstpointer a,
|
||||
return 0;
|
||||
}
|
||||
|
||||
GskRenderNode *
|
||||
static GskRenderNode *
|
||||
linear_gradient (guint n)
|
||||
{
|
||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||
@ -306,7 +306,7 @@ linear_gradient (guint n)
|
||||
return container;
|
||||
}
|
||||
|
||||
GskRenderNode *
|
||||
static GskRenderNode *
|
||||
borders (guint n)
|
||||
{
|
||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||
@ -355,7 +355,7 @@ const char *example =
|
||||
"Beware the Jubjub bird, and shun\n"
|
||||
"The frumious Bandersnatch!'";
|
||||
|
||||
GskRenderNode *
|
||||
static GskRenderNode *
|
||||
text (guint n)
|
||||
{
|
||||
GPtrArray *nodes;
|
||||
@ -447,7 +447,7 @@ text (guint n)
|
||||
return container;
|
||||
}
|
||||
|
||||
GskRenderNode *
|
||||
static GskRenderNode *
|
||||
cairo_node (guint n)
|
||||
{
|
||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||
@ -472,7 +472,7 @@ cairo_node (guint n)
|
||||
return container;
|
||||
}
|
||||
|
||||
GskRenderNode *
|
||||
static GskRenderNode *
|
||||
box_shadows (guint n)
|
||||
{
|
||||
GskRenderNode **nodes = g_newa (GskRenderNode *, n);
|
||||
@ -540,7 +540,7 @@ main (int argc, char **argv)
|
||||
GError *error = NULL;
|
||||
GskRenderNode *node;
|
||||
GPatternSpec *matcher;
|
||||
char *pattern;
|
||||
const char *pattern;
|
||||
guint i, n;
|
||||
|
||||
gtk_init ();
|
||||
|
@ -17,6 +17,7 @@ typedef struct
|
||||
|
||||
typedef GtkTextViewClass MyTextViewClass;
|
||||
|
||||
static GType my_text_view_get_type (void);
|
||||
G_DEFINE_TYPE (MyTextView, my_text_view, GTK_TYPE_TEXT_VIEW)
|
||||
|
||||
static void
|
||||
@ -27,7 +28,7 @@ my_text_view_class_init (MyTextViewClass *tv_class) {}
|
||||
|
||||
|
||||
|
||||
GtkWidget *
|
||||
static GtkWidget *
|
||||
create_widget_factory_content (void)
|
||||
{
|
||||
GError *error = NULL;
|
||||
@ -64,7 +65,7 @@ set_adjustment_to_fraction (GtkAdjustment *adjustment,
|
||||
fraction * (upper - page_size));
|
||||
}
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
scroll_viewport (GtkWidget *viewport,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer user_data)
|
||||
|
@ -187,8 +187,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (write_to_filename != NULL)
|
||||
{
|
||||
GdkSurface *window = gdk_surface_new_toplevel (gdk_display_get_default(), 10 , 10);
|
||||
GskRenderer *renderer = gsk_renderer_new_for_surface (window);
|
||||
GdkSurface *surface = gdk_surface_new_toplevel (gdk_display_get_default(), 10 , 10);
|
||||
GskRenderer *renderer = gsk_renderer_new_for_surface (surface);
|
||||
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));
|
||||
@ -201,7 +201,7 @@ main (int argc, char **argv)
|
||||
|
||||
g_object_unref (texture);
|
||||
g_object_unref (renderer);
|
||||
g_object_unref (window);
|
||||
g_object_unref (surface);
|
||||
}
|
||||
|
||||
if (compare_node)
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
hello (void)
|
||||
{
|
||||
g_print ("hello world\n");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* XPM */
|
||||
static char *openfile[] = {
|
||||
static const char *openfile[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
" 20 19 66 2",
|
||||
/* colors */
|
||||
|
@ -62,9 +62,9 @@ static void
|
||||
quit_cb (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gboolean *done = data;
|
||||
gboolean *is_done = data;
|
||||
|
||||
*done = TRUE;
|
||||
*is_done = TRUE;
|
||||
|
||||
g_main_context_wakeup (NULL);
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ static GtkWidget *toplevel, *button, *box;
|
||||
static GtkWidget *sel_image, *sel_name;
|
||||
|
||||
static void
|
||||
combo_changed_cb (GtkAppChooserButton *button,
|
||||
combo_changed_cb (GtkAppChooserButton *chooser_button,
|
||||
gpointer user_data)
|
||||
{
|
||||
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)
|
||||
return;
|
||||
|
@ -677,7 +677,7 @@ create_page_flipping_assistant (GtkWidget *widget)
|
||||
}
|
||||
|
||||
struct {
|
||||
gchar *text;
|
||||
const char *text;
|
||||
void (*func) (GtkWidget *widget);
|
||||
} buttons[] =
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static char *baseline_pos_str[] = {
|
||||
static const char *baseline_pos_str[] = {
|
||||
"BASELINE_POSITION_TOP",
|
||||
"BASELINE_POSITION_CENTER",
|
||||
"BASELINE_POSITION_BOTTOM"
|
||||
@ -114,7 +114,7 @@ main (int argc,
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
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};
|
||||
|
||||
label = gtk_label_new (aligns_names[j]);
|
||||
@ -251,7 +251,7 @@ main (int argc,
|
||||
|
||||
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]);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
|
@ -17,7 +17,7 @@ struct _GtkBlurBoxClass
|
||||
};
|
||||
typedef struct _GtkBlurBoxClass GtkBlurBoxClass;
|
||||
|
||||
|
||||
static GType gtk_blur_box_get_type (void);
|
||||
G_DEFINE_TYPE (GtkBlurBox, gtk_blur_box, GTK_TYPE_BOX)
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@ enum
|
||||
|
||||
static char *
|
||||
calendar_date_to_string (CalendarData *data,
|
||||
char *format)
|
||||
const char *format)
|
||||
{
|
||||
GDateTime *date;
|
||||
char *str;
|
||||
|
@ -26,8 +26,8 @@
|
||||
#define NUM_COLS 17 /* change this when adding columns */
|
||||
|
||||
struct cell_params {
|
||||
char *description; /* 0 */
|
||||
char *test; /* 1 */
|
||||
const char *description; /* 0 */
|
||||
const char *test; /* 1 */
|
||||
int xpad; /* 2 */
|
||||
int ypad; /* 3 */
|
||||
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" };
|
||||
GdkRGBA color;
|
||||
GdkRGBA colors[9*9];
|
||||
gint i,j;
|
||||
gint k,j;
|
||||
gdouble f[5] = { 0.2, 0.35, 0.5, 0.65, 0.8 };
|
||||
|
||||
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++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
static void
|
||||
G_GNUC_PRINTF (1, 2) static void
|
||||
combochange_log (const char *fmt,
|
||||
...)
|
||||
...)
|
||||
{
|
||||
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
|
||||
GtkTextIter iter;
|
||||
@ -204,6 +204,8 @@ animation_timer (gpointer data)
|
||||
case 2:
|
||||
on_reorder ();
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
n_animations--;
|
||||
|
@ -200,6 +200,7 @@ typedef struct {
|
||||
GtkDialogClass parent_class;
|
||||
} MyDialogClass;
|
||||
|
||||
static GType my_dialog_get_type (void);
|
||||
G_DEFINE_TYPE (MyDialog, my_dialog, GTK_TYPE_DIALOG);
|
||||
|
||||
static void
|
||||
@ -270,6 +271,7 @@ typedef struct {
|
||||
GtkDialogClass parent_class;
|
||||
} MyDialog2Class;
|
||||
|
||||
static GType my_dialog2_get_type (void);
|
||||
G_DEFINE_TYPE (MyDialog2, my_dialog2, GTK_TYPE_DIALOG);
|
||||
|
||||
static void
|
||||
|
@ -307,7 +307,7 @@ action_make_unique (GdkDragAction action)
|
||||
return 0;
|
||||
}
|
||||
|
||||
GdkDragAction
|
||||
static GdkDragAction
|
||||
trash_drag_enter (GtkDropTarget *dest,
|
||||
GdkDrop *drop,
|
||||
double x,
|
||||
@ -325,7 +325,7 @@ trash_drag_enter (GtkDropTarget *dest,
|
||||
return action_make_unique (gdk_drop_get_actions (drop));;
|
||||
}
|
||||
|
||||
GdkDragAction
|
||||
static GdkDragAction
|
||||
trash_drag_leave (GtkDropTarget *dest,
|
||||
GdkDrop *drop,
|
||||
GtkWidget *widget)
|
||||
@ -341,7 +341,7 @@ trash_drag_leave (GtkDropTarget *dest,
|
||||
return action_make_unique (gdk_drop_get_actions (drop));
|
||||
}
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
trash_drag_drop (GtkDropTarget *dest,
|
||||
GdkDrop *drop,
|
||||
double x,
|
||||
@ -359,7 +359,7 @@ trash_drag_drop (GtkDropTarget *dest,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
label_drag_drop (GtkDropTarget *dest,
|
||||
const GValue *value,
|
||||
int x,
|
||||
@ -381,7 +381,7 @@ static gboolean in_popup = FALSE;
|
||||
static guint popdown_timer = 0;
|
||||
static guint popup_timer = 0;
|
||||
|
||||
gint
|
||||
static int
|
||||
popdown_cb (gpointer data)
|
||||
{
|
||||
popdown_timer = 0;
|
||||
@ -392,7 +392,7 @@ popdown_cb (gpointer data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
popup_enter (GtkDropTarget *dest)
|
||||
{
|
||||
g_print ("popup enter\n");
|
||||
@ -408,7 +408,7 @@ popup_enter (GtkDropTarget *dest)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
popup_leave (GtkDropTarget *dest)
|
||||
{
|
||||
g_print ("popup leave\n");
|
||||
@ -430,7 +430,7 @@ popup_drop (GtkDropTarget *dest)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
popup_cb (gpointer data)
|
||||
{
|
||||
if (!popped_up)
|
||||
@ -474,16 +474,7 @@ popup_cb (gpointer data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
popsite_motion (GtkDropTarget *dest,
|
||||
int x,
|
||||
int y,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
popsite_enter (GtkDropControllerMotion *motion)
|
||||
{
|
||||
g_print ("popsite enter\n");
|
||||
@ -491,7 +482,7 @@ popsite_enter (GtkDropControllerMotion *motion)
|
||||
popup_timer = g_timeout_add (500, popup_cb, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
popsite_leave (GtkDropControllerMotion *motion)
|
||||
{
|
||||
g_print ("popsite leave\n");
|
||||
@ -502,14 +493,7 @@ popsite_leave (GtkDropControllerMotion *motion)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
source_drag_data_delete (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
g_print ("Delete the data!\n");
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_init (void)
|
||||
{
|
||||
if (g_file_test ("../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
|
||||
|
@ -79,6 +79,8 @@ get_image_texture (GtkImage *image)
|
||||
0);
|
||||
paintable = GDK_PAINTABLE (icon);
|
||||
break;
|
||||
case GTK_IMAGE_GICON:
|
||||
case GTK_IMAGE_EMPTY:
|
||||
default:
|
||||
g_warning ("Image storage type %d not handled",
|
||||
gtk_image_get_storage_type (image));
|
||||
@ -323,7 +325,7 @@ drag_cancel (GtkDragSource *source,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
static GtkWidget *
|
||||
make_image (const gchar *icon_name, int hotspot)
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
@ -24,7 +24,7 @@
|
||||
/* Don't copy this bad example; inline RGB data is always a better
|
||||
* idea than inline XPMs.
|
||||
*/
|
||||
static char *book_closed_xpm[] = {
|
||||
static const char *book_closed_xpm[] = {
|
||||
"16 16 6 1",
|
||||
" c None s None",
|
||||
". c black",
|
||||
@ -54,7 +54,7 @@ static GtkWidget *window = NULL;
|
||||
|
||||
|
||||
/* Creates a tree model containing the completions */
|
||||
GtkTreeModel *
|
||||
static GtkTreeModel *
|
||||
create_simple_completion_model (void)
|
||||
{
|
||||
GtkListStore *store;
|
||||
@ -120,7 +120,7 @@ create_simple_completion_model (void)
|
||||
}
|
||||
|
||||
/* Creates a tree model containing the completions */
|
||||
GtkTreeModel *
|
||||
static GtkTreeModel *
|
||||
create_completion_model (void)
|
||||
{
|
||||
GtkListStore *store;
|
||||
@ -192,7 +192,7 @@ activated_cb (GtkEntryCompletion *completion,
|
||||
|
||||
static gint timer_count = 0;
|
||||
|
||||
static gchar *dynamic_completions[] = {
|
||||
static const char *dynamic_completions[] = {
|
||||
"GNOME",
|
||||
"gnominious",
|
||||
"Gnomonic projection",
|
||||
@ -269,7 +269,7 @@ animation_timer (GtkEntryCompletion *completion)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
match_selected_cb (GtkEntryCompletion *completion,
|
||||
GtkTreeModel *model,
|
||||
GtkTreeIter *iter)
|
||||
@ -297,7 +297,7 @@ quit_cb (GtkWidget *widget,
|
||||
g_main_context_wakeup (NULL);
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
|
@ -140,123 +140,6 @@ filter_changed (GtkFileChooserDialog *dialog,
|
||||
#include <errno.h>
|
||||
#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
|
||||
set_current_folder (GtkFileChooser *chooser,
|
||||
@ -487,6 +370,8 @@ main (int argc, char **argv)
|
||||
_("_Save"), GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static gchar *backend = "gtk+";
|
||||
static const char *backend = "gtk+";
|
||||
static gboolean rtl = FALSE;
|
||||
static GOptionEntry entries[] = {
|
||||
{ "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");
|
||||
sensitive = FALSE;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (box), widget);
|
||||
|
@ -4,26 +4,34 @@ GtkWidget *label;
|
||||
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
@ -349,17 +349,17 @@ create_action_treeview (GActionGroup *group)
|
||||
GtkTreeIter iter;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkCellRenderer *cell;
|
||||
gchar **actions;
|
||||
gchar **group_actions;
|
||||
gint i;
|
||||
|
||||
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
actions = g_action_group_list_actions (group);
|
||||
for (i = 0; actions[i]; i++)
|
||||
group_actions = g_action_group_list_actions (group);
|
||||
for (i = 0; group_actions[i]; i++)
|
||||
{
|
||||
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);
|
||||
|
||||
tv = gtk_tree_view_new ();
|
||||
|
104
tests/testgtk.c
104
tests/testgtk.c
@ -51,7 +51,7 @@
|
||||
|
||||
static gboolean done = FALSE;
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
file_exists (const char *filename)
|
||||
{
|
||||
struct stat statbuf;
|
||||
@ -60,7 +60,7 @@ file_exists (const char *filename)
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
build_option_menu (gchar *items[],
|
||||
build_option_menu (const char *items[],
|
||||
gint num_items,
|
||||
gint history,
|
||||
void (*func) (GtkWidget *widget, gpointer data),
|
||||
@ -91,7 +91,7 @@ typedef struct sTreeButtons {
|
||||
/* end of tree section */
|
||||
|
||||
static GtkWidget *
|
||||
build_option_menu (gchar *items[],
|
||||
build_option_menu (const char *items[],
|
||||
gint num_items,
|
||||
gint history,
|
||||
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))));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
create_alpha_window (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window;
|
||||
@ -599,8 +599,8 @@ create_radio_buttons (GtkWidget *widget)
|
||||
*/
|
||||
|
||||
static GtkWidget*
|
||||
new_pixbuf (char *filename,
|
||||
GdkSurface *window)
|
||||
new_pixbuf (const char *filename,
|
||||
GdkSurface *window)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkPixbuf *pixbuf;
|
||||
@ -674,7 +674,7 @@ statusbar_popped (GtkStatusbar *statusbar,
|
||||
static void
|
||||
statusbar_contexts (GtkStatusbar *statusbar)
|
||||
{
|
||||
gchar *string;
|
||||
const char *string;
|
||||
|
||||
string = "any context";
|
||||
g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
|
||||
@ -916,7 +916,7 @@ activate_link (GtkWidget *label, const gchar *uri, gpointer data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void create_labels (GtkWidget *widget)
|
||||
static void create_labels (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *hbox;
|
||||
@ -1132,7 +1132,7 @@ on_rotated_text_draw (GtkDrawingArea *drawing_area,
|
||||
n_words = G_N_ELEMENTS (words);
|
||||
for (i = 0; i < n_words; i++)
|
||||
{
|
||||
int width, height;
|
||||
int layout_width, layout_height;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
@ -1140,9 +1140,9 @@ on_rotated_text_draw (GtkDrawingArea *drawing_area,
|
||||
pango_cairo_update_layout (cr, layout);
|
||||
|
||||
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);
|
||||
|
||||
cairo_restore (cr);
|
||||
@ -2509,7 +2509,7 @@ spin_button_month_input_func (GtkSpinButton *spin_button,
|
||||
gdouble *new_val)
|
||||
{
|
||||
gint i;
|
||||
static gchar *month[12] = { "January", "February", "March", "April",
|
||||
static const char *month[12] = { "January", "February", "March", "April",
|
||||
"May", "June", "July", "August",
|
||||
"September", "October", "November", "December" };
|
||||
gchar *tmp1, *tmp2;
|
||||
@ -2541,7 +2541,7 @@ spin_button_month_output_func (GtkSpinButton *spin_button)
|
||||
GtkAdjustment *adjustment;
|
||||
gdouble value;
|
||||
gint i;
|
||||
static gchar *month[12] = { "January", "February", "March", "April",
|
||||
static const char *month[12] = { "January", "February", "March", "April",
|
||||
"May", "June", "July", "August", "September",
|
||||
"October", "November", "December" };
|
||||
|
||||
@ -3168,7 +3168,7 @@ create_cursors (GtkWidget *widget)
|
||||
* GtkColorSelection
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
create_color_selection (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
@ -3206,7 +3206,7 @@ create_color_selection (GtkWidget *widget)
|
||||
gtk_widget_destroy (window);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
flipping_toggled_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
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)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
@ -3285,7 +3285,7 @@ create_forward_back (const char *title,
|
||||
return frame;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
create_flipping (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
@ -3345,7 +3345,7 @@ create_flipping (GtkWidget *widget)
|
||||
* GtkFontSelection
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
create_font_selection (GtkWidget *widget)
|
||||
{
|
||||
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)
|
||||
{
|
||||
gtk_widget_destroy (data);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
create_display_screen (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *grid, *frame, *window, *combo_dpy, *vbox;
|
||||
@ -3966,6 +3966,8 @@ notebook_type_changed (GtkWidget *optionmenu,
|
||||
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
if (gtk_notebook_get_n_pages (notebook) == 15)
|
||||
@ -3994,7 +3996,7 @@ create_notebook (GtkWidget *widget)
|
||||
GtkWidget *omenu;
|
||||
GtkWidget *label;
|
||||
|
||||
static gchar *items[] =
|
||||
static const char *items[] =
|
||||
{
|
||||
"Standard",
|
||||
"No tabs",
|
||||
@ -4103,7 +4105,7 @@ create_notebook (GtkWidget *widget)
|
||||
* GtkPanes
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
toggle_resize (GtkWidget *widget, GtkWidget *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);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
toggle_shrink (GtkWidget *widget, GtkWidget *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);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
static GtkWidget *
|
||||
create_pane_options (GtkPaned *paned,
|
||||
const gchar *frame_label,
|
||||
const gchar *label1,
|
||||
@ -4190,7 +4192,7 @@ create_pane_options (GtkPaned *paned,
|
||||
return frame;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
create_panes (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
@ -4642,7 +4644,7 @@ create_paned_keyboard_navigation (GtkWidget *widget)
|
||||
* WM Hints demo
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
create_wmhints (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
@ -4836,7 +4838,7 @@ tracking_label (GtkWidget *window)
|
||||
return hbox;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
keep_window_above (GtkToggleButton *togglebutton, gpointer data)
|
||||
{
|
||||
GtkWidget *button = g_object_get_data (G_OBJECT (togglebutton), "radio");
|
||||
@ -4848,7 +4850,7 @@ keep_window_above (GtkToggleButton *togglebutton, gpointer data)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
keep_window_below (GtkToggleButton *togglebutton, gpointer data)
|
||||
{
|
||||
GtkWidget *button = g_object_get_data (G_OBJECT (togglebutton), "radio");
|
||||
@ -4957,7 +4959,7 @@ get_state_controls (GtkWidget *window)
|
||||
return vbox;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
create_surface_states (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
@ -5248,7 +5250,7 @@ window_controls (GtkWidget *window)
|
||||
return control_window;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
create_window_sizing (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
@ -5310,7 +5312,7 @@ typedef struct _ProgressData {
|
||||
gboolean activity;
|
||||
} ProgressData;
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
progress_timeout (gpointer data)
|
||||
{
|
||||
ProgressData *pdata = data;
|
||||
@ -5429,7 +5431,7 @@ entry_changed (GtkWidget *widget, ProgressData *pdata)
|
||||
gtk_editable_get_text (GTK_EDITABLE (pdata->entry)));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
create_progress_bar (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
@ -5442,7 +5444,7 @@ create_progress_bar (GtkWidget *widget)
|
||||
GtkWidget *label;
|
||||
static ProgressData *pdata = NULL;
|
||||
|
||||
static gchar *items1[] =
|
||||
static const char *items1[] =
|
||||
{
|
||||
"Left-Right",
|
||||
"Right-Left",
|
||||
@ -5450,7 +5452,7 @@ create_progress_bar (GtkWidget *widget)
|
||||
"Top-Bottom"
|
||||
};
|
||||
|
||||
static char *ellipsize_items[] = {
|
||||
static const char *ellipsize_items[] = {
|
||||
"None", // PANGO_ELLIPSIZE_NONE,
|
||||
"Start", // PANGO_ELLIPSIZE_START,
|
||||
"Middle", // PANGO_ELLIPSIZE_MIDDLE,
|
||||
@ -5586,7 +5588,7 @@ create_progress_bar (GtkWidget *widget)
|
||||
|
||||
static int timer = 0;
|
||||
|
||||
gint
|
||||
static int
|
||||
timeout_test (GtkWidget *label)
|
||||
{
|
||||
static int count = 0;
|
||||
@ -5598,7 +5600,7 @@ timeout_test (GtkWidget *label)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
start_timeout_test (GtkWidget *widget,
|
||||
GtkWidget *label)
|
||||
{
|
||||
@ -5608,7 +5610,7 @@ start_timeout_test (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
stop_timeout_test (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
@ -5619,7 +5621,7 @@ stop_timeout_test (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
destroy_timeout_test (GtkWidget *widget,
|
||||
GtkWidget **window)
|
||||
{
|
||||
@ -5628,7 +5630,7 @@ destroy_timeout_test (GtkWidget *widget,
|
||||
*window = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
create_timeout_test (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
@ -5920,6 +5922,8 @@ native_filter_changed (GtkWidget *combo,
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (native), filter);
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (native), filter);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -5930,7 +5934,7 @@ destroy_native (GtkFileChooserNative *native)
|
||||
g_object_unref (native);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
create_native_dialogs (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
@ -6036,7 +6040,7 @@ create_native_dialogs (GtkWidget *widget)
|
||||
* Main Window and Exit
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
do_exit (GtkWidget *widget, GtkWidget *window)
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
@ -6045,7 +6049,7 @@ do_exit (GtkWidget *widget, GtkWidget *window)
|
||||
}
|
||||
|
||||
struct {
|
||||
char *label;
|
||||
const char *label;
|
||||
void (*func) (GtkWidget *widget);
|
||||
gboolean do_not_benchmark;
|
||||
} buttons[] =
|
||||
@ -6091,16 +6095,16 @@ int nbuttons = sizeof (buttons) / sizeof (buttons[0]);
|
||||
|
||||
static void
|
||||
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);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
create_main_window (void)
|
||||
{
|
||||
GtkWidget *window;
|
||||
@ -6211,8 +6215,8 @@ bench_iteration (GtkWidget *widget, void (* fn) (GtkWidget *widget))
|
||||
while (g_main_context_iteration (NULL, FALSE));
|
||||
}
|
||||
|
||||
void
|
||||
do_real_bench (GtkWidget *widget, void (* fn) (GtkWidget *widget), char *name, int num)
|
||||
static void
|
||||
do_real_bench (GtkWidget *widget, void (* fn) (GtkWidget *widget), const char *name, int num)
|
||||
{
|
||||
GTimeVal tv0, tv1;
|
||||
double dt_first;
|
||||
@ -6247,7 +6251,7 @@ do_real_bench (GtkWidget *widget, void (* fn) (GtkWidget *widget), char *name, i
|
||||
g_print ("%10.1f\n", dt_first);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
do_bench (char* what, int num)
|
||||
{
|
||||
int i;
|
||||
@ -6284,7 +6288,7 @@ do_bench (char* what, int num)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
usage (void)
|
||||
{
|
||||
fprintf (stderr, "Usage: testgtk [--bench ALL|<bench>[:<count>]]\n");
|
||||
|
@ -74,11 +74,11 @@ static gboolean done = FALSE;
|
||||
|
||||
static void
|
||||
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);
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkIconPaintable *icon;
|
||||
char *themename;
|
||||
int size = 48;
|
||||
int scale = 1;
|
||||
@ -127,6 +126,7 @@ main (int argc, char *argv[])
|
||||
else if (strcmp (argv[1], "lookup") == 0)
|
||||
{
|
||||
GFile *file;
|
||||
GtkIconPaintable *icon;
|
||||
|
||||
if (argc < 4)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ visible_func (GtkTreeModel *model,
|
||||
return visible;
|
||||
}
|
||||
|
||||
GtkTreeModel *
|
||||
static GtkTreeModel *
|
||||
get_filter_model (gboolean first)
|
||||
{
|
||||
GtkTreeModelFilter *model;
|
||||
|
@ -10,11 +10,11 @@ static gboolean done = FALSE;
|
||||
|
||||
static void
|
||||
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);
|
||||
}
|
||||
@ -56,16 +56,16 @@ kinetic_scrolling (void)
|
||||
button_grid = gtk_grid_new ();
|
||||
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_widget_set_hexpand (button, TRUE);
|
||||
gtk_widget_show (button);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (on_button_clicked),
|
||||
GINT_TO_POINTER (i));
|
||||
g_free (label);
|
||||
g_free (button_label);
|
||||
}
|
||||
|
||||
swindow = gtk_scrolled_window_new (NULL, NULL);
|
||||
@ -99,10 +99,10 @@ kinetic_scrolling (void)
|
||||
for (i = 0; i < 80; i++)
|
||||
{
|
||||
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_set (store, &iter, 0, label, -1);
|
||||
gtk_list_store_set (store, &iter, 0, iter_label, -1);
|
||||
g_free (label);
|
||||
}
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store));
|
||||
|
@ -30,6 +30,7 @@ const char *css =
|
||||
"background-color: red;"
|
||||
"}";
|
||||
|
||||
static GType row_get_type (void);
|
||||
G_DEFINE_TYPE (Row, row, GTK_TYPE_LIST_BOX_ROW)
|
||||
|
||||
static void
|
||||
@ -42,7 +43,7 @@ row_class_init (RowClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
static GtkWidget *
|
||||
row_new (const gchar* text, gint sort_id) {
|
||||
Row *row;
|
||||
|
||||
|
@ -7,6 +7,7 @@ typedef struct
|
||||
|
||||
typedef GtkApplicationClass TestAppClass;
|
||||
|
||||
static GType test_app_get_type (void);
|
||||
G_DEFINE_TYPE (TestApp, test_app, GTK_TYPE_APPLICATION)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
TestApp *
|
||||
static TestApp *
|
||||
test_app_new (void)
|
||||
{
|
||||
TestApp *test_app;
|
||||
|
@ -43,6 +43,7 @@ struct _GTestPermissionClass
|
||||
GPermissionClass parent_class;
|
||||
};
|
||||
|
||||
static GType g_test_permission_get_type (void);
|
||||
G_DEFINE_TYPE (GTestPermission, g_test_permission, G_TYPE_PERMISSION)
|
||||
|
||||
static void
|
||||
@ -101,7 +102,7 @@ acquire_async (GPermission *permission,
|
||||
g_object_unref (result);
|
||||
}
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
acquire_finish (GPermission *permission,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
@ -135,7 +136,7 @@ release_async (GPermission *permission,
|
||||
g_object_unref (result);
|
||||
}
|
||||
|
||||
gboolean
|
||||
static gboolean
|
||||
release_finish (GPermission *permission,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
@ -158,7 +159,7 @@ g_test_permission_class_init (GTestPermissionClass *class)
|
||||
permission_class->release_finish = release_finish;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
g_test_permission_set_success (GTestPermission *permission,
|
||||
gboolean success)
|
||||
{
|
||||
|
@ -108,15 +108,15 @@ int main (int argc, char **argv)
|
||||
/* Button with GMenuModel */
|
||||
menu = g_menu_new ();
|
||||
for (i = 5; i > 0; i--) {
|
||||
char *label;
|
||||
char *item_label;
|
||||
GMenuItem *item;
|
||||
label = g_strdup_printf ("Item _%d", i);
|
||||
item = g_menu_item_new (label, NULL);
|
||||
item_label = g_strdup_printf ("Item _%d", i);
|
||||
item = g_menu_item_new (item_label, NULL);
|
||||
if (i == 3)
|
||||
g_menu_item_set_attribute (item, "icon", "s", "preferences-desktop-locale-symbolic");
|
||||
g_menu_insert_item (menu, 0, item);
|
||||
g_object_unref (item);
|
||||
g_free (label);
|
||||
g_free (item_label);
|
||||
}
|
||||
|
||||
button = gtk_menu_button_new ();
|
||||
|
@ -20,10 +20,10 @@
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static gpointer GROUP_A = "GROUP_A";
|
||||
static gpointer GROUP_B = "GROUP_B";
|
||||
static gconstpointer GROUP_A = "GROUP_A";
|
||||
static gconstpointer GROUP_B = "GROUP_B";
|
||||
|
||||
gchar *tabs1 [] = {
|
||||
const char *tabs1 [] = {
|
||||
"aaaaaaaaaa",
|
||||
"bbbbbbbbbb",
|
||||
"cccccccccc",
|
||||
@ -31,7 +31,7 @@ gchar *tabs1 [] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
gchar *tabs2 [] = {
|
||||
const char *tabs2 [] = {
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
@ -40,13 +40,13 @@ gchar *tabs2 [] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
gchar *tabs3 [] = {
|
||||
const char *tabs3 [] = {
|
||||
"foo",
|
||||
"bar",
|
||||
NULL
|
||||
};
|
||||
|
||||
gchar *tabs4 [] = {
|
||||
const char *tabs4 [] = {
|
||||
"beer",
|
||||
"water",
|
||||
"lemonade",
|
||||
@ -133,8 +133,8 @@ action_clicked_cb (GtkWidget *button,
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
create_notebook (gchar **labels,
|
||||
const gchar *group,
|
||||
create_notebook (const char **labels,
|
||||
const char *group,
|
||||
GtkPositionType pos)
|
||||
{
|
||||
GtkWidget *notebook, *title, *page, *action_widget;
|
||||
@ -174,7 +174,7 @@ create_notebook (gchar **labels,
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
create_notebook_non_dragable_content (gchar **labels,
|
||||
create_notebook_non_dragable_content (const char **labels,
|
||||
const gchar *group,
|
||||
GtkPositionType pos)
|
||||
{
|
||||
@ -225,7 +225,7 @@ create_notebook_non_dragable_content (gchar **labels,
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
create_notebook_with_notebooks (gchar **labels,
|
||||
create_notebook_with_notebooks (const char **labels,
|
||||
const gchar *group,
|
||||
GtkPositionType pos)
|
||||
{
|
||||
|
@ -364,7 +364,7 @@ test_chase (void)
|
||||
GtkWidget *sw;
|
||||
GtkWidget *text;
|
||||
GtkWidget *child;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextBuffer *text_buffer;
|
||||
gchar *contents;
|
||||
gsize len;
|
||||
GtkEventController *controller;
|
||||
@ -381,15 +381,15 @@ test_chase (void)
|
||||
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
||||
|
||||
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))
|
||||
{
|
||||
contents = g_strdup ("Text should go here...");
|
||||
len = strlen (contents);
|
||||
}
|
||||
gtk_text_buffer_set_text (buffer, contents, len);
|
||||
gtk_text_buffer_set_text (text_buffer, contents, len);
|
||||
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_vexpand (text, TRUE);
|
||||
|
@ -9,7 +9,7 @@ int overall_alpha = 255;
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *darea;
|
||||
|
||||
void
|
||||
static void
|
||||
set_interp_type (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
guint types[] = { GDK_INTERP_NEAREST,
|
||||
@ -21,7 +21,7 @@ set_interp_type (GtkWidget *widget, gpointer data)
|
||||
gtk_widget_queue_draw (darea);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
overall_changed_cb (GtkAdjustment *adjustment, gpointer data)
|
||||
{
|
||||
if (gtk_adjustment_get_value (adjustment) != overall_alpha)
|
||||
@ -32,7 +32,7 @@ overall_changed_cb (GtkAdjustment *adjustment, gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
draw_func (GtkDrawingArea *darea,
|
||||
draw_func (GtkDrawingArea *area,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
|
@ -12,6 +12,7 @@ typedef struct {
|
||||
GtkListBoxRowClass parent_class;
|
||||
} SelectableRowClass;
|
||||
|
||||
static GType selectable_row_get_type (void);
|
||||
G_DEFINE_TYPE (SelectableRow, selectable_row, GTK_TYPE_LIST_BOX_ROW)
|
||||
|
||||
static void
|
||||
@ -34,7 +35,7 @@ selectable_row_init (SelectableRow *row)
|
||||
gtk_container_add (GTK_CONTAINER (row->revealer), row->check);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
selectable_row_add (SelectableRow *row, GtkWidget *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)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (selectable_row_get_type (), NULL));
|
||||
|
@ -49,58 +49,58 @@ toggle_transitions (GtkWidget *combo, gpointer data)
|
||||
}
|
||||
|
||||
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 *vis;
|
||||
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++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 *vis;
|
||||
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++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -4,19 +4,21 @@
|
||||
static GtkWidget *header_stack;
|
||||
static GtkWidget *page_stack;
|
||||
|
||||
void
|
||||
#if 0
|
||||
static void
|
||||
back_to_main (GtkButton *button)
|
||||
{
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (header_stack), "main");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (page_stack), "page1");
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
go_to_secondary (GtkButton *button)
|
||||
{
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (header_stack), "secondary");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (page_stack), "secondary");
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
@ -37,6 +39,8 @@ main (int argc, char *argv[])
|
||||
header_stack = (GtkWidget *)gtk_builder_get_object (builder, "header_stack");
|
||||
page_stack = (GtkWidget *)gtk_builder_get_object (builder, "page_stack");
|
||||
|
||||
g_assert (header_stack);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
|
||||
while (TRUE)
|
||||
|
@ -16,7 +16,6 @@
|
||||
<property name="valign">center</property>
|
||||
<signal name="clicked" handler="go_to_secondary"/>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher">
|
||||
@ -38,7 +37,6 @@
|
||||
<property name="valign">center</property>
|
||||
<signal name="clicked" handler="back_to_main"/>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
|
@ -11,6 +11,7 @@ typedef struct {
|
||||
GtkTextViewClass parent_class;
|
||||
} MyTextViewClass;
|
||||
|
||||
static GType my_text_view_get_type (void);
|
||||
G_DEFINE_TYPE (MyTextView, my_text_view, GTK_TYPE_TEXT_VIEW);
|
||||
|
||||
static void snapshot_background (GtkWidget *widget, GtkSnapshot *snapshot);
|
||||
|
@ -37,6 +37,7 @@ struct _MyTooltipClass
|
||||
GtkBinClass parent_class;
|
||||
};
|
||||
|
||||
static GType my_tooltip_get_type (void);
|
||||
G_DEFINE_TYPE (MyTooltip, my_tooltip, GTK_TYPE_BIN)
|
||||
|
||||
static void
|
||||
|
@ -76,6 +76,19 @@ struct _ViewColumnModelClass
|
||||
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)
|
||||
{
|
||||
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
|
||||
update_columns (GtkTreeView *view, ViewColumnModel *view_model)
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ typedef GtkListStoreClass MyModelClass;
|
||||
|
||||
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_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE,
|
||||
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);
|
||||
callback = G_CALLBACK (fixed_cell_toggled);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
checkbutton = gtk_check_button_new_with_label (name);
|
||||
|
@ -28,7 +28,7 @@ enum
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
static char *words[] =
|
||||
static const char *words[] =
|
||||
{
|
||||
"Boom",
|
||||
"Borp",
|
||||
@ -102,6 +102,8 @@ futz_row (void)
|
||||
TEXT_COLUMN, words[g_rand_int_range (grand, 0, NUM_WORDS)],
|
||||
-1);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,16 +61,16 @@ start_enumerate (GListStore *store)
|
||||
static void
|
||||
got_files (GObject *enumerate,
|
||||
GAsyncResult *res,
|
||||
gpointer store)
|
||||
gpointer user_data)
|
||||
{
|
||||
GList *l, *files;
|
||||
GFile *file = g_object_get_data (store, "file");
|
||||
GFile *file = g_object_get_data (user_data, "file");
|
||||
GPtrArray *array;
|
||||
|
||||
files = g_file_enumerator_next_files_finish (G_FILE_ENUMERATOR (enumerate), res, NULL);
|
||||
if (files == NULL)
|
||||
{
|
||||
g_object_unref (store);
|
||||
g_object_unref (user_data);
|
||||
if (pending)
|
||||
{
|
||||
GListStore *store = pending->data;
|
||||
@ -94,7 +94,7 @@ got_files (GObject *enumerate,
|
||||
}
|
||||
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_file_enumerator_next_files_async (G_FILE_ENUMERATOR (enumerate),
|
||||
@ -102,7 +102,7 @@ got_files (GObject *enumerate,
|
||||
G_PRIORITY_DEFAULT_IDLE,
|
||||
NULL,
|
||||
got_files,
|
||||
store);
|
||||
user_data);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -204,7 +204,7 @@ tree_store_insert_deep (GtkTreeModel *model,
|
||||
|
||||
|
||||
static void
|
||||
test_run (gchar *title,
|
||||
test_run (const char *title,
|
||||
GtkTreeModel *store,
|
||||
ClearFunc *clear,
|
||||
InsertFunc *insert)
|
||||
|
@ -68,26 +68,14 @@ enum
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
gboolean
|
||||
select_func (GtkTreeSelection *selection,
|
||||
GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
gboolean path_currently_selected,
|
||||
gpointer data)
|
||||
{
|
||||
if (gtk_tree_path_get_depth (path) > 1)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
switch_search_method (GtkWidget *button,
|
||||
gpointer tree_view)
|
||||
{
|
||||
if (!gtk_tree_view_get_search_entry (GTK_TREE_VIEW (tree_view)))
|
||||
{
|
||||
gpointer data = g_object_get_data (tree_view, "my-search-entry");
|
||||
gtk_tree_view_set_search_entry (GTK_TREE_VIEW (tree_view), GTK_EDITABLE (data));
|
||||
gpointer search_entry = g_object_get_data (tree_view, "my-search-entry");
|
||||
gtk_tree_view_set_search_entry (GTK_TREE_VIEW (tree_view), GTK_EDITABLE (search_entry));
|
||||
}
|
||||
else
|
||||
gtk_tree_view_set_search_entry (GTK_TREE_VIEW (tree_view), NULL);
|
||||
@ -95,9 +83,9 @@ switch_search_method (GtkWidget *button,
|
||||
|
||||
static void
|
||||
quit_cb (GtkWidget *widget,
|
||||
gpointer data)
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean *done = data;
|
||||
gboolean *done = user_data;
|
||||
|
||||
*done = TRUE;
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
/* Don't copy this bad example; inline RGB data is always a better
|
||||
* idea than inline XPMs.
|
||||
*/
|
||||
static char *book_closed_xpm[] = {
|
||||
static const char *book_closed_xpm[] = {
|
||||
"16 16 6 1",
|
||||
" c None s None",
|
||||
". c black",
|
||||
@ -132,7 +132,7 @@ typedef enum
|
||||
COLUMNS_LAST
|
||||
} ColumnsType;
|
||||
|
||||
static gchar *column_type_names[] = {
|
||||
static const char *column_type_names[] = {
|
||||
"No columns",
|
||||
"One column",
|
||||
"Many columns"
|
||||
@ -459,6 +459,8 @@ set_columns_type (GtkTreeView *tree_view, ColumnsType type)
|
||||
NULL);
|
||||
|
||||
gtk_tree_view_insert_column (GTK_TREE_VIEW (tree_view), col, 0);
|
||||
break;
|
||||
case COLUMNS_LAST:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -632,7 +634,7 @@ columns_selected (GtkComboBox *combo_box, gpointer data)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
on_row_activated (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
|
@ -267,17 +267,17 @@ gtk_focus_widget_class_init (GtkFocusWidgetClass *klass)
|
||||
|
||||
static void
|
||||
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);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *widget;
|
||||
|
@ -261,12 +261,12 @@ tick_cb (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_transform_tester_set_test_widget (GtkTransformTester *self,
|
||||
GtkWidget *test_widget)
|
||||
GtkWidget *widget)
|
||||
{
|
||||
g_assert (!self->test_widget);
|
||||
|
||||
self->test_widget = test_widget;
|
||||
gtk_widget_set_parent (test_widget, (GtkWidget *)self);
|
||||
self->test_widget = widget;
|
||||
gtk_widget_set_parent (widget, (GtkWidget *)self);
|
||||
|
||||
gtk_widget_add_tick_callback (GTK_WIDGET (self), tick_cb, NULL, NULL);
|
||||
}
|
||||
|
@ -280,11 +280,11 @@ static gboolean done = FALSE;
|
||||
|
||||
static void
|
||||
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);
|
||||
}
|
||||
@ -312,6 +312,8 @@ make_window (gint view_type)
|
||||
case 1:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Sorted list");
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
|
@ -317,6 +317,8 @@ on_update (GdkFrameClock *frame_clock,
|
||||
&refresh_interval, NULL);
|
||||
|
||||
pending_frame = peek_pending_frame ();
|
||||
g_assert (pending_frame);
|
||||
|
||||
if (stream_time_to_clock_time (pending_frame->stream_time)
|
||||
< predicted_presentation_time + refresh_interval / 2)
|
||||
{
|
||||
@ -341,6 +343,7 @@ on_update (GdkFrameClock *frame_clock,
|
||||
|
||||
n_frames++;
|
||||
displayed_frame = unqueue_frame ();
|
||||
g_assert (displayed_frame);
|
||||
displayed_frame->clock_time = stream_time_to_clock_time (displayed_frame->stream_time);
|
||||
|
||||
displayed_frame->frame_counter = gdk_frame_timings_get_frame_counter (timings);
|
||||
|
Loading…
Reference in New Issue
Block a user