# HG changeset patch # User mf0102 # Date 1169736972 28800 # Node ID 6725ce180c26aff7d0d16689a5ce996cb0854364 # Parent c4c24ca99c31b718ce9044f641a6a04eadf1c3d4 [svn] recoded gtk2 style file opener diff -r c4c24ca99c31 -r 6725ce180c26 ChangeLog --- a/ChangeLog Thu Jan 25 06:51:18 2007 -0800 +++ b/ChangeLog Thu Jan 25 06:56:12 2007 -0800 @@ -1,3 +1,12 @@ +2007-01-25 14:51:18 +0000 + revision [3812] + * Update Japanese translation. + - Thanks to KAZUKI SHIMURA . + + trunk/po/ja.po | 4876 +++++---------------------------------------------------- + 1 file changed, 497 insertions(+), 4379 deletions(-) + + 2007-01-25 09:52:51 +0000 William Pitcock revision [3810] - make a note that hashtable collisions in the plugin matrix are not diff -r c4c24ca99c31 -r 6725ce180c26 src/audacious/glade/Makefile --- a/src/audacious/glade/Makefile Thu Jan 25 06:51:18 2007 -0800 +++ b/src/audacious/glade/Makefile Thu Jan 25 06:56:12 2007 -0800 @@ -5,7 +5,6 @@ OBJECTIVE_DATA = \ fileinfo.glade:$(gladexmldir) \ - prefswin.glade:$(gladexmldir) \ - addfiles.glade:$(gladexmldir) + prefswin.glade:$(gladexmldir) include ${top_srcdir}/mk/objective.mk diff -r c4c24ca99c31 -r 6725ce180c26 src/audacious/glade/addfiles.glade --- a/src/audacious/glade/addfiles.glade Thu Jan 25 06:51:18 2007 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ - - - - - - - True - Add Files - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER - False - 700 - 450 - True - False - True - True - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - - - - - True - False - 0 - - - - True - 0.5 - 0.5 - 1 - 1 - 8 - 8 - 8 - 8 - - - - - - - 0 - True - True - - - - - - True - 0.5 - 0.5 - 1 - 1 - 8 - 8 - 4 - 4 - - - - True - 1 - 2 - False - 0 - 0 - - - - True - True - Close Dialog on Add - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - GTK_BUTTONBOX_END - 8 - - - - True - True - Select All - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - Deselect All - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - True - gtk-add - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - - - - - - 1 - 2 - 0 - 1 - fill - - - - - - - 0 - False - False - - - - - - - diff -r c4c24ca99c31 -r 6725ce180c26 src/audacious/util.c --- a/src/audacious/util.c Thu Jan 25 06:51:18 2007 -0800 +++ b/src/audacious/util.c Thu Jan 25 06:56:12 2007 -0800 @@ -395,14 +395,14 @@ if (open_buffer == NULL || strcasecmp(filename, open_buffer)) { if (buffer != NULL) - { + { g_free(buffer); buffer = NULL; } - if (open_buffer != NULL) + if (open_buffer != NULL) { - g_free(open_buffer); + g_free(open_buffer); open_buffer = NULL; } @@ -417,13 +417,13 @@ * by incomp@#audacious. Cleanups \nenolod */ if (!memcmp(&buffer[0],&x,2)) { - outbuf = g_malloc (filesize); /* it's safe to waste memory. */ + outbuf = g_malloc (filesize); /* it's safe to waste memory. */ for (counter = 2; counter < filesize; counter += 2) if (!memcmp(&buffer[counter+1], &x[2], 1)) outbuf[(counter-2)/2] = buffer[counter]; else - return NULL; + return NULL; outbuf[(counter-2)/2] = '\0'; @@ -432,7 +432,7 @@ buffer = outbuf; } else { g_free(outbuf); - return NULL; /* XXX wrong encoding */ + return NULL; /* XXX wrong encoding */ } } @@ -595,7 +595,7 @@ GCallback enqueue_func) { GtkWidget *win, *vbox, *bbox, *enqueue, *ok, *cancel, *combo, *entry, - *label; + *label; GList *url; win = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -639,9 +639,9 @@ ok = gtk_button_new_from_stock(GTK_STOCK_OPEN); g_signal_connect(ok, "clicked", - G_CALLBACK(util_add_url_callback), entry); + G_CALLBACK(util_add_url_callback), entry); g_signal_connect(ok, "clicked", - G_CALLBACK(ok_func), entry); + G_CALLBACK(ok_func), entry); g_signal_connect_swapped(ok, "clicked", G_CALLBACK(gtk_widget_destroy), win); @@ -710,231 +710,59 @@ cfg.filesel_path = ptr; } -static void -filebrowser_add(GtkFileChooser *browser) -{ - GSList *files; - - files = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(browser)); - - if (!files) { - return; - } - - filebrowser_add_files(browser, files); - g_slist_foreach(files, (GFunc) g_free, NULL); - g_slist_free(files); -} - -static void -filebrowser_play(GtkFileChooser * browser) -{ - GSList *files; - - files = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(browser)); - - if (!files) return; - - playlist_clear(playlist_get_active()); - - filebrowser_add_files(browser, files); - g_slist_foreach(files, (GFunc) g_free, NULL); - g_slist_free(files); - - playback_initiate(); -} - - -static void -_filebrowser_add_gtk2(GtkWidget *widget, - gpointer data) -{ - filebrowser_add(data); - gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(data)); -} - -static void -_filebrowser_play_gtk2(GtkWidget *widget, gpointer data) -{ - filebrowser_play(data); - gtk_file_chooser_unselect_all(data); -} - -#if 0 -static void -filebrowser_on_response(GtkFileChooser * browser, - gint response, - gpointer data) -{ - gtk_widget_hide(GTK_WIDGET(browser)); - switch (response) { - case GTK_RESPONSE_OK: - break; - case GTK_RESPONSE_ACCEPT: - break; - case GTK_RESPONSE_CLOSE: - break; - } - gtk_widget_destroy(GTK_WIDGET(browser)); - -} - -#endif - -static void -_filebrowser_check_hide_add(GtkWidget * widget, - gpointer data) -{ - cfg.close_dialog_add = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); -} - -static void -_filebrowser_check_hide_open(GtkWidget * widget, - gpointer data) -{ - cfg.close_dialog_open = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); -} - - - -static gboolean -filebrowser_on_keypress(GtkWidget * browser, - GdkEventKey * event, - gpointer data) -{ - if (event->keyval == GDK_Escape) { - /* FIXME: this crashes BMP for some reason */ - /* g_signal_emit_by_name(browser, "delete-event"); */ - gtk_widget_hide(browser); - return TRUE; - } - - return FALSE; -} - -static void -_filebrowser_do_hide_add(GtkWidget *widget, - gpointer data) -{ - if (cfg.close_dialog_add) - gtk_widget_hide(data); -} - -static void -_filebrowser_do_hide_open(GtkWidget *widget, - gpointer data) -{ - if (cfg.close_dialog_open) - gtk_widget_hide(data); -} - void util_run_filebrowser_gtk2style(gboolean play_button) { - static GladeXML *xml = NULL; - static GtkWidget *dialog = NULL; static GtkWidget *chooser = NULL; - - static GtkWidget *button_add; - static GtkWidget *button_select_all, *button_deselect_all; - static GtkWidget *toggle; - - static gulong handlerid, handlerid_check, handlerid_do; - static gulong handlerid_activate, handlerid_do_activate; + static GtkWidget *toggle = NULL; - if (!xml) { - /* FIXME: Creating a file chooser dialog manually using - libglade because there's no way to stop - GtkFileChooserDialog from resizing the buttons to the same - size. The long toggle button title causes the buttons to - turn unnecessarily elongated and fugly. */ - - GtkWidget *alignment; - - xml = glade_xml_new_or_die(_("Add/Open Files dialog"), - DATA_DIR "/glade/addfiles.glade", - NULL, NULL); - glade_xml_signal_autoconnect(xml); + gint ACCEPT_RESPONSE_ID = 100; - dialog = glade_xml_get_widget(xml, "add_files_dialog"); - - /* FIXME: Creating file chooser widget here because libglade <= 2.4.0 does - not support GtkFileChooserWidget */ - - chooser = gtk_file_chooser_widget_new(GTK_FILE_CHOOSER_ACTION_OPEN); - gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(chooser), TRUE); - - if (cfg.filesel_path) - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(chooser), - cfg.filesel_path); + chooser = + gtk_file_chooser_dialog_new(play_button ? "Open Files" : "Add Files", + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + play_button ? GTK_STOCK_OPEN : GTK_STOCK_ADD, + ACCEPT_RESPONSE_ID, NULL); - alignment = glade_xml_get_widget(xml, "alignment2"); - gtk_container_add(GTK_CONTAINER(alignment), chooser); + gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(chooser), TRUE); + if (cfg.filesel_path) + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(chooser), + cfg.filesel_path); - toggle = glade_xml_get_widget(xml, "close_on_action"); - button_select_all = glade_xml_get_widget(xml, "select_all"); - button_deselect_all = glade_xml_get_widget(xml, "deselect_all"); - button_add = glade_xml_get_widget(xml, "action"); - g_signal_connect_swapped(button_select_all, "clicked", - G_CALLBACK(gtk_file_chooser_select_all), - chooser); - g_signal_connect_swapped(button_deselect_all, "clicked", - G_CALLBACK(gtk_file_chooser_unselect_all), - chooser); + toggle = gtk_check_button_new_with_label(play_button ? _("Close dialog on Open") : _("Close dialog on Add")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), + cfg.close_dialog_open ? TRUE : FALSE); + gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(chooser), toggle); - g_signal_connect(dialog, "key_press_event", - G_CALLBACK(filebrowser_on_keypress), - NULL); + + while(gtk_dialog_run(GTK_DIALOG(chooser)) == ACCEPT_RESPONSE_ID) + { + cfg.close_dialog_open = + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle)); - gtk_widget_show_all(dialog); - } /* !xml */ - else { - g_signal_handler_disconnect(button_add, handlerid); - g_signal_handler_disconnect(toggle, handlerid_check); - g_signal_handler_disconnect(chooser, handlerid_activate); - g_signal_handler_disconnect(button_add, handlerid_do); - g_signal_handler_disconnect(chooser, handlerid_do_activate); + GSList *files; + files = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(chooser)); + if (!files) return; - if (cfg.refresh_file_list) - { - gchar *tmp = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(chooser)); - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(chooser), tmp); - - g_free(tmp); - } - } - - if (play_button) { - gtk_window_set_title(GTK_WINDOW(dialog), _("Open Files")); + if (play_button) + playlist_clear(playlist_get_active()); - gtk_button_set_label(GTK_BUTTON(button_add), GTK_STOCK_OPEN); - - gtk_button_set_label(GTK_BUTTON(toggle), _("Close dialog on Open")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), cfg.close_dialog_open); + filebrowser_add_files(GTK_FILE_CHOOSER(chooser), files); + g_slist_foreach(files, (GFunc) g_free, NULL); + g_slist_free(files); - handlerid = g_signal_connect(button_add, "clicked", G_CALLBACK(_filebrowser_play_gtk2), chooser); - handlerid_check = g_signal_connect(toggle, "toggled", G_CALLBACK(_filebrowser_check_hide_open), NULL); - handlerid_do = g_signal_connect_after(button_add, "clicked", G_CALLBACK(_filebrowser_do_hide_open), dialog); - handlerid_activate = g_signal_connect(chooser, "file-activated", G_CALLBACK(_filebrowser_play_gtk2), chooser); - handlerid_do_activate = g_signal_connect_after(chooser,"file_activated", G_CALLBACK(_filebrowser_do_hide_open), dialog); - } - else { - gtk_window_set_title(GTK_WINDOW(dialog), _("Add Files")); + if (play_button) + playback_initiate(); - gtk_button_set_label(GTK_BUTTON(button_add), GTK_STOCK_ADD); - - gtk_button_set_label(GTK_BUTTON(toggle), _("Close dialog on Add")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), cfg.close_dialog_add); - handlerid = g_signal_connect(button_add, "clicked", G_CALLBACK(_filebrowser_add_gtk2), chooser); - handlerid_check = g_signal_connect(toggle, "toggled", G_CALLBACK(_filebrowser_check_hide_add), NULL); - handlerid_do = g_signal_connect_after(button_add, "clicked", G_CALLBACK(_filebrowser_do_hide_add), dialog); - handlerid_activate = g_signal_connect(chooser, "file-activated", G_CALLBACK(_filebrowser_add_gtk2), chooser); - handlerid_do_activate = g_signal_connect_after(chooser,"file_activated", G_CALLBACK(_filebrowser_do_hide_add), dialog); + if (cfg.close_dialog_open) + break; } - - gtk_window_present(GTK_WINDOW(dialog)); + + gtk_widget_destroy(chooser); } /* @@ -948,29 +776,30 @@ GList *list; GList *node; char *filename = (char *) - gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); + gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); GtkListStore *store; GtkTreeIter iter; - if ((list = input_scan_dir(filename)) != NULL) { - /* - * We enter a directory that has been "hijacked" by an - * input-plugin. This is used by the CDDA plugin - */ - store = - GTK_LIST_STORE(gtk_tree_view_get_model - (GTK_TREE_VIEW(filesel->file_list))); - gtk_list_store_clear(store); + if ((list = input_scan_dir(filename)) != NULL) + { + /* + * We enter a directory that has been "hijacked" by an + * input-plugin. This is used by the CDDA plugin + */ + store = + GTK_LIST_STORE(gtk_tree_view_get_model + (GTK_TREE_VIEW(filesel->file_list))); + gtk_list_store_clear(store); - node = list; - while (node) { + node = list; + while (node) { + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, 0, node->data, -1); + g_free(node->data); + node = g_list_next(node); + } - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, node->data, -1); - g_free(node->data); - node = g_list_next(node); - } - g_list_free(list); + g_list_free(list); } } @@ -988,47 +817,47 @@ text = g_strdup(gtk_file_selection_get_filename(filesel)); if (stat(text, &buf) == 0 && S_ISDIR(buf.st_mode)) { - /* Selected directory */ - int len = strlen(text); - if (len > 3 && !strcmp(text + len - 4, "/../")) { - if (len == 4) - /* At the root already */ - *(text + len - 3) = '\0'; - else { - char *ptr; - *(text + len - 4) = '\0'; - ptr = strrchr(text, '/'); - *(ptr + 1) = '\0'; - } - } else if (len > 2 && !strcmp(text + len - 3, "/./")) - *(text + len - 2) = '\0'; - gtk_file_selection_set_filename(filesel, text); - retv = TRUE; + /* Selected directory */ + int len = strlen(text); + if (len > 3 && !strcmp(text + len - 4, "/../")) { + if (len == 4) + /* At the root already */ + *(text + len - 3) = '\0'; + else { + char *ptr; + *(text + len - 4) = '\0'; + ptr = strrchr(text, '/'); + *(ptr + 1) = '\0'; + } + } else if (len > 2 && !strcmp(text + len - 3, "/./")) + *(text + len - 2) = '\0'; + gtk_file_selection_set_filename(filesel, text); + retv = TRUE; } g_free(text); return retv; } static void filebrowser_add_files_classic(gchar ** files, - GtkFileSelection * filesel) + GtkFileSelection * filesel) { int ctr = 0; char *ptr; Playlist *playlist = playlist_get_active(); if (GTK_IS_WIDGET(mainwin_jtf)) - gtk_widget_set_sensitive(mainwin_jtf, FALSE); + gtk_widget_set_sensitive(mainwin_jtf, FALSE); while (files[ctr] != NULL) { - playlist_add(playlist, files[ctr++]); + playlist_add(playlist, files[ctr++]); } playlistwin_update_list(playlist); if (GTK_IS_WIDGET(mainwin_jtf)) - gtk_widget_set_sensitive(mainwin_jtf, TRUE); + gtk_widget_set_sensitive(mainwin_jtf, TRUE); gtk_label_get(GTK_LABEL(GTK_BIN(filesel->history_pulldown)->child), - &ptr); + &ptr); /* This will give an extra slash if the current dir is the root. */ cfg.filesel_path = g_strconcat(ptr, "/", NULL); @@ -1039,7 +868,7 @@ gchar **files; if (util_filebrowser_is_dir_classic(GTK_FILE_SELECTION(filesel))) - return; + return; files = gtk_file_selection_get_selections(GTK_FILE_SELECTION(filesel)); filebrowser_add_files_classic(files, GTK_FILE_SELECTION(filesel)); gtk_widget_destroy(filesel); @@ -1050,8 +879,8 @@ gchar **files; if (util_filebrowser_is_dir_classic - (GTK_FILE_SELECTION(GTK_FILE_SELECTION(filesel)))) - return; + (GTK_FILE_SELECTION(GTK_FILE_SELECTION(filesel)))) + return; playlist_clear(playlist_get_active()); files = gtk_file_selection_get_selections(GTK_FILE_SELECTION(filesel)); filebrowser_add_files_classic(files, GTK_FILE_SELECTION(filesel)); @@ -1068,7 +897,7 @@ filebrowser_add_files_classic(files, filesel); gtk_tree_selection_unselect_all(gtk_tree_view_get_selection - (GTK_TREE_VIEW(filesel->file_list))); + (GTK_TREE_VIEW(filesel->file_list))); gtk_entry_set_text(GTK_ENTRY(filesel->selection_entry), ""); } @@ -1080,11 +909,11 @@ filesel = data; gtk_tree_selection_select_all(gtk_tree_view_get_selection - (GTK_TREE_VIEW(filesel->file_list))); + (GTK_TREE_VIEW(filesel->file_list))); files = gtk_file_selection_get_selections(filesel); filebrowser_add_files_classic(files, filesel); gtk_tree_selection_unselect_all(gtk_tree_view_get_selection - (GTK_TREE_VIEW(filesel->file_list))); + (GTK_TREE_VIEW(filesel->file_list))); gtk_entry_set_text(GTK_ENTRY(filesel->selection_entry), ""); } @@ -1093,27 +922,27 @@ { static GtkWidget *dialog; GtkWidget *button_add_selected, *button_add_all, *button_close, - *button_add; + *button_add; char *title; if (dialog != NULL) { - gtk_window_present(GTK_WINDOW(dialog)); - return; + gtk_window_present(GTK_WINDOW(dialog)); + return; } if (play_button) - title = _("Play files"); + title = _("Play files"); else - title = _("Load files"); + title = _("Load files"); dialog = gtk_file_selection_new(title); gtk_file_selection_set_select_multiple - (GTK_FILE_SELECTION(dialog), TRUE); + (GTK_FILE_SELECTION(dialog), TRUE); if (cfg.filesel_path) - gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), - cfg.filesel_path); + gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), + cfg.filesel_path); gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(dialog)); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); @@ -1126,57 +955,57 @@ * plus kinda easy to use */ button_add_selected = - gtk_dialog_add_button(GTK_DIALOG(dialog), "Add selected", - GTK_RESPONSE_NONE); + gtk_dialog_add_button(GTK_DIALOG(dialog), "Add selected", + GTK_RESPONSE_NONE); gtk_button_set_use_underline(GTK_BUTTON(button_add_selected), TRUE); g_signal_connect(G_OBJECT(button_add_selected), "clicked", - G_CALLBACK(filebrowser_add_selected_files_classic), dialog); + G_CALLBACK(filebrowser_add_selected_files_classic), dialog); button_add_all = - gtk_dialog_add_button(GTK_DIALOG(dialog), "Add all", - GTK_RESPONSE_NONE); + gtk_dialog_add_button(GTK_DIALOG(dialog), "Add all", + GTK_RESPONSE_NONE); gtk_button_set_use_underline(GTK_BUTTON(button_add_all), TRUE); g_signal_connect(G_OBJECT(button_add_all), "clicked", - G_CALLBACK(filebrowser_add_all_files_classic), dialog); + G_CALLBACK(filebrowser_add_all_files_classic), dialog); if (play_button) { - button_add = - gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_MEDIA_PLAY, - GTK_RESPONSE_NONE); - gtk_button_set_use_stock(GTK_BUTTON(button_add), TRUE); - g_signal_connect(G_OBJECT(button_add), "clicked", - G_CALLBACK(filebrowser_play_classic), dialog); - g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button), - "clicked", G_CALLBACK(filebrowser_play_classic), dialog); + button_add = + gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_MEDIA_PLAY, + GTK_RESPONSE_NONE); + gtk_button_set_use_stock(GTK_BUTTON(button_add), TRUE); + g_signal_connect(G_OBJECT(button_add), "clicked", + G_CALLBACK(filebrowser_play_classic), dialog); + g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button), + "clicked", G_CALLBACK(filebrowser_play_classic), dialog); } else { - button_add = - gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_ADD, - GTK_RESPONSE_NONE); - gtk_button_set_use_stock(GTK_BUTTON(button_add), TRUE); - g_signal_connect(G_OBJECT(button_add), "clicked", - G_CALLBACK(filebrowser_ok_classic), dialog); - g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button), - "clicked", G_CALLBACK(filebrowser_ok_classic), dialog); + button_add = + gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_ADD, + GTK_RESPONSE_NONE); + gtk_button_set_use_stock(GTK_BUTTON(button_add), TRUE); + g_signal_connect(G_OBJECT(button_add), "clicked", + G_CALLBACK(filebrowser_ok_classic), dialog); + g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button), + "clicked", G_CALLBACK(filebrowser_ok_classic), dialog); } button_close = - gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, - GTK_RESPONSE_NONE); + gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, + GTK_RESPONSE_NONE); gtk_button_set_use_stock(GTK_BUTTON(button_close), TRUE); g_signal_connect_swapped(G_OBJECT(button_close), "clicked", - G_CALLBACK(gtk_widget_destroy), - G_OBJECT(dialog)); + G_CALLBACK(gtk_widget_destroy), + G_OBJECT(dialog)); gtk_widget_set_size_request(dialog, 600, 450); gtk_widget_realize(dialog); g_signal_connect(G_OBJECT - (GTK_FILE_SELECTION(dialog)->history_pulldown), - "changed", G_CALLBACK(filebrowser_entry_changed_classic), - dialog); + (GTK_FILE_SELECTION(dialog)->history_pulldown), + "changed", G_CALLBACK(filebrowser_entry_changed_classic), + dialog); g_signal_connect(G_OBJECT(dialog), "destroy", - G_CALLBACK(gtk_widget_destroyed), &dialog); + G_CALLBACK(gtk_widget_destroyed), &dialog); filebrowser_changed_classic(GTK_FILE_SELECTION(dialog)); @@ -1390,27 +1219,27 @@ */ GdkPixmap *audacious_pixmap_resize(GdkWindow *src, GdkGC *src_gc, GdkPixmap *in, gint width, gint height) { - GdkPixmap *out; - gint owidth, oheight; + GdkPixmap *out; + gint owidth, oheight; - g_return_val_if_fail(src != NULL, NULL); - g_return_val_if_fail(src_gc != NULL, NULL); - g_return_val_if_fail(in != NULL, NULL); - g_return_val_if_fail(width > 0 && height > 0, NULL); + g_return_val_if_fail(src != NULL, NULL); + g_return_val_if_fail(src_gc != NULL, NULL); + g_return_val_if_fail(in != NULL, NULL); + g_return_val_if_fail(width > 0 && height > 0, NULL); - gdk_drawable_get_size(in, &owidth, &oheight); + gdk_drawable_get_size(in, &owidth, &oheight); - if (oheight == height && owidth == width) - return NULL; + if (oheight == height && owidth == width) + return NULL; - out = gdk_pixmap_new(src, width, height, -1); + out = gdk_pixmap_new(src, width, height, -1); - gdk_draw_rectangle(out, src_gc, TRUE, 0, 0, width, height); + gdk_draw_rectangle(out, src_gc, TRUE, 0, 0, width, height); - gdk_window_copy_area(out, src_gc, 0, 0, in, 0, 0, owidth, oheight); - g_object_unref(src); + gdk_window_copy_area(out, src_gc, 0, 0, in, 0, 0, owidth, oheight); + g_object_unref(src); - return out; + return out; } GdkImage *create_dblsize_image(GdkImage * img) @@ -1423,98 +1252,98 @@ */ dblimg = - gdk_image_new(GDK_IMAGE_NORMAL, gdk_visual_get_system(), - img->width << 1, img->height << 1); + gdk_image_new(GDK_IMAGE_NORMAL, gdk_visual_get_system(), + img->width << 1, img->height << 1); if (dblimg->bpp == 1) { - register guint8 *srcptr, *ptr, *ptr2, pix; + register guint8 *srcptr, *ptr, *ptr2, pix; - srcptr = GDK_IMAGE(img)->mem; - ptr = GDK_IMAGE(dblimg)->mem; - ptr2 = ptr + dblimg->bpl; + srcptr = GDK_IMAGE(img)->mem; + ptr = GDK_IMAGE(dblimg)->mem; + ptr2 = ptr + dblimg->bpl; - for (y = 0; y < img->height; y++) { - for (x = 0; x < img->width; x++) { - pix = *srcptr++; - *ptr++ = pix; - *ptr++ = pix; - *ptr2++ = pix; - *ptr2++ = pix; - } - srcptr += img->bpl - img->width; - ptr += (dblimg->bpl << 1) - dblimg->width; - ptr2 += (dblimg->bpl << 1) - dblimg->width; - } + for (y = 0; y < img->height; y++) { + for (x = 0; x < img->width; x++) { + pix = *srcptr++; + *ptr++ = pix; + *ptr++ = pix; + *ptr2++ = pix; + *ptr2++ = pix; + } + srcptr += img->bpl - img->width; + ptr += (dblimg->bpl << 1) - dblimg->width; + ptr2 += (dblimg->bpl << 1) - dblimg->width; + } } if (dblimg->bpp == 2) { - guint16 *srcptr, *ptr, *ptr2, pix; + guint16 *srcptr, *ptr, *ptr2, pix; - srcptr = (guint16 *) GDK_IMAGE_XIMAGE(img)->data; - ptr = (guint16 *) GDK_IMAGE_XIMAGE(dblimg)->data; - ptr2 = ptr + (dblimg->bpl >> 1); + srcptr = (guint16 *) GDK_IMAGE_XIMAGE(img)->data; + ptr = (guint16 *) GDK_IMAGE_XIMAGE(dblimg)->data; + ptr2 = ptr + (dblimg->bpl >> 1); - for (y = 0; y < img->height; y++) { - for (x = 0; x < img->width; x++) { - pix = *srcptr++; - *ptr++ = pix; - *ptr++ = pix; - *ptr2++ = pix; - *ptr2++ = pix; - } - srcptr += (img->bpl >> 1) - img->width; - ptr += (dblimg->bpl) - dblimg->width; - ptr2 += (dblimg->bpl) - dblimg->width; - } + for (y = 0; y < img->height; y++) { + for (x = 0; x < img->width; x++) { + pix = *srcptr++; + *ptr++ = pix; + *ptr++ = pix; + *ptr2++ = pix; + *ptr2++ = pix; + } + srcptr += (img->bpl >> 1) - img->width; + ptr += (dblimg->bpl) - dblimg->width; + ptr2 += (dblimg->bpl) - dblimg->width; + } } if (dblimg->bpp == 3) { - register guint8 *srcptr, *ptr, *ptr2, pix1, pix2, pix3; + register guint8 *srcptr, *ptr, *ptr2, pix1, pix2, pix3; - srcptr = GDK_IMAGE(img)->mem; - ptr = GDK_IMAGE(dblimg)->mem; - ptr2 = ptr + dblimg->bpl; + srcptr = GDK_IMAGE(img)->mem; + ptr = GDK_IMAGE(dblimg)->mem; + ptr2 = ptr + dblimg->bpl; - for (y = 0; y < img->height; y++) { - for (x = 0; x < img->width; x++) { - pix1 = *srcptr++; - pix2 = *srcptr++; - pix3 = *srcptr++; - *ptr++ = pix1; - *ptr++ = pix2; - *ptr++ = pix3; - *ptr++ = pix1; - *ptr++ = pix2; - *ptr++ = pix3; - *ptr2++ = pix1; - *ptr2++ = pix2; - *ptr2++ = pix3; - *ptr2++ = pix1; - *ptr2++ = pix2; - *ptr2++ = pix3; + for (y = 0; y < img->height; y++) { + for (x = 0; x < img->width; x++) { + pix1 = *srcptr++; + pix2 = *srcptr++; + pix3 = *srcptr++; + *ptr++ = pix1; + *ptr++ = pix2; + *ptr++ = pix3; + *ptr++ = pix1; + *ptr++ = pix2; + *ptr++ = pix3; + *ptr2++ = pix1; + *ptr2++ = pix2; + *ptr2++ = pix3; + *ptr2++ = pix1; + *ptr2++ = pix2; + *ptr2++ = pix3; - } - srcptr += img->bpl - (img->width * 3); - ptr += (dblimg->bpl << 1) - (dblimg->width * 3); - ptr2 += (dblimg->bpl << 1) - (dblimg->width * 3); - } + } + srcptr += img->bpl - (img->width * 3); + ptr += (dblimg->bpl << 1) - (dblimg->width * 3); + ptr2 += (dblimg->bpl << 1) - (dblimg->width * 3); + } } if (dblimg->bpp == 4) { - register guint32 *srcptr, *ptr, *ptr2, pix; + register guint32 *srcptr, *ptr, *ptr2, pix; - srcptr = (guint32 *) GDK_IMAGE(img)->mem; - ptr = (guint32 *) GDK_IMAGE(dblimg)->mem; - ptr2 = ptr + (dblimg->bpl >> 2); + srcptr = (guint32 *) GDK_IMAGE(img)->mem; + ptr = (guint32 *) GDK_IMAGE(dblimg)->mem; + ptr2 = ptr + (dblimg->bpl >> 2); - for (y = 0; y < img->height; y++) { - for (x = 0; x < img->width; x++) { - pix = *srcptr++; - *ptr++ = pix; - *ptr++ = pix; - *ptr2++ = pix; - *ptr2++ = pix; - } - srcptr += (img->bpl >> 2) - img->width; - ptr += (dblimg->bpl >> 1) - dblimg->width; - ptr2 += (dblimg->bpl >> 1) - dblimg->width; - } + for (y = 0; y < img->height; y++) { + for (x = 0; x < img->width; x++) { + pix = *srcptr++; + *ptr++ = pix; + *ptr++ = pix; + *ptr2++ = pix; + *ptr2++ = pix; + } + srcptr += (img->bpl >> 2) - img->width; + ptr += (dblimg->bpl >> 1) - dblimg->width; + ptr2 += (dblimg->bpl >> 1) - dblimg->width; + } } return dblimg; }