2000-10-18 15:50:13 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include <demos.h>
|
|
|
|
|
|
|
|
static GtkTextBuffer *info_buffer;
|
|
|
|
static GtkTextBuffer *source_buffer;
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
static gchar *current_file = NULL;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
TITLE_COLUMN,
|
|
|
|
FILENAME_COLUMN,
|
|
|
|
FUNC_COLUMN,
|
|
|
|
ITALIC_COLUMN,
|
|
|
|
NUM_COLUMNS
|
|
|
|
};
|
2000-10-18 15:50:13 +00:00
|
|
|
|
2000-11-18 23:59:30 +00:00
|
|
|
typedef struct _CallbackData CallbackData;
|
|
|
|
struct _CallbackData
|
|
|
|
{
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreePath *path;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
window_closed_cb (GtkWidget *window, gpointer data)
|
|
|
|
{
|
|
|
|
CallbackData *cbdata = data;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gboolean italic;
|
|
|
|
|
|
|
|
gtk_tree_model_get_iter (cbdata->model, &iter, cbdata->path);
|
|
|
|
gtk_tree_store_get (GTK_TREE_STORE (cbdata->model), &iter,
|
|
|
|
ITALIC_COLUMN, &italic,
|
|
|
|
-1);
|
|
|
|
if (italic)
|
|
|
|
gtk_tree_store_set (GTK_TREE_STORE (cbdata->model), &iter,
|
|
|
|
ITALIC_COLUMN, !italic,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
gtk_tree_path_free (cbdata->path);
|
|
|
|
g_free (cbdata);
|
|
|
|
}
|
|
|
|
|
2000-10-18 15:50:13 +00:00
|
|
|
gboolean
|
|
|
|
read_line (FILE *stream, GString *str)
|
|
|
|
{
|
|
|
|
int n_read = 0;
|
|
|
|
|
|
|
|
flockfile (stream);
|
|
|
|
|
|
|
|
g_string_truncate (str, 0);
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
int c;
|
|
|
|
|
|
|
|
c = getc_unlocked (stream);
|
|
|
|
|
|
|
|
if (c == EOF)
|
|
|
|
goto done;
|
|
|
|
else
|
|
|
|
n_read++;
|
|
|
|
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case '\r':
|
|
|
|
case '\n':
|
|
|
|
{
|
|
|
|
int next_c = getc_unlocked (stream);
|
|
|
|
|
|
|
|
if (!(next_c == EOF ||
|
|
|
|
(c == '\r' && next_c == '\n') ||
|
|
|
|
(c == '\n' && next_c == '\r')))
|
|
|
|
ungetc (next_c, stream);
|
|
|
|
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
g_string_append_c (str, c);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
|
|
|
funlockfile (stream);
|
|
|
|
|
|
|
|
return n_read > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-10-26 00:36:47 +00:00
|
|
|
load_file (const gchar *filename)
|
2000-10-18 15:50:13 +00:00
|
|
|
{
|
|
|
|
FILE *file;
|
|
|
|
GtkTextIter start, end;
|
|
|
|
GString *buffer = g_string_new (NULL);
|
|
|
|
int state = 0;
|
|
|
|
gboolean in_para = 0;
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
if (current_file && !strcmp (current_file, filename))
|
2000-10-18 15:50:13 +00:00
|
|
|
return;
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
g_free (current_file);
|
|
|
|
current_file = g_strdup (filename);
|
2000-10-18 15:50:13 +00:00
|
|
|
|
|
|
|
gtk_text_buffer_get_bounds (info_buffer, &start, &end);
|
|
|
|
gtk_text_buffer_delete (info_buffer, &start, &end);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
|
|
|
gtk_text_buffer_delete (source_buffer, &start, &end);
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
file = fopen (filename, "r");
|
2000-11-13 04:36:38 +00:00
|
|
|
|
|
|
|
if (!file)
|
|
|
|
{
|
|
|
|
char *installed = g_strconcat (DEMOCODEDIR,
|
|
|
|
G_DIR_SEPARATOR_S,
|
|
|
|
filename,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
file = fopen (installed, "r");
|
|
|
|
|
|
|
|
g_free (installed);
|
|
|
|
}
|
|
|
|
|
2000-10-18 15:50:13 +00:00
|
|
|
if (!file)
|
|
|
|
{
|
2000-10-26 00:36:47 +00:00
|
|
|
g_warning ("Cannot open %s: %s\n", filename, g_strerror (errno));
|
2000-10-18 15:50:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (info_buffer, &start, 0);
|
|
|
|
while (read_line (file, buffer))
|
|
|
|
{
|
|
|
|
gchar *p = buffer->str;
|
|
|
|
gchar *q;
|
|
|
|
|
|
|
|
switch (state)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
/* Reading title */
|
|
|
|
while (*p == '/' || *p == '*' || isspace (*p))
|
|
|
|
p++;
|
|
|
|
q = p + strlen (p);
|
|
|
|
while (q > p && isspace (*(q - 1)))
|
|
|
|
q--;
|
|
|
|
|
|
|
|
if (q > p)
|
|
|
|
{
|
|
|
|
int len_chars = g_utf8_pointer_to_offset (p, q);
|
|
|
|
|
|
|
|
end = start;
|
|
|
|
|
|
|
|
g_assert (strlen (p) >= q - p);
|
|
|
|
gtk_text_buffer_insert (info_buffer, &end, p, q - p);
|
|
|
|
start = end;
|
|
|
|
|
|
|
|
gtk_text_iter_backward_chars (&start, len_chars);
|
|
|
|
gtk_text_buffer_apply_tag_by_name (info_buffer, "title", &start, &end);
|
|
|
|
|
|
|
|
start = end;
|
|
|
|
|
|
|
|
state++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
/* Reading body of info section */
|
|
|
|
while (isspace (*p))
|
|
|
|
p++;
|
|
|
|
if (*p == '*' && *(p + 1) == '/')
|
|
|
|
{
|
|
|
|
gtk_text_buffer_get_iter_at_offset (source_buffer, &start, 0);
|
|
|
|
state++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
|
|
|
|
while (*p == '*' || isspace (*p))
|
|
|
|
p++;
|
|
|
|
|
|
|
|
len = strlen (p);
|
|
|
|
while (isspace (*(p + len - 1)))
|
|
|
|
len--;
|
|
|
|
|
|
|
|
if (len > 0)
|
|
|
|
{
|
|
|
|
if (in_para)
|
|
|
|
gtk_text_buffer_insert (info_buffer, &start, " ", 1);
|
|
|
|
|
|
|
|
g_assert (strlen (p) >= len);
|
|
|
|
gtk_text_buffer_insert (info_buffer, &start, p, len);
|
|
|
|
in_para = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_text_buffer_insert (info_buffer, &start, "\n", 1);
|
|
|
|
in_para = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
/* Skipping blank lines */
|
|
|
|
while (isspace (*p))
|
|
|
|
p++;
|
|
|
|
if (*p)
|
|
|
|
{
|
|
|
|
p = buffer->str;
|
|
|
|
state++;
|
|
|
|
/* Fall through */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
/* Reading program body */
|
|
|
|
gtk_text_buffer_insert (source_buffer, &start, p, -1);
|
|
|
|
gtk_text_buffer_insert (info_buffer, &start, "\n", 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
|
|
|
gtk_text_buffer_apply_tag_by_name (info_buffer, "source", &start, &end);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2000-10-26 00:36:47 +00:00
|
|
|
button_press_event_cb (GtkTreeView *tree_view,
|
|
|
|
GdkEventButton *event,
|
|
|
|
GtkTreeModel *model)
|
2000-10-18 15:50:13 +00:00
|
|
|
{
|
2000-10-26 00:36:47 +00:00
|
|
|
if (event->type == GDK_2BUTTON_PRESS)
|
2000-10-18 15:50:13 +00:00
|
|
|
{
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreePath *path = NULL;
|
|
|
|
|
|
|
|
gtk_tree_view_get_path_at_pos (tree_view,
|
|
|
|
event->window,
|
|
|
|
event->x,
|
|
|
|
event->y,
|
|
|
|
&path,
|
2001-01-19 22:39:19 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2000-10-26 00:36:47 +00:00
|
|
|
NULL);
|
2000-10-18 15:50:13 +00:00
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
if (path)
|
2000-10-18 15:50:13 +00:00
|
|
|
{
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeIter iter;
|
|
|
|
gboolean italic;
|
2000-11-18 23:59:30 +00:00
|
|
|
GDoDemoFunc func;
|
|
|
|
GtkWidget *window;
|
2000-10-26 00:36:47 +00:00
|
|
|
|
|
|
|
gtk_tree_model_get_iter (model, &iter, path);
|
2000-10-27 23:34:58 +00:00
|
|
|
gtk_tree_store_get (GTK_TREE_STORE (model),
|
|
|
|
&iter,
|
|
|
|
FUNC_COLUMN, &func,
|
|
|
|
ITALIC_COLUMN, &italic,
|
|
|
|
-1);
|
|
|
|
gtk_tree_store_set (GTK_TREE_STORE (model),
|
|
|
|
&iter,
|
|
|
|
ITALIC_COLUMN, !italic,
|
|
|
|
-1);
|
2000-11-18 23:59:30 +00:00
|
|
|
window = (func) ();
|
|
|
|
if (window != NULL)
|
|
|
|
{
|
|
|
|
CallbackData *cbdata;
|
|
|
|
|
|
|
|
cbdata = g_new (CallbackData, 1);
|
|
|
|
cbdata->model = model;
|
|
|
|
cbdata->path = path;
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (window),
|
2000-12-16 07:01:48 +00:00
|
|
|
"destroy",
|
|
|
|
window_closed_cb,
|
|
|
|
cbdata);
|
2000-11-18 23:59:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
2000-10-18 15:50:13 +00:00
|
|
|
}
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
gtk_signal_emit_stop_by_name (GTK_OBJECT (tree_view),
|
|
|
|
"button_press_event");
|
2000-10-18 15:50:13 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
static void
|
|
|
|
selection_cb (GtkTreeSelection *selection,
|
|
|
|
GtkTreeModel *model)
|
2000-10-18 15:50:13 +00:00
|
|
|
{
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeIter iter;
|
|
|
|
GValue value = {0, };
|
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
|
2000-10-26 00:36:47 +00:00
|
|
|
return;
|
|
|
|
|
2000-10-27 23:34:58 +00:00
|
|
|
gtk_tree_model_get_value (model, &iter,
|
|
|
|
FILENAME_COLUMN,
|
|
|
|
&value);
|
2000-10-26 00:36:47 +00:00
|
|
|
load_file (g_value_get_string (&value));
|
|
|
|
g_value_unset (&value);
|
2000-10-18 15:50:13 +00:00
|
|
|
}
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
static GtkWidget *
|
2000-10-18 15:50:13 +00:00
|
|
|
create_text (GtkTextBuffer **buffer,
|
|
|
|
gboolean is_source)
|
|
|
|
{
|
|
|
|
GtkWidget *scrolled_window;
|
|
|
|
GtkWidget *text_view;
|
|
|
|
PangoFontDescription *font_desc;
|
|
|
|
|
|
|
|
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
|
|
|
GTK_POLICY_AUTOMATIC,
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
|
|
|
GTK_SHADOW_IN);
|
|
|
|
|
|
|
|
text_view = gtk_text_view_new ();
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
|
|
|
|
|
|
|
|
*buffer = gtk_text_buffer_new (NULL);
|
|
|
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), *buffer);
|
|
|
|
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
|
|
|
|
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
|
|
|
|
|
|
|
|
if (is_source)
|
|
|
|
{
|
|
|
|
font_desc = pango_font_description_from_string ("Courier 10");
|
|
|
|
gtk_widget_modify_font (text_view, font_desc);
|
|
|
|
pango_font_description_free (font_desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), !is_source);
|
|
|
|
|
|
|
|
return scrolled_window;
|
|
|
|
}
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
/* Technically a list, but if we do go to 80 demos, we may want to move to a tree */
|
|
|
|
static GtkWidget *
|
|
|
|
create_tree (void)
|
|
|
|
{
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
GtkCellRenderer *cell;
|
|
|
|
GtkWidget *tree_view;
|
2000-11-13 06:08:17 +00:00
|
|
|
GtkTreeViewColumn *column;
|
|
|
|
GtkTreeStore *model;
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeIter iter;
|
|
|
|
gint i;
|
|
|
|
|
2000-11-10 19:38:53 +00:00
|
|
|
model = gtk_tree_store_new_with_types (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
|
2000-10-26 00:36:47 +00:00
|
|
|
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
|
|
|
|
2001-01-05 19:09:38 +00:00
|
|
|
gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection),
|
2000-10-26 00:36:47 +00:00
|
|
|
GTK_TREE_SELECTION_SINGLE);
|
|
|
|
gtk_widget_set_usize (tree_view, 200, -1);
|
|
|
|
|
|
|
|
for (i=0; i < G_N_ELEMENTS (testgtk_demos); i++)
|
|
|
|
{
|
2000-10-27 23:34:58 +00:00
|
|
|
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
|
|
|
|
|
|
|
|
gtk_tree_store_set (GTK_TREE_STORE (model),
|
|
|
|
&iter,
|
|
|
|
TITLE_COLUMN, testgtk_demos[i].title,
|
|
|
|
FILENAME_COLUMN, testgtk_demos[i].filename,
|
|
|
|
FUNC_COLUMN, testgtk_demos[i].func,
|
|
|
|
ITALIC_COLUMN, FALSE,
|
|
|
|
-1);
|
2000-10-26 00:36:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cell = gtk_cell_renderer_text_new ();
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
|
|
|
g_object_set (G_OBJECT (cell),
|
|
|
|
"style", PANGO_STYLE_ITALIC,
|
|
|
|
NULL);
|
|
|
|
|
2000-11-13 06:08:17 +00:00
|
|
|
column = gtk_tree_view_column_new_with_attributes ("Widget (double click for demo)",
|
2000-10-26 00:36:47 +00:00
|
|
|
cell,
|
|
|
|
"text", TITLE_COLUMN,
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
"style_set", ITALIC_COLUMN,
|
2000-10-26 00:36:47 +00:00
|
|
|
NULL);
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
|
|
|
|
GTK_TREE_VIEW_COLUMN (column));
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (selection), "selection_changed", selection_cb, model);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (tree_view), "button_press_event", GTK_SIGNAL_FUNC (button_press_event_cb), model);
|
|
|
|
|
|
|
|
return tree_view;
|
|
|
|
}
|
|
|
|
|
2000-10-18 15:50:13 +00:00
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *notebook;
|
|
|
|
GtkWidget *hbox;
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkWidget *tree;
|
2000-10-18 15:50:13 +00:00
|
|
|
GtkTextTag *tag;
|
|
|
|
|
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
|
|
|
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), hbox);
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
tree = create_tree ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), tree, FALSE, FALSE, 0);
|
2000-10-18 15:50:13 +00:00
|
|
|
|
|
|
|
notebook = gtk_notebook_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
|
|
|
create_text (&info_buffer, FALSE),
|
|
|
|
gtk_label_new ("Info"));
|
|
|
|
|
|
|
|
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
|
|
|
create_text (&source_buffer, TRUE),
|
|
|
|
gtk_label_new ("Source"));
|
|
|
|
|
|
|
|
tag = gtk_text_buffer_create_tag (info_buffer, "title");
|
2000-12-16 07:01:48 +00:00
|
|
|
g_object_set (G_OBJECT (tag),
|
|
|
|
"font", "Sans 18",
|
|
|
|
NULL);
|
2000-10-18 15:50:13 +00:00
|
|
|
|
|
|
|
tag = gtk_text_buffer_create_tag (info_buffer, "source");
|
2000-12-16 07:01:48 +00:00
|
|
|
g_object_set (G_OBJECT (tag),
|
|
|
|
"font", "Courier 10",
|
|
|
|
"pixels_above_lines", 0,
|
|
|
|
"pixels_below_lines", 0,
|
|
|
|
NULL);
|
2000-10-18 15:50:13 +00:00
|
|
|
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
|
|
|
gtk_widget_show_all (window);
|
|
|
|
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
load_file (testgtk_demos[0].filename);
|
2000-10-18 15:50:13 +00:00
|
|
|
|
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|