Search
lxdream.org :: lxdream/src/gtkui/path_dlg.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gtkui/path_dlg.c
changeset 736:a02d1475ccfd
prev658:f5926310bfbe
author nkeynes
date Mon Jul 14 07:44:42 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Re-indent everything consistently
Fix include guards for consistency as well
file annotate diff log raw
1.1 --- a/src/gtkui/path_dlg.c Wed Apr 16 12:43:52 2008 +0000
1.2 +++ b/src/gtkui/path_dlg.c Mon Jul 14 07:44:42 2008 +0000
1.3 @@ -26,15 +26,15 @@
1.4 #include "gtkui/gtkui.h"
1.5
1.6 static const gchar *path_label[] = { N_("Bios rom"), N_("Flash rom"), N_("Default disc path"),
1.7 - N_("Save state path"), N_("Bootstrap IP.BIN") };
1.8 + N_("Save state path"), N_("Bootstrap IP.BIN") };
1.9 static const int path_id[] = { CONFIG_BIOS_PATH, CONFIG_FLASH_PATH, CONFIG_DEFAULT_PATH,
1.10 - CONFIG_SAVE_PATH, CONFIG_BOOTSTRAP };
1.11 + CONFIG_SAVE_PATH, CONFIG_BOOTSTRAP };
1.12 static GtkFileChooserAction path_action[] = {
1.13 - GTK_FILE_CHOOSER_ACTION_OPEN,
1.14 - GTK_FILE_CHOOSER_ACTION_OPEN,
1.15 - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
1.16 - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
1.17 - GTK_FILE_CHOOSER_ACTION_OPEN };
1.18 + GTK_FILE_CHOOSER_ACTION_OPEN,
1.19 + GTK_FILE_CHOOSER_ACTION_OPEN,
1.20 + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
1.21 + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
1.22 + GTK_FILE_CHOOSER_ACTION_OPEN };
1.23
1.24 static GtkWidget *path_entry[5];
1.25
1.26 @@ -42,18 +42,18 @@
1.27 {
1.28 GtkWidget *entry = GTK_WIDGET(user_data);
1.29 GtkWidget *file = gtk_file_chooser_dialog_new( _("Select file"), NULL,
1.30 - GTK_FILE_CHOOSER_ACTION_OPEN,
1.31 - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1.32 - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
1.33 - NULL );
1.34 + GTK_FILE_CHOOSER_ACTION_OPEN,
1.35 + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1.36 + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
1.37 + NULL );
1.38 const gchar *filename = gtk_entry_get_text(GTK_ENTRY(entry));
1.39 gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file), filename );
1.40 gtk_window_set_modal( GTK_WINDOW(file), TRUE );
1.41 gtk_widget_show_all( file );
1.42 gint result = gtk_dialog_run(GTK_DIALOG(file));
1.43 if( result == GTK_RESPONSE_ACCEPT ) {
1.44 - filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(file) );
1.45 - gtk_entry_set_text(GTK_ENTRY(entry), filename);
1.46 + filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(file) );
1.47 + gtk_entry_set_text(GTK_ENTRY(entry), filename);
1.48 }
1.49 gtk_widget_destroy(file);
1.50 return TRUE;
1.51 @@ -63,10 +63,10 @@
1.52 {
1.53 GtkWidget *entry = GTK_WIDGET(user_data);
1.54 GtkWidget *file = gtk_file_chooser_dialog_new( _("Select file"), NULL,
1.55 - GTK_FILE_CHOOSER_ACTION_OPEN,
1.56 - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1.57 - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
1.58 - NULL );
1.59 + GTK_FILE_CHOOSER_ACTION_OPEN,
1.60 + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1.61 + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
1.62 + NULL );
1.63 const gchar *filename = gtk_entry_get_text(GTK_ENTRY(entry));
1.64 gtk_file_chooser_set_action( GTK_FILE_CHOOSER(file), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );
1.65 gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file), filename );
1.66 @@ -74,8 +74,8 @@
1.67 gtk_widget_show_all( file );
1.68 gint result = gtk_dialog_run(GTK_DIALOG(file));
1.69 if( result == GTK_RESPONSE_ACCEPT ) {
1.70 - filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(file) );
1.71 - gtk_entry_set_text(GTK_ENTRY(entry), filename);
1.72 + filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(file) );
1.73 + gtk_entry_set_text(GTK_ENTRY(entry), filename);
1.74 }
1.75 gtk_widget_destroy(file);
1.76 return TRUE;
1.77 @@ -86,23 +86,23 @@
1.78 GtkWidget *table = gtk_table_new( 5, 3, FALSE );
1.79 int i;
1.80 for( i=0; i<5; i++ ) {
1.81 - GtkWidget *text = path_entry[i] = gtk_entry_new();
1.82 - GtkWidget *button = gtk_button_new();
1.83 - gtk_table_attach( GTK_TABLE(table), gtk_label_new(Q_(path_label[i])), 0, 1, i, i+1,
1.84 - GTK_SHRINK, GTK_SHRINK, 0, 0);
1.85 - gtk_entry_set_text( GTK_ENTRY(text), lxdream_get_config_value(path_id[i]) );
1.86 - gtk_entry_set_width_chars( GTK_ENTRY(text), 48 );
1.87 - gtk_table_attach_defaults( GTK_TABLE(table), text, 1, 2, i, i+1 );
1.88 - gtk_table_attach( GTK_TABLE(table), button, 2, 3, i, i+1, GTK_SHRINK, GTK_SHRINK, 0, 0 );
1.89 - if( path_action[i] == GTK_FILE_CHOOSER_ACTION_OPEN ) {
1.90 - GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
1.91 - gtk_button_set_image( GTK_BUTTON(button), image );
1.92 - g_signal_connect( button, "clicked", G_CALLBACK(path_file_button_clicked), text );
1.93 - } else {
1.94 - GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
1.95 - gtk_button_set_image( GTK_BUTTON(button), image );
1.96 - g_signal_connect( button, "clicked", G_CALLBACK(path_dir_button_clicked), text );
1.97 - }
1.98 + GtkWidget *text = path_entry[i] = gtk_entry_new();
1.99 + GtkWidget *button = gtk_button_new();
1.100 + gtk_table_attach( GTK_TABLE(table), gtk_label_new(Q_(path_label[i])), 0, 1, i, i+1,
1.101 + GTK_SHRINK, GTK_SHRINK, 0, 0);
1.102 + gtk_entry_set_text( GTK_ENTRY(text), lxdream_get_config_value(path_id[i]) );
1.103 + gtk_entry_set_width_chars( GTK_ENTRY(text), 48 );
1.104 + gtk_table_attach_defaults( GTK_TABLE(table), text, 1, 2, i, i+1 );
1.105 + gtk_table_attach( GTK_TABLE(table), button, 2, 3, i, i+1, GTK_SHRINK, GTK_SHRINK, 0, 0 );
1.106 + if( path_action[i] == GTK_FILE_CHOOSER_ACTION_OPEN ) {
1.107 + GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
1.108 + gtk_button_set_image( GTK_BUTTON(button), image );
1.109 + g_signal_connect( button, "clicked", G_CALLBACK(path_file_button_clicked), text );
1.110 + } else {
1.111 + GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
1.112 + gtk_button_set_image( GTK_BUTTON(button), image );
1.113 + g_signal_connect( button, "clicked", G_CALLBACK(path_dir_button_clicked), text );
1.114 + }
1.115 }
1.116 return table;
1.117
1.118 @@ -111,15 +111,15 @@
1.119 void path_panel_done( GtkWidget *panel, gboolean isOK )
1.120 {
1.121 if( isOK ) {
1.122 - int i;
1.123 - for(i=0; i<5; i++ ) {
1.124 - const char *filename = gtk_entry_get_text( GTK_ENTRY(path_entry[i]) );
1.125 - lxdream_set_global_config_value( path_id[i], filename );
1.126 - }
1.127 -
1.128 - lxdream_save_config();
1.129 - dreamcast_config_changed();
1.130 - gtk_gui_update();
1.131 + int i;
1.132 + for(i=0; i<5; i++ ) {
1.133 + const char *filename = gtk_entry_get_text( GTK_ENTRY(path_entry[i]) );
1.134 + lxdream_set_global_config_value( path_id[i], filename );
1.135 + }
1.136 +
1.137 + lxdream_save_config();
1.138 + dreamcast_config_changed();
1.139 + gtk_gui_update();
1.140 }
1.141 }
1.142
.