forked from AuroraMiddleware/gtk
filefiler: No more floating
Make GtkFileFilter not be initially unowned anymore. This is in preparation for deriving GtkFileFilter from GtkFilter. Update all callers.
This commit is contained in:
parent
d65214fa4e
commit
acccac516e
@ -90,12 +90,12 @@ typedef enum {
|
||||
|
||||
struct _GtkFileFilterClass
|
||||
{
|
||||
GInitiallyUnownedClass parent_class;
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
struct _GtkFileFilter
|
||||
{
|
||||
GInitiallyUnowned parent_instance;
|
||||
GObject parent_instance;
|
||||
|
||||
gchar *name;
|
||||
GSList *rules;
|
||||
@ -156,7 +156,7 @@ static void gtk_file_filter_buildable_custom_tag_end (GtkBuildable
|
||||
const gchar *tagname,
|
||||
gpointer data);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkFileFilter, gtk_file_filter, G_TYPE_INITIALLY_UNOWNED,
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkFileFilter, gtk_file_filter, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
||||
gtk_file_filter_buildable_init))
|
||||
|
||||
|
@ -393,6 +393,7 @@ main (int argc, char **argv)
|
||||
|
||||
/* Make this filter the default */
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, "No backup files");
|
||||
@ -400,11 +401,13 @@ main (int argc, char **argv)
|
||||
no_backup_files_filter, NULL, NULL);
|
||||
gtk_file_filter_add_mime_type (filter, "image/png");
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, "Starts with D");
|
||||
gtk_file_filter_add_pattern (filter, "D*");
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
g_signal_connect (dialog, "notify::filter",
|
||||
G_CALLBACK (filter_changed), NULL);
|
||||
@ -414,11 +417,13 @@ main (int argc, char **argv)
|
||||
gtk_file_filter_add_mime_type (filter, "image/jpeg");
|
||||
gtk_file_filter_add_mime_type (filter, "image/png");
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, "Images");
|
||||
gtk_file_filter_add_pixbuf_formats (filter);
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
/* Choices */
|
||||
|
||||
|
@ -5692,17 +5692,20 @@ native_filter_changed (GtkWidget *combo,
|
||||
gtk_file_filter_add_pattern (filter, "*.doc");
|
||||
gtk_file_filter_add_pattern (filter, "*.txt");
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (native), filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, "Images");
|
||||
gtk_file_filter_add_pixbuf_formats (filter);
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (native), filter);
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (native), filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, "All");
|
||||
gtk_file_filter_add_pattern (filter, "*");
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (native), filter);
|
||||
g_object_unref (filter);
|
||||
break;
|
||||
|
||||
case 2: /* mimetype */
|
||||
@ -5710,12 +5713,14 @@ native_filter_changed (GtkWidget *combo,
|
||||
gtk_file_filter_set_name (filter, "Text");
|
||||
gtk_file_filter_add_mime_type (filter, "text/plain");
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (native), filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, "All");
|
||||
gtk_file_filter_add_pattern (filter, "*");
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (native), filter);
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (native), filter);
|
||||
g_object_unref (filter);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
|
Loading…
Reference in New Issue
Block a user