~ubuntu-branches/ubuntu/gutsy/wireshark/gutsy-security

« back to all changes in this revision

Viewing changes to gtk/dlg_utils.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2007-04-01 08:58:40 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070401085840-or3qhrpv8alt1bwg
Tags: 0.99.5-1
* New upstream release.
* debian/patches/09_idl2wrs.dpatch: updated to patch idl2wrs.sh.in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* dlg_utils.c
2
2
 * Utilities to use when constructing dialogs
3
3
 *
4
 
 * $Id: dlg_utils.c 19029 2006-08-25 19:13:02Z ulfl $
 
4
 * $Id: dlg_utils.c 20525 2007-01-22 22:55:08Z gerald $
5
5
 *
6
6
 * Wireshark - Network traffic analyzer
7
7
 * By Gerald Combs <gerald@wireshark.org>
29
29
#include <gtk/gtk.h>
30
30
#include <gdk/gdkkeysyms.h>
31
31
 
32
 
#if 0
33
 
#include <epan/filesystem.h>
34
 
#endif
35
 
 
36
 
#if 0
37
 
#include "globals.h"
38
 
#endif
39
 
 
40
32
#include "gtkglobals.h"
41
33
#include "gui_utils.h"
42
34
#include "dlg_utils.h"
43
35
#include "compat_macros.h"
44
 
#if 0
45
 
#include "main.h"
46
 
#endif
47
36
 
48
37
#include <string.h>
49
 
#if 0
50
 
#include <stdio.h>
51
 
#endif
52
38
#include <stdarg.h>
53
39
 
54
40
static void
68
54
    return button;
69
55
}
70
56
 
 
57
/*
 
58
 * Set the focus and default for the nth item in a button row, with
 
59
 * 0 being the first item.
 
60
 */
 
61
#define BUTTON_HBOX_KEY "button_hbox"
 
62
void
 
63
dlg_button_focus_nth(GtkWidget *hbox, gint focus_item) {
 
64
    GtkWidget *button_hbox, *button;
 
65
    GList *children;
 
66
    gint cur_item = 0;
 
67
 
 
68
    if (!hbox)
 
69
        return;
 
70
 
 
71
    button_hbox = OBJECT_GET_DATA(hbox, BUTTON_HBOX_KEY);
 
72
    children = gtk_container_children(GTK_CONTAINER(button_hbox));
 
73
 
 
74
    while (children) {
 
75
        if (cur_item == focus_item) {
 
76
            button = children->data;
 
77
            gtk_widget_grab_focus(button);
 
78
            gtk_widget_grab_default(button);
 
79
            break;
 
80
        }
 
81
        children = g_list_next(children);
 
82
        cur_item++;
 
83
    }
 
84
 
 
85
    g_list_free(children);
 
86
}
71
87
 
72
88
/* create a button row for a dialog */
73
89
 
74
 
/* The purpose of this is, to have one place available, where all button rows 
 
90
/* The purpose of this is, to have one place available, where all button rows
75
91
 * from all dialogs are laid out. This will:
76
92
 *
77
93
 * a.) keep the button layout more consistent over the different dialogs
123
139
        } else if (strcmp(stock_id, GTK_STOCK_SAVE) == 0) {
124
140
            save = stock_id;
125
141
        } else if (strcmp(stock_id, WIRESHARK_STOCK_DONT_SAVE) == 0) {
126
 
                dont_save = stock_id;  
 
142
                dont_save = stock_id;
127
143
        } else if (strcmp(stock_id, GTK_STOCK_CANCEL) == 0) {
128
144
            cancel = stock_id;
129
145
        } else if (strcmp(stock_id, GTK_STOCK_CLOSE) == 0) {
166
182
 
167
183
    button_hbox = gtk_hbutton_box_new();
168
184
    gtk_box_pack_end(GTK_BOX(hbox), button_hbox, TRUE, TRUE, 0);
 
185
    OBJECT_SET_DATA(hbox, BUTTON_HBOX_KEY, button_hbox);
169
186
    gtk_widget_show(button_hbox);
170
187
 
171
188
    help_hbox = gtk_hbutton_box_new();