File: hozgtk_i.c

package info (click to toggle)
hoz 1.65-3
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 444 kB
  • sloc: ansic: 4,299; makefile: 148; sh: 48
file content (299 lines) | stat: -rwxr-xr-x 12,009 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
/*
 * DO NOT EDIT THIS FILE - it is generated by Glade.
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>

#include "hozgtk_c.h"
#include "hozgtk_i.h"
#include "hozgtk_s.h"

#define GLADE_HOOKUP_OBJECT(component,widget,name) \
  g_object_set_data_full (G_OBJECT (component), name, \
    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)

#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
  g_object_set_data (G_OBJECT (component), name, widget)

GtkWidget*
create_window_hoz (void)
{
  GtkWidget *window_hoz;
  GtkWidget *fixed_hoz;
  GtkWidget *entry_outp;
  GtkWidget *entry_size;
  GtkWidget *checkbutton_prgr;
  GtkWidget *scrolledwindow_rprt;
  GtkWidget *textview_rprt;
  GtkWidget *label_outp;
  GtkWidget *label_size;
  GtkWidget *button_paste;
  GtkWidget *button_cut;
  GtkWidget *combo_size;
  GList *combo_size_items = NULL;
  GtkWidget *combo_entry_size;

  window_hoz = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_size_request (window_hoz, 405, 470);
  gtk_window_set_title (GTK_WINDOW (window_hoz), "window_hoz");
  gtk_window_set_position (GTK_WINDOW (window_hoz), GTK_WIN_POS_CENTER);
  gtk_window_set_resizable (GTK_WINDOW (window_hoz), FALSE);
  gtk_window_set_destroy_with_parent (GTK_WINDOW (window_hoz), TRUE);

  fixed_hoz = gtk_fixed_new ();
  gtk_widget_show (fixed_hoz);
  gtk_container_add (GTK_CONTAINER (window_hoz), fixed_hoz);

  entry_outp = gtk_entry_new ();
  gtk_widget_show (entry_outp);
  gtk_fixed_put (GTK_FIXED (fixed_hoz), entry_outp, 104, 40);
  gtk_widget_set_size_request (entry_outp, 192, 24);

  entry_size = gtk_entry_new ();
  gtk_widget_show (entry_size);
  gtk_fixed_put (GTK_FIXED (fixed_hoz), entry_size, 104, 8);
  gtk_widget_set_size_request (entry_size, 104, 24);

  checkbutton_prgr = gtk_check_button_new_with_mnemonic ("checkbutton__prgr");
  gtk_widget_show (checkbutton_prgr);
  gtk_fixed_put (GTK_FIXED (fixed_hoz), checkbutton_prgr, 8, 68);
  gtk_widget_set_size_request (checkbutton_prgr, 184, 24);

  scrolledwindow_rprt = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (scrolledwindow_rprt);
  gtk_fixed_put (GTK_FIXED (fixed_hoz), scrolledwindow_rprt, 16, 96);
  gtk_widget_set_size_request (scrolledwindow_rprt, 378, 360);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_rprt), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

  textview_rprt = gtk_text_view_new ();
  gtk_widget_show (textview_rprt);
  gtk_container_add (GTK_CONTAINER (scrolledwindow_rprt), textview_rprt);
  gtk_widget_set_size_request (textview_rprt, 50, 50);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (textview_rprt), FALSE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview_rprt), GTK_WRAP_WORD);

  label_outp = gtk_label_new ("label_outp");
  gtk_widget_show (label_outp);
  gtk_fixed_put (GTK_FIXED (fixed_hoz), label_outp, 8, 36);
  gtk_widget_set_size_request (label_outp, 96, 20);
  gtk_label_set_justify (GTK_LABEL (label_outp), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label_outp), 0, 0.5);

  label_size = gtk_label_new ("label_size");
  gtk_widget_show (label_size);
  gtk_fixed_put (GTK_FIXED (fixed_hoz), label_size, 8, 8);
  gtk_widget_set_size_request (label_size, 96, 16);
  gtk_label_set_justify (GTK_LABEL (label_size), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label_size), 0, 0.5);

  button_paste = gtk_button_new_with_mnemonic ("button__paste");
  gtk_widget_show (button_paste);
  gtk_fixed_put (GTK_FIXED (fixed_hoz), button_paste, 304, 40);
  gtk_widget_set_size_request (button_paste, 88, 25);

  button_cut = gtk_button_new_with_mnemonic ("button__cut");
  gtk_widget_show (button_cut);
  gtk_fixed_put (GTK_FIXED (fixed_hoz), button_cut, 304, 8);
  gtk_widget_set_size_request (button_cut, 90, 25);

  combo_size = gtk_combo_new ();
  g_object_set_data (G_OBJECT (GTK_COMBO (combo_size)->popwin),
                     "GladeParentKey", combo_size);
  gtk_widget_show (combo_size);
  gtk_fixed_put (GTK_FIXED (fixed_hoz), combo_size, 215, 8);
  gtk_widget_set_size_request (combo_size, 80, 25);
  combo_size_items = g_list_append (combo_size_items, (gpointer) "bytes");
  combo_size_items = g_list_append (combo_size_items, (gpointer) "KiB");
  combo_size_items = g_list_append (combo_size_items, (gpointer) "MiB");
  gtk_combo_set_popdown_strings (GTK_COMBO (combo_size), combo_size_items);
  g_list_free (combo_size_items);

  combo_entry_size = GTK_COMBO (combo_size)->entry;
  gtk_widget_show (combo_entry_size);
  gtk_widget_set_size_request (combo_entry_size, 50, -2);
  gtk_editable_set_editable (GTK_EDITABLE (combo_entry_size), FALSE);
  gtk_entry_set_text (GTK_ENTRY (combo_entry_size), "bytes");

  g_signal_connect ((gpointer) window_hoz, "destroy",
                    G_CALLBACK (on_window_hoz_destroy),
                    NULL);
  g_signal_connect ((gpointer) entry_size, "changed",
                    G_CALLBACK (on_entry_size_changed),
                    NULL);
  g_signal_connect ((gpointer) button_paste, "clicked",
                    G_CALLBACK (on_button_paste_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_cut, "clicked",
                    G_CALLBACK (on_button_cut_clicked),
                    NULL);
  g_signal_connect ((gpointer) combo_entry_size, "changed",
                    G_CALLBACK (on_combo_entry_size_changed),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (window_hoz, window_hoz, "window_hoz");
  GLADE_HOOKUP_OBJECT (window_hoz, fixed_hoz, "fixed_hoz");
  GLADE_HOOKUP_OBJECT (window_hoz, entry_outp, "entry_outp");
  GLADE_HOOKUP_OBJECT (window_hoz, entry_size, "entry_size");
  GLADE_HOOKUP_OBJECT (window_hoz, checkbutton_prgr, "checkbutton_prgr");
  GLADE_HOOKUP_OBJECT (window_hoz, scrolledwindow_rprt, "scrolledwindow_rprt");
  GLADE_HOOKUP_OBJECT (window_hoz, textview_rprt, "textview_rprt");
  GLADE_HOOKUP_OBJECT (window_hoz, label_outp, "label_outp");
  GLADE_HOOKUP_OBJECT (window_hoz, label_size, "label_size");
  GLADE_HOOKUP_OBJECT (window_hoz, button_paste, "button_paste");
  GLADE_HOOKUP_OBJECT (window_hoz, button_cut, "button_cut");
  GLADE_HOOKUP_OBJECT (window_hoz, combo_size, "combo_size");
  GLADE_HOOKUP_OBJECT (window_hoz, combo_entry_size, "combo_entry_size");

  return window_hoz;
}

GtkWidget*
create_fileselection_fd (void)
{
  GtkWidget *fileselection_fd;
  GtkWidget *ok_button_fd;
  GtkWidget *cancel_button_fd;

  fileselection_fd = gtk_file_selection_new ("HOZ");
  gtk_container_set_border_width (GTK_CONTAINER (fileselection_fd), 10);
  gtk_window_set_position (GTK_WINDOW (fileselection_fd), GTK_WIN_POS_CENTER);
  gtk_window_set_modal (GTK_WINDOW (fileselection_fd), TRUE);
  gtk_window_set_destroy_with_parent (GTK_WINDOW (fileselection_fd), TRUE);

  ok_button_fd = GTK_FILE_SELECTION (fileselection_fd)->ok_button;
  gtk_widget_show (ok_button_fd);
  GTK_WIDGET_SET_FLAGS (ok_button_fd, GTK_CAN_DEFAULT);

  cancel_button_fd = GTK_FILE_SELECTION (fileselection_fd)->cancel_button;
  gtk_widget_show (cancel_button_fd);
  GTK_WIDGET_SET_FLAGS (cancel_button_fd, GTK_CAN_DEFAULT);

  g_signal_connect_swapped ((gpointer) ok_button_fd, "clicked",
                            G_CALLBACK (on_ok_button_fd_clicked),
                            GTK_OBJECT (fileselection_fd));
  g_signal_connect ((gpointer) cancel_button_fd, "clicked",
                    G_CALLBACK (on_cancel_button_fd_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (fileselection_fd, fileselection_fd, "fileselection_fd");
  GLADE_HOOKUP_OBJECT_NO_REF (fileselection_fd, ok_button_fd, "ok_button_fd");
  GLADE_HOOKUP_OBJECT_NO_REF (fileselection_fd, cancel_button_fd, "cancel_button_fd");

  return fileselection_fd;
}

GtkWidget*
create_dialog_ra (void)
{
  GtkWidget *dialog_ra;
  GtkWidget *dialog_vbox_ra;
  GtkWidget *label_msg_ra;
  GtkWidget *dialog_action_area_ra;
  GtkWidget *button_yes_ra;
  GtkWidget *button_no_ra;

  dialog_ra = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog_ra), "dialog_ra");
  gtk_window_set_position (GTK_WINDOW (dialog_ra), GTK_WIN_POS_CENTER);
  gtk_window_set_modal (GTK_WINDOW (dialog_ra), TRUE);
  gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog_ra), TRUE);

  dialog_vbox_ra = GTK_DIALOG (dialog_ra)->vbox;
  gtk_widget_show (dialog_vbox_ra);

  label_msg_ra = gtk_label_new ("label__msg__ra");
  gtk_widget_show (label_msg_ra);
  gtk_box_pack_start (GTK_BOX (dialog_vbox_ra), label_msg_ra, TRUE, TRUE, 5);
  gtk_label_set_line_wrap (GTK_LABEL (label_msg_ra), TRUE);

  dialog_action_area_ra = GTK_DIALOG (dialog_ra)->action_area;
  gtk_widget_show (dialog_action_area_ra);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area_ra), GTK_BUTTONBOX_SPREAD);

  button_yes_ra = gtk_button_new_with_mnemonic ("button__yes__ra");
  gtk_widget_show (button_yes_ra);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog_ra), button_yes_ra, 0);
  GTK_WIDGET_SET_FLAGS (button_yes_ra, GTK_CAN_DEFAULT);

  button_no_ra = gtk_button_new_with_mnemonic ("button__no__ra");
  gtk_widget_show (button_no_ra);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog_ra), button_no_ra, 0);
  GTK_WIDGET_SET_FLAGS (button_no_ra, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) button_yes_ra, "clicked",
                    G_CALLBACK (on_button_yes_ra_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_no_ra, "clicked",
                    G_CALLBACK (on_button_no_ra_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_ra, dialog_ra, "dialog_ra");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_ra, dialog_vbox_ra, "dialog_vbox_ra");
  GLADE_HOOKUP_OBJECT (dialog_ra, label_msg_ra, "label_msg_ra");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_ra, dialog_action_area_ra, "dialog_action_area_ra");
  GLADE_HOOKUP_OBJECT (dialog_ra, button_yes_ra, "button_yes_ra");
  GLADE_HOOKUP_OBJECT (dialog_ra, button_no_ra, "button_no_ra");

  return dialog_ra;
}

GtkWidget*
create_dialog_bs (void)
{
  GtkWidget *dialog_bs;
  GtkWidget *dialog_vbox_bs;
  GtkWidget *label_msg_bs;
  GtkWidget *dialog_action_area_bs;
  GtkWidget *okbutton_bs;

  dialog_bs = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog_bs), "dialog__bs");
  gtk_window_set_position (GTK_WINDOW (dialog_bs), GTK_WIN_POS_CENTER);
  gtk_window_set_modal (GTK_WINDOW (dialog_bs), TRUE);

  dialog_vbox_bs = GTK_DIALOG (dialog_bs)->vbox;
  gtk_widget_show (dialog_vbox_bs);

  label_msg_bs = gtk_label_new ("label__msg__bs");
  gtk_widget_show (label_msg_bs);
  gtk_box_pack_start (GTK_BOX (dialog_vbox_bs), label_msg_bs, TRUE, TRUE, 5);
  gtk_label_set_justify (GTK_LABEL (label_msg_bs), GTK_JUSTIFY_LEFT);

  dialog_action_area_bs = GTK_DIALOG (dialog_bs)->action_area;
  gtk_widget_show (dialog_action_area_bs);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area_bs), GTK_BUTTONBOX_SPREAD);

  okbutton_bs = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton_bs);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog_bs), okbutton_bs, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton_bs, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) okbutton_bs, "clicked",
                    G_CALLBACK (on_okbutton_bs_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_bs, dialog_bs, "dialog_bs");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_bs, dialog_vbox_bs, "dialog_vbox_bs");
  GLADE_HOOKUP_OBJECT (dialog_bs, label_msg_bs, "label_msg_bs");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_bs, dialog_action_area_bs, "dialog_action_area_bs");
  GLADE_HOOKUP_OBJECT (dialog_bs, okbutton_bs, "okbutton_bs");

  return dialog_bs;
}