forked from osmocom/wireshark
Have routines to create GtkCTrees, set their line and expander style
based on the user's UI preferences, and add them to a list of GtkCTrees. Use those routines to create all GtkCTrees. Have a routine to update the preferences for all of those GtkCTrees. Call that routine whenever the preferences change. Label the line and expander style preferences as "Tree line style" and "Tree expander style", as they no longer apply only to protocol trees. Move the routines to maintain a list of scrolled windows, and to update scrollbar placement for scrolled windows, to "ui_util.c". svn path=/trunk/; revision=4520
This commit is contained in:
parent
fc53c2b7b3
commit
e592fa4a6b
|
@ -4,10 +4,10 @@
|
|||
* expression, testing a particular field; display the tree of fields
|
||||
* and the relations and values with which it can be compared.
|
||||
*
|
||||
* Copyright 2000, Jeffrey C. Foster<jfoste@woodward.com> and
|
||||
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> and
|
||||
* Guy Harris <guy@alum.mit.edu>
|
||||
*
|
||||
* $Id: dfilter_expr_dlg.c,v 1.23 2001/08/21 06:39:18 guy Exp $
|
||||
* $Id: dfilter_expr_dlg.c,v 1.24 2002/01/11 06:43:17 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -57,9 +57,7 @@
|
|||
# include "snprintf.h"
|
||||
#endif
|
||||
|
||||
#include "prefs.h"
|
||||
#include "globals.h"
|
||||
#include "gtkglobals.h"
|
||||
#include "main.h"
|
||||
#include "ui_util.h"
|
||||
#include "simple_dialog.h"
|
||||
|
@ -974,8 +972,7 @@ dfilter_expr_dlg_new(GtkWidget *filter_te)
|
|||
gtk_box_pack_start(GTK_BOX(col1_vb), tree_scrolled_win, FALSE, FALSE, 0);
|
||||
gtk_widget_show(tree_scrolled_win);
|
||||
|
||||
tree = gtk_ctree_new(1, 0);
|
||||
gtk_ctree_set_line_style(GTK_CTREE(tree), GTK_CTREE_LINES_NONE);
|
||||
tree = ctree_new(1, 0);
|
||||
gtk_signal_connect(GTK_OBJECT(tree), "tree-select-row",
|
||||
GTK_SIGNAL_FUNC(field_select_row_cb), tree);
|
||||
gtk_container_add(GTK_CONTAINER(tree_scrolled_win), tree);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* gtkglobals.h
|
||||
* GTK-related Global defines, etc.
|
||||
*
|
||||
* $Id: gtkglobals.h,v 1.16 2001/06/05 07:38:37 guy Exp $
|
||||
* $Id: gtkglobals.h,v 1.17 2002/01/11 06:43:17 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -34,10 +34,6 @@ extern GdkFont *m_r_font, *m_b_font;
|
|||
extern guint m_font_height, m_font_width;
|
||||
|
||||
extern GtkStyle *item_style;
|
||||
void set_scrollbar_placement_scrollw(GtkWidget *, int); /* 0=left, 1=right */
|
||||
void set_scrollbar_placement_all(int); /* 1=right, 0=left */
|
||||
void remember_scrolled_window(GtkWidget *);
|
||||
|
||||
|
||||
void set_plist_sel_browse(gboolean);
|
||||
void set_plist_font(GdkFont *font);
|
||||
|
@ -62,5 +58,4 @@ void set_plist_font(GdkFont *font);
|
|||
#define isprint(c) (c >= 0x20 && c <= 0x7f)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* gui_prefs.c
|
||||
* Dialog box for GUI preferences
|
||||
*
|
||||
* $Id: gui_prefs.c,v 1.28 2002/01/10 07:43:39 guy Exp $
|
||||
* $Id: gui_prefs.c,v 1.29 2002/01/11 06:43:17 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -172,14 +172,14 @@ gui_prefs_show(void)
|
|||
"Protocol tree mouse behavior:", selection_mode_vals,
|
||||
prefs.gui_ptree_sel_browse);
|
||||
|
||||
/* Proto tree line style */
|
||||
/* Tree line style */
|
||||
create_option_menu(main_vb, PTREE_LINE_STYLE_KEY, main_tb, 3,
|
||||
"Protocol tree line style:", line_style_vals,
|
||||
"Tree line style:", line_style_vals,
|
||||
prefs.gui_ptree_line_style);
|
||||
|
||||
/* Proto tree expander style */
|
||||
/* Tree expander style */
|
||||
create_option_menu(main_vb, PTREE_EXPANDER_STYLE_KEY, main_tb, 4,
|
||||
"Protocol tree expander style:", expander_style_vals,
|
||||
"Tree expander style:", expander_style_vals,
|
||||
prefs.gui_ptree_expander_style);
|
||||
|
||||
/* Hex Dump highlight style */
|
||||
|
@ -517,8 +517,8 @@ gui_prefs_apply(GtkWidget *w)
|
|||
set_scrollbar_placement_all(prefs.gui_scrollbar_on_right);
|
||||
set_plist_sel_browse(prefs.gui_plist_sel_browse);
|
||||
set_ptree_sel_browse_all(prefs.gui_ptree_sel_browse);
|
||||
set_ptree_line_style_all(prefs.gui_ptree_line_style);
|
||||
set_ptree_expander_style_all(prefs.gui_ptree_expander_style);
|
||||
set_ctree_styles_all(prefs.gui_ptree_line_style,
|
||||
prefs.gui_ptree_expander_style);
|
||||
if (colors_changed)
|
||||
update_marked_frames();
|
||||
|
||||
|
|
56
gtk/main.c
56
gtk/main.c
|
@ -1,6 +1,6 @@
|
|||
/* main.c
|
||||
*
|
||||
* $Id: main.c,v 1.225 2002/01/10 11:05:50 guy Exp $
|
||||
* $Id: main.c,v 1.226 2002/01/11 06:43:17 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -577,60 +577,6 @@ void resolve_name_cb(GtkWidget *widget, gpointer data) {
|
|||
}
|
||||
}
|
||||
|
||||
/* Set the scrollbar placement of a scrolled window based upon pos value:
|
||||
0 = left, 1 = right */
|
||||
void
|
||||
set_scrollbar_placement_scrollw(GtkWidget *scrollw, int pos) /* 0=left, 1=right */
|
||||
{
|
||||
if (pos) {
|
||||
gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW(scrollw),
|
||||
GTK_CORNER_TOP_LEFT);
|
||||
} else {
|
||||
gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW(scrollw),
|
||||
GTK_CORNER_TOP_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
/* List of all scrolled windows, so we can globally set the scrollbar
|
||||
placement of them. */
|
||||
static GList *scrolled_windows;
|
||||
|
||||
/* Add a scrolled window to the list of scrolled windows. */
|
||||
static void forget_scrolled_window(GtkWidget *scrollw, gpointer data);
|
||||
|
||||
void
|
||||
remember_scrolled_window(GtkWidget *scrollw)
|
||||
{
|
||||
scrolled_windows = g_list_append(scrolled_windows, scrollw);
|
||||
|
||||
/* Catch the "destroy" event on the widget, so that we remove it from
|
||||
the list when it's destroyed. */
|
||||
gtk_signal_connect(GTK_OBJECT(scrollw), "destroy",
|
||||
GTK_SIGNAL_FUNC(forget_scrolled_window), NULL);
|
||||
}
|
||||
|
||||
/* Remove a scrolled window from the list of scrolled windows. */
|
||||
static void
|
||||
forget_scrolled_window(GtkWidget *scrollw, gpointer data)
|
||||
{
|
||||
scrolled_windows = g_list_remove(scrolled_windows, scrollw);
|
||||
}
|
||||
|
||||
static void
|
||||
set_scrollbar_placement_cb(gpointer data, gpointer user_data)
|
||||
{
|
||||
set_scrollbar_placement_scrollw((GtkWidget *)data,
|
||||
*(int *)user_data);
|
||||
}
|
||||
|
||||
/* Set the scrollbar placement of all scrolled windows based on pos value:
|
||||
0 = left, 1 = right */
|
||||
void
|
||||
set_scrollbar_placement_all(int pos)
|
||||
{
|
||||
g_list_foreach(scrolled_windows, set_scrollbar_placement_cb, &pos);
|
||||
}
|
||||
|
||||
/* Set the selection mode of the packet list window. */
|
||||
void
|
||||
set_plist_sel_browse(gboolean val)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* prefs_dlg.c
|
||||
* Routines for handling preferences
|
||||
*
|
||||
* $Id: prefs_dlg.c,v 1.35 2002/01/10 07:43:39 guy Exp $
|
||||
* $Id: prefs_dlg.c,v 1.36 2002/01/11 06:43:18 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -48,7 +48,6 @@
|
|||
#include <epan/filesystem.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "gtkglobals.h"
|
||||
#include "packet.h"
|
||||
#include "file.h"
|
||||
#include "prefs.h"
|
||||
|
@ -318,19 +317,10 @@ prefs_cb(GtkWidget *w, gpointer dummy) {
|
|||
gtk_container_add(GTK_CONTAINER(top_hb), ct_sb);
|
||||
gtk_widget_show(ct_sb);
|
||||
|
||||
cts.ctree = gtk_ctree_new(1, 0);
|
||||
cts.ctree = ctree_new(1, 0);
|
||||
cts.page = 0;
|
||||
gtk_container_add(GTK_CONTAINER(ct_sb), cts.ctree);
|
||||
|
||||
/* Be consistent with our line/expander styles */
|
||||
g_assert(prefs.gui_ptree_line_style >= GTK_CTREE_LINES_NONE &&
|
||||
prefs.gui_ptree_line_style <= GTK_CTREE_LINES_TABBED);
|
||||
gtk_ctree_set_line_style(GTK_CTREE(cts.ctree), prefs.gui_ptree_line_style);
|
||||
g_assert(prefs.gui_ptree_expander_style >= GTK_CTREE_EXPANDER_NONE &&
|
||||
prefs.gui_ptree_expander_style <= GTK_CTREE_EXPANDER_CIRCULAR);
|
||||
gtk_ctree_set_expander_style(GTK_CTREE(cts.ctree),
|
||||
prefs.gui_ptree_expander_style);
|
||||
|
||||
gtk_clist_set_column_auto_resize(GTK_CLIST(cts.ctree), 0, TRUE);
|
||||
gtk_signal_connect(GTK_OBJECT(cts.ctree), "tree-select-row",
|
||||
GTK_SIGNAL_FUNC(prefs_tree_select_cb), NULL);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* proto_draw.c
|
||||
* Routines for GTK+ packet display
|
||||
*
|
||||
* $Id: proto_draw.c,v 1.42 2001/12/18 19:09:08 gram Exp $
|
||||
* $Id: proto_draw.c,v 1.43 2002/01/11 06:43:18 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -56,6 +56,7 @@
|
|||
#include "prefs.h"
|
||||
#include "proto_draw.h"
|
||||
#include "packet_win.h"
|
||||
#include "ui_util.h"
|
||||
#include "gtkglobals.h"
|
||||
|
||||
|
||||
|
@ -717,7 +718,7 @@ packet_hex_reprint(GtkText *bv){
|
|||
|
||||
|
||||
/* List of all protocol tree widgets, so we can globally set the selection
|
||||
mode, line style, expander style, and font of all of them. */
|
||||
mode and font of all of them. */
|
||||
static GList *ptree_widgets;
|
||||
|
||||
/* Add a protocol tree widget to the list of protocol tree widgets. */
|
||||
|
@ -771,55 +772,6 @@ set_ptree_sel_browse_all(gboolean val)
|
|||
g_list_foreach(ptree_widgets, set_ptree_sel_browse_cb, &val);
|
||||
}
|
||||
|
||||
/* Set the line style of a given packet tree window. */
|
||||
static void
|
||||
set_ptree_line_style(GtkWidget *ptreew, gint style)
|
||||
{
|
||||
/* I'm using an assert here since the preferences code limits
|
||||
* the user input, both in the GUI and when reading the preferences file.
|
||||
* If the value is incorrect, it's a program error, not a user-initiated error.
|
||||
*/
|
||||
g_assert(style >= GTK_CTREE_LINES_NONE && style <= GTK_CTREE_LINES_TABBED);
|
||||
gtk_ctree_set_line_style(GTK_CTREE(ptreew), style);
|
||||
}
|
||||
|
||||
static void
|
||||
set_ptree_line_style_cb(gpointer data, gpointer user_data)
|
||||
{
|
||||
set_ptree_line_style((GtkWidget *)data, *(gint *)user_data);
|
||||
}
|
||||
|
||||
/* Set the line style of all packet tree window. */
|
||||
void
|
||||
set_ptree_line_style_all(gint style)
|
||||
{
|
||||
g_list_foreach(ptree_widgets, set_ptree_line_style_cb, &style);
|
||||
}
|
||||
|
||||
/* Set the expander style of a given packet tree window. */
|
||||
static void
|
||||
set_ptree_expander_style(GtkWidget *ptreew, gint style)
|
||||
{
|
||||
/* I'm using an assert here since the preferences code limits
|
||||
* the user input, both in the GUI and when reading the preferences file.
|
||||
* If the value is incorrect, it's a program error, not a user-initiated error.
|
||||
*/
|
||||
g_assert(style >= GTK_CTREE_EXPANDER_NONE && style <= GTK_CTREE_EXPANDER_CIRCULAR);
|
||||
gtk_ctree_set_expander_style(GTK_CTREE(ptreew), style);
|
||||
}
|
||||
|
||||
static void
|
||||
set_ptree_expander_style_cb(gpointer data, gpointer user_data)
|
||||
{
|
||||
set_ptree_expander_style((GtkWidget *)data, *(gint *)user_data);
|
||||
}
|
||||
|
||||
void
|
||||
set_ptree_expander_style_all(gint style)
|
||||
{
|
||||
g_list_foreach(ptree_widgets, set_ptree_expander_style_cb, &style);
|
||||
}
|
||||
|
||||
static void
|
||||
set_ptree_style_cb(gpointer data, gpointer user_data)
|
||||
{
|
||||
|
@ -859,7 +811,7 @@ create_tree_view(gint tv_size, e_prefs *prefs, GtkWidget *pane,
|
|||
gtk_widget_set_usize(tv_scrollw, -1, tv_size);
|
||||
gtk_widget_show(tv_scrollw);
|
||||
|
||||
tree_view = gtk_ctree_new(1, 0);
|
||||
tree_view = ctree_new(1, 0);
|
||||
gtk_signal_connect( GTK_OBJECT(tree_view), "key-press-event",
|
||||
(GtkSignalFunc) toggle_tree, NULL );
|
||||
gtk_signal_connect( GTK_OBJECT(tree_view), "tree-expand",
|
||||
|
@ -871,8 +823,6 @@ create_tree_view(gint tv_size, e_prefs *prefs, GtkWidget *pane,
|
|||
gtk_clist_set_column_auto_resize( GTK_CLIST(tree_view), 0, TRUE );
|
||||
gtk_container_add( GTK_CONTAINER(tv_scrollw), tree_view );
|
||||
set_ptree_sel_browse(tree_view, prefs->gui_ptree_sel_browse);
|
||||
set_ptree_line_style(tree_view, prefs->gui_ptree_line_style);
|
||||
set_ptree_expander_style(tree_view, prefs->gui_ptree_expander_style);
|
||||
gtk_widget_set_style(tree_view, item_style);
|
||||
remember_ptree_widget(tree_view);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* proto_draw.h
|
||||
* Definitions for GTK+ packet display structures and routines
|
||||
*
|
||||
* $Id: proto_draw.h,v 1.14 2001/11/20 10:37:16 guy Exp $
|
||||
* $Id: proto_draw.h,v 1.15 2002/01/11 06:43:18 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -61,8 +61,6 @@ void expand_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view);
|
|||
void collapse_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view);
|
||||
|
||||
void set_ptree_sel_browse_all(gboolean);
|
||||
void set_ptree_line_style_all(gint style);
|
||||
void set_ptree_expander_style_all(gint style);
|
||||
void set_ptree_font_all(GdkFont *font);
|
||||
|
||||
void clear_tree_and_hex_views(void);
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
/* proto_hier_stats_dlg.c
|
||||
*
|
||||
* $Id: proto_hier_stats_dlg.c,v 1.7 2001/12/31 20:40:34 gerald Exp $
|
||||
* $Id: proto_hier_stats_dlg.c,v 1.8 2002/01/11 06:43:18 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
|
@ -136,10 +135,9 @@ create_tree(GtkWidget *container, ph_stats_t *ps)
|
|||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add(GTK_CONTAINER(container), sw);
|
||||
|
||||
tree = gtk_ctree_new_with_titles(NUM_STAT_COLUMNS, 0, column_titles);
|
||||
tree = ctree_new_with_titles(NUM_STAT_COLUMNS, 0, column_titles);
|
||||
|
||||
/* XXX - get 'pos' to set vertical scroll-bar placement. */
|
||||
/* XXX - set line style from preferences ???. */
|
||||
|
||||
/* The title bars do nothing. */
|
||||
gtk_clist_column_titles_passive(GTK_CLIST(tree));
|
||||
|
|
148
gtk/ui_util.c
148
gtk/ui_util.c
|
@ -1,12 +1,11 @@
|
|||
/* ui_util.c
|
||||
* UI utility routines
|
||||
*
|
||||
* $Id: ui_util.c,v 1.6 2001/12/13 09:26:15 guy Exp $
|
||||
* $Id: ui_util.c,v 1.7 2002/01/11 06:43:18 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,6 +32,7 @@
|
|||
|
||||
#include "gtkglobals.h"
|
||||
#include "ui_util.h"
|
||||
#include "prefs.h"
|
||||
#include "../ui_util.h"
|
||||
#include "image/eicon3d16.xpm"
|
||||
|
||||
|
@ -133,3 +133,145 @@ window_icon_realize_cb (GtkWidget *win, gpointer data)
|
|||
gdk_window_set_icon (win->window, NULL, icon_pmap, icon_mask);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* List of all scrolled windows, so we can globally set the scrollbar
|
||||
placement of all of them. */
|
||||
static GList *scrolled_windows;
|
||||
|
||||
static void forget_scrolled_window(GtkWidget *scrollw, gpointer data);
|
||||
|
||||
/* Add a scrolled window to the list of scrolled windows. */
|
||||
void
|
||||
remember_scrolled_window(GtkWidget *scrollw)
|
||||
{
|
||||
scrolled_windows = g_list_append(scrolled_windows, scrollw);
|
||||
|
||||
/* Catch the "destroy" event on the widget, so that we remove it from
|
||||
the list when it's destroyed. */
|
||||
gtk_signal_connect(GTK_OBJECT(scrollw), "destroy",
|
||||
GTK_SIGNAL_FUNC(forget_scrolled_window), NULL);
|
||||
}
|
||||
|
||||
/* Remove a scrolled window from the list of scrolled windows. */
|
||||
static void
|
||||
forget_scrolled_window(GtkWidget *scrollw, gpointer data)
|
||||
{
|
||||
scrolled_windows = g_list_remove(scrolled_windows, scrollw);
|
||||
}
|
||||
|
||||
/* Set the scrollbar placement of a scrolled window based upon pos value:
|
||||
0 = left, 1 = right */
|
||||
void
|
||||
set_scrollbar_placement_scrollw(GtkWidget *scrollw, int pos) /* 0=left, 1=right */
|
||||
{
|
||||
if (pos) {
|
||||
gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW(scrollw),
|
||||
GTK_CORNER_TOP_LEFT);
|
||||
} else {
|
||||
gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW(scrollw),
|
||||
GTK_CORNER_TOP_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_scrollbar_placement_cb(gpointer data, gpointer user_data)
|
||||
{
|
||||
set_scrollbar_placement_scrollw((GtkWidget *)data, *(int *)user_data);
|
||||
}
|
||||
|
||||
/* Set the scrollbar placement of all scrolled windows based on pos value:
|
||||
0 = left, 1 = right */
|
||||
void
|
||||
set_scrollbar_placement_all(int pos)
|
||||
{
|
||||
g_list_foreach(scrolled_windows, set_scrollbar_placement_cb, &pos);
|
||||
}
|
||||
|
||||
/* List of all GtkCTrees, so we can globally set the line and expander style
|
||||
of all of them. */
|
||||
static GList *ctrees;
|
||||
|
||||
static void setup_ctree(GtkWidget *ctree);
|
||||
static void forget_ctree(GtkWidget *ctree, gpointer data);
|
||||
static void set_ctree_styles(GtkWidget *ctree, gint line_style,
|
||||
gint expander_style);
|
||||
|
||||
/* Create a GtkCTree, give it the right styles, and remember it. */
|
||||
GtkWidget *
|
||||
ctree_new(gint columns, gint tree_column)
|
||||
{
|
||||
GtkWidget *ctree;
|
||||
|
||||
ctree = gtk_ctree_new(columns, tree_column);
|
||||
setup_ctree(ctree);
|
||||
return ctree;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
ctree_new_with_titles(gint columns, gint tree_column, gchar *titles[])
|
||||
{
|
||||
GtkWidget *ctree;
|
||||
|
||||
ctree = gtk_ctree_new_with_titles(columns, tree_column, titles);
|
||||
setup_ctree(ctree);
|
||||
return ctree;
|
||||
}
|
||||
|
||||
/* Set a GtkCTree's styles and add it to the list of GtkCTrees. */
|
||||
static void
|
||||
setup_ctree(GtkWidget *ctree)
|
||||
{
|
||||
set_ctree_styles(ctree, prefs.gui_ptree_line_style,
|
||||
prefs.gui_ptree_expander_style);
|
||||
|
||||
ctrees = g_list_append(ctrees, ctree);
|
||||
|
||||
/* Catch the "destroy" event on the widget, so that we remove it from
|
||||
the list when it's destroyed. */
|
||||
gtk_signal_connect(GTK_OBJECT(ctree), "destroy",
|
||||
GTK_SIGNAL_FUNC(forget_ctree), NULL);
|
||||
}
|
||||
|
||||
/* Remove a GtkCTree from the list of GtkCTrees. */
|
||||
static void
|
||||
forget_ctree(GtkWidget *ctree, gpointer data)
|
||||
{
|
||||
ctrees = g_list_remove(ctrees, ctree);
|
||||
}
|
||||
|
||||
/* Set the styles of a GtkCTree based upon style values. */
|
||||
typedef struct {
|
||||
gint line_style;
|
||||
gint expander_style;
|
||||
} ctree_style_arg_t;
|
||||
|
||||
static void
|
||||
set_ctree_styles(GtkWidget *ctree, gint line_style, gint expander_style)
|
||||
{
|
||||
g_assert(line_style >= GTK_CTREE_LINES_NONE &&
|
||||
line_style <= GTK_CTREE_LINES_TABBED);
|
||||
gtk_ctree_set_line_style(GTK_CTREE(ctree), line_style);
|
||||
g_assert(expander_style >= GTK_CTREE_EXPANDER_NONE &&
|
||||
expander_style <= GTK_CTREE_EXPANDER_CIRCULAR);
|
||||
gtk_ctree_set_expander_style(GTK_CTREE(ctree), expander_style);
|
||||
}
|
||||
|
||||
static void
|
||||
set_ctree_styles_cb(gpointer data, gpointer user_data)
|
||||
{
|
||||
ctree_style_arg_t *styles = user_data;
|
||||
|
||||
set_ctree_styles((GtkWidget *)data, styles->line_style,
|
||||
styles->expander_style);
|
||||
}
|
||||
|
||||
/* Set the styles of all GtkCTrees based upon style values. */
|
||||
void
|
||||
set_ctree_styles_all(gint line_style, gint expander_style)
|
||||
{
|
||||
ctree_style_arg_t styles;
|
||||
|
||||
styles.line_style = line_style;
|
||||
styles.expander_style = expander_style;
|
||||
g_list_foreach(ctrees, set_ctree_styles_cb, &styles);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
/* ui_util.h
|
||||
* Definitions for UI utility routines
|
||||
*
|
||||
* $Id: ui_util.h,v 1.2 2001/12/12 21:38:59 gerald Exp $
|
||||
* $Id: ui_util.h,v 1.3 2002/01/11 06:43:18 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -36,4 +35,23 @@ void reactivate_window(GtkWidget *);
|
|||
/* Set the window icon to the 16x16 3D icon. */
|
||||
void window_icon_realize_cb (GtkWidget *, gpointer);
|
||||
|
||||
/* Add a scrolled window to the list of scrolled windows. */
|
||||
void remember_scrolled_window(GtkWidget *);
|
||||
|
||||
/* Set the scrollbar placement of a scrolled window based upon pos value:
|
||||
0 = left, 1 = right */
|
||||
void set_scrollbar_placement_scrollw(GtkWidget *, int); /* 0=left, 1=right */
|
||||
|
||||
/* Set the scrollbar placement of all scrolled windows based on pos value:
|
||||
0 = left, 1 = right */
|
||||
void set_scrollbar_placement_all(int); /* 1=right, 0=left */
|
||||
|
||||
/* Create a GtkCTree, give it the right styles, and remember it. */
|
||||
GtkWidget *ctree_new(gint columns, gint tree_column);
|
||||
GtkWidget *ctree_new_with_titles(gint columns, gint tree_column,
|
||||
gchar *titles[]);
|
||||
|
||||
/* Set the styles of all GtkCTrees based upon style values. */
|
||||
void set_ctree_styles_all(gint, gint);
|
||||
|
||||
#endif /* __GTKGUIUI_UTIL_H__ */
|
||||
|
|
Loading…
Reference in New Issue