mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 23:00:07 +00:00
3f498adfb0
2006-07-18 Federico Mena Quintero <federico@novell.com> Fix https://bugzilla.novell.com/show_bug.cgi?id=184875 - make the location entry in Save mode preserve the stuff from set_filename(); it was overwriting it with $cwd. This is the same fix for http://bugzilla.gnome.org/show_bug.cgi?id=347066 * tests/autotestfilechooser.c: (test_black_box): Added black-box test for set_filename() and set_current_name(). * gtk/gtkfilechooser.c (gtk_file_chooser_get_type): Cast to GClassInitFunc in the call to g_type_register_static_simple(), to avoid a compiler warning. * gtk/gtkfilechooserprivate.h (struct _GtkFileChooserDefault): Added a browse_files_last_selected_name field. We'll copy the logic from gtkfilesel.c to see when to clear the location entry. (struct _GtkFileChooserDefault): Removed the processing_pending_selections field. * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_finalize): Free impl->browse_files_last_selected_name. (pending_select_paths_process): Don't use impl->processing_pending_selections. (update_chooser_entry): Keep track of the name that was last selected in the file list. We use this to know when to clear the location entry. The logic is similar to that of gtkfilesel.c:gtk_file_selection_file_changed(). This also lets us get rid of the processing_pending_selections flag. (update_chooser_entry): Clear the entry if we didn't have a selection before. (location_switch_to_filename_entry): Do not set $cwd as the contents of the location entry here... (location_popup_handler): ... but do it here instead, only as the result of the user asking to turn on the location entry. (gtk_file_chooser_default_get_paths): If the location entry is empty, do the fallback of seeing if it is sensible to say that $cwd is the selected path. (gtk_file_chooser_default_update_current_folder): Don't set the text of the location entry; this is no longer needed with the fixes above. (shortcuts_activate_iter): Clear the location entry when activating a shortcut if we are not in SAVE mode. This keeps the contents of the location entry consistent even when switching folders via the shortcuts.
67 lines
1.4 KiB
C
67 lines
1.4 KiB
C
#include <stdio.h>
|
|
#include <gtk/gtk.h>
|
|
#include "gtkwidgetprofiler.h"
|
|
#include "widgets.h"
|
|
|
|
#define ITERS 100000
|
|
|
|
static GtkWidget *
|
|
create_widget_cb (GtkWidgetProfiler *profiler, gpointer data)
|
|
{
|
|
return appwindow_new ();
|
|
}
|
|
|
|
static void
|
|
report_cb (GtkWidgetProfiler *profiler, GtkWidgetProfilerReport report, GtkWidget *widget, gdouble elapsed, gpointer data)
|
|
{
|
|
const char *type;
|
|
|
|
switch (report) {
|
|
case GTK_WIDGET_PROFILER_REPORT_CREATE:
|
|
type = "widget creation";
|
|
break;
|
|
|
|
case GTK_WIDGET_PROFILER_REPORT_MAP:
|
|
type = "widget map";
|
|
break;
|
|
|
|
case GTK_WIDGET_PROFILER_REPORT_EXPOSE:
|
|
type = "widget expose";
|
|
break;
|
|
|
|
case GTK_WIDGET_PROFILER_REPORT_DESTROY:
|
|
type = "widget destruction";
|
|
break;
|
|
|
|
default:
|
|
g_assert_not_reached ();
|
|
type = NULL;
|
|
}
|
|
|
|
fprintf (stdout, "%s: %g sec\n", type, elapsed);
|
|
|
|
if (report == GTK_WIDGET_PROFILER_REPORT_DESTROY)
|
|
fputs ("\n", stdout);
|
|
}
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
GtkWidgetProfiler *profiler;
|
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
profiler = gtk_widget_profiler_new ();
|
|
g_signal_connect (profiler, "create-widget",
|
|
G_CALLBACK (create_widget_cb), NULL);
|
|
g_signal_connect (profiler, "report",
|
|
G_CALLBACK (report_cb), NULL);
|
|
|
|
gtk_widget_profiler_set_num_iterations (profiler, ITERS);
|
|
|
|
/* gtk_widget_profiler_profile_boot (profiler); */
|
|
gtk_widget_profiler_profile_expose (profiler);
|
|
|
|
return 0;
|
|
}
|