Revision 3372e100 src/callbacks.c

b/src/callbacks.c
32 32

  
33 33
static void action_quit(gpointer user_data);
34 34
static void action_show_preferences(gpointer user_data);
35
static void action_show_gal_settings(gpointer user_data);
35
static void action_gal_show_settings(gpointer user_data);
36
static void action_gal_open(gpointer user_data);
37
static void action_gal_save(gpointer user_data);
36 38

  
37 39
/**********************************************************************
38 40
 * Widget action functions. These just calls the actual function to do
......
41 43
 * clicked or keyboard short cut is used.
42 44
 **********************************************************************/
43 45

  
46
/*
47
 * File menu actions 
48
 */
44 49

  
45 50
void 
46 51
on_menu_quit_activate( GtkMenuItem *menuitem,
......
51 56
    action_quit(user_data);
52 57
}
53 58

  
59

  
60

  
54 61
void 
55 62
on_menu_preferences_activate(GtkMenuItem *menuitem,
56 63
                             gpointer user_data)
......
61 68
}
62 69

  
63 70

  
71
/*
72
 * Gallery menu actions 
73
 */
74

  
75
void
76
on_menu_gal_settings_activate(GtkMenuItem *menuitem,
77
                              gpointer user_data)
78
{
79
    g_debug("in on_menu_gal_settings_activate");
80

  
81
    action_gal_show_settings(user_data);
82
}
83

  
84
void
85
on_menu_open_activate(GtkMenuItem *menuitem,
86
                      gpointer user_data)
87
{
88
    g_debug("in on_menu_open_activate");
89

  
90
    action_gal_open(user_data);
91
}
92

  
93

  
94

  
95
void
96
on_menu_save_activate(GtkMenuItem *menuitem,
97
                      gpointer user_data)
98
{
99
    g_debug("in on_menu_open_activate");
100

  
101
    action_gal_save(user_data);
102
}
103

  
104

  
105
/*
106
 * Image menu actions 
107
 */
108

  
64 109
void 
65 110
on_button_image_add_clicked(GtkToolButton *toolbutton,
66 111
                            gpointer user_data)
......
94 139
}
95 140

  
96 141

  
97

  
98
void
99
on_menu_gal_settings_activate(GtkMenuItem *menuitem,
100
                              gpointer user_data)
101
{
102
    g_debug("in on_menu_gal_settings_activate");
103

  
104
    action_show_gal_settings(user_data);
105
}
106

  
142
/*
143
 * Other callbacks
144
 */
107 145

  
108 146
gboolean
109 147
on_mainwindow_delete_event(GtkWidget *widget,
......
119 157

  
120 158
/**********************************************************************
121 159
 * The actions functions. These are called from above wrappers.
160
 * CHECKME: the one-liners could be called directly..
122 161
 **********************************************************************/
123 162

  
124 163
/*
......
155 194
 * Show gallery settings window
156 195
 */
157 196
static void 
158
action_show_gal_settings(gpointer user_data)
197
action_gal_show_settings(gpointer user_data)
159 198
{
160 199
    g_assert(user_data != NULL );
161 200

  
162
    g_debug("in action_show_gal_settings");
201
    g_debug("in action_gal_show_settings");
163 202

  
164 203
    widgets_gal_settings_show(user_data);
165 204
}
166 205

  
206
/*
207
 * Open gallery
208
 */
209
static void 
210
action_gal_open(gpointer user_data)
211
{
212
    struct data *data;
213
    GtkWidget *dialog;
214
    gchar *uri;
215

  
216
    g_assert(user_data != NULL );
217

  
218
    g_debug("in action_gal_open");
219

  
220
    data = user_data;
221

  
222
    dialog = gtk_file_chooser_dialog_new(_("Open Gallery"),
223
                                         GTK_WINDOW(data->top_window),
224
                                         GTK_FILE_CHOOSER_ACTION_OPEN,
225
                                         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
226
                                         GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
227
                                         NULL);
228

  
229
    gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), 
230
                                            data->gal_dir);
231
    gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
232

  
233
    if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
234
    {
235
        uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
236
    } 
237
    else
238
    {
239
        gtk_widget_destroy (dialog);
240
        return;
241
    }
242
    gtk_widget_destroy (dialog);
243

  
244
    g_assert(uri != NULL); /* CHECKME: better error handling? */
245
    gallery_open(data, uri);
246
    g_free(uri);
247
}
248

  
249
/*
250
 * Save gallery
251
 */
252
static void 
253
action_gal_save(gpointer user_data)
254
{
255
    struct data *data;
256

  
257
    g_assert(user_data != NULL );
258

  
259
    g_debug("in action_gal_save");
260

  
261
    data = user_data;
262

  
263
    gallery_save(data);
264
}
265

  
167 266
/* Emacs indentatation information
168 267
   Local Variables:
169 268
   indent-tabs-mode:nil

Also available in: Unified diff