mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 22:30:22 +00:00
fontchooser: Add a way to set a GtkFilter
We keep this private, since the chooser apis are going away. This will be used in GtkFontDialog.
This commit is contained in:
parent
bdc91c2339
commit
bd5dedce12
@ -21,7 +21,7 @@
|
|||||||
#include <glib/gprintf.h>
|
#include <glib/gprintf.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "gtkfontchooserdialog.h"
|
#include "gtkfontchooserdialogprivate.h"
|
||||||
#include "gtkfontchooser.h"
|
#include "gtkfontchooser.h"
|
||||||
#include "gtkfontchooserwidget.h"
|
#include "gtkfontchooserwidget.h"
|
||||||
#include "gtkfontchooserwidgetprivate.h"
|
#include "gtkfontchooserwidgetprivate.h"
|
||||||
@ -324,3 +324,10 @@ gtk_font_chooser_dialog_buildable_get_internal_child (GtkBuildable *buildable,
|
|||||||
|
|
||||||
return parent_buildable_iface->get_internal_child (buildable, builder, childname);
|
return parent_buildable_iface->get_internal_child (buildable, builder, childname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_font_chooser_dialog_set_filter (GtkFontChooserDialog *dialog,
|
||||||
|
GtkFilter *filter)
|
||||||
|
{
|
||||||
|
gtk_font_chooser_widget_set_filter (GTK_FONT_CHOOSER_WIDGET (dialog->fontchooser), filter);
|
||||||
|
}
|
||||||
|
31
gtk/gtkfontchooserdialogprivate.h
Normal file
31
gtk/gtkfontchooserdialogprivate.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/* GTK - The GIMP Toolkit
|
||||||
|
* Copyright (C) 2017 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GTK_FONT_CHOOSER_DIALOG_PRIVATE_H__
|
||||||
|
#define __GTK_FONT_CHOOSER_DIALOG_PRIVATE_H__
|
||||||
|
|
||||||
|
#include "gtkfontchooserdialog.h"
|
||||||
|
#include "gtkfilter.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
void gtk_font_chooser_dialog_set_filter (GtkFontChooserDialog *dialog,
|
||||||
|
GtkFilter *filter);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GTK_FONT_CHOOSER_WIDGET_PRIVATE_H__ */
|
@ -63,6 +63,7 @@
|
|||||||
#include "gtksortlistmodel.h"
|
#include "gtksortlistmodel.h"
|
||||||
#include "gtkstringsorter.h"
|
#include "gtkstringsorter.h"
|
||||||
#include "gtkdropdown.h"
|
#include "gtkdropdown.h"
|
||||||
|
#include "gtkmultifilter.h"
|
||||||
|
|
||||||
#include <hb-ot.h>
|
#include <hb-ot.h>
|
||||||
|
|
||||||
@ -105,6 +106,7 @@ struct _GtkFontChooserWidget
|
|||||||
GtkSingleSelection *selection;
|
GtkSingleSelection *selection;
|
||||||
GtkCustomFilter *custom_filter;
|
GtkCustomFilter *custom_filter;
|
||||||
GtkCustomFilter *user_filter;
|
GtkCustomFilter *user_filter;
|
||||||
|
GtkCustomFilter *multi_filter;
|
||||||
GtkFilterListModel *filter_model;
|
GtkFilterListModel *filter_model;
|
||||||
|
|
||||||
GtkWidget *preview;
|
GtkWidget *preview;
|
||||||
@ -144,6 +146,8 @@ struct _GtkFontChooserWidget
|
|||||||
gpointer filter_data;
|
gpointer filter_data;
|
||||||
GDestroyNotify filter_data_destroy;
|
GDestroyNotify filter_data_destroy;
|
||||||
|
|
||||||
|
GtkFilter *filter;
|
||||||
|
|
||||||
guint last_fontconfig_timestamp;
|
guint last_fontconfig_timestamp;
|
||||||
|
|
||||||
GtkFontChooserLevel level;
|
GtkFontChooserLevel level;
|
||||||
@ -1325,6 +1329,8 @@ gtk_font_chooser_widget_finalize (GObject *object)
|
|||||||
|
|
||||||
g_free (fontchooser->font_features);
|
g_free (fontchooser->font_features);
|
||||||
|
|
||||||
|
g_clear_object (&fontchooser->filter);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_font_chooser_widget_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gtk_font_chooser_widget_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2976,3 +2982,14 @@ gtk_font_chooser_widget_get_tweak_action (GtkWidget *widget)
|
|||||||
|
|
||||||
return fontchooser->tweak_action;
|
return fontchooser->tweak_action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_font_chooser_widget_set_filter (GtkFontChooserWidget *widget,
|
||||||
|
GtkFilter *filter)
|
||||||
|
{
|
||||||
|
if (widget->filter)
|
||||||
|
gtk_multi_filter_remove (GTK_MULTI_FILTER (widget->multi_filter), 3);
|
||||||
|
g_set_object (&widget->filter, filter);
|
||||||
|
if (widget->filter)
|
||||||
|
gtk_multi_filter_append (GTK_MULTI_FILTER (widget->multi_filter), g_object_ref (filter));
|
||||||
|
}
|
||||||
|
@ -19,11 +19,15 @@
|
|||||||
#define __GTK_FONT_CHOOSER_WIDGET_PRIVATE_H__
|
#define __GTK_FONT_CHOOSER_WIDGET_PRIVATE_H__
|
||||||
|
|
||||||
#include "gtkfontchooserwidget.h"
|
#include "gtkfontchooserwidget.h"
|
||||||
|
#include "gtkfilter.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
GAction *gtk_font_chooser_widget_get_tweak_action (GtkWidget *fontchooser);
|
GAction *gtk_font_chooser_widget_get_tweak_action (GtkWidget *fontchooser);
|
||||||
|
|
||||||
|
void gtk_font_chooser_widget_set_filter (GtkFontChooserWidget *widget,
|
||||||
|
GtkFilter *filter);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_FONT_CHOOSER_WIDGET_PRIVATE_H__ */
|
#endif /* __GTK_FONT_CHOOSER_WIDGET_PRIVATE_H__ */
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<signal name="notify::pending" handler="rows_changed_cb" object="GtkFontChooserWidget" swapped="1"/>
|
<signal name="notify::pending" handler="rows_changed_cb" object="GtkFontChooserWidget" swapped="1"/>
|
||||||
<property name="incremental">1</property>
|
<property name="incremental">1</property>
|
||||||
<property name="filter">
|
<property name="filter">
|
||||||
<object class="GtkEveryFilter">
|
<object class="GtkEveryFilter" id="multi_filter">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStringFilter">
|
<object class="GtkStringFilter">
|
||||||
<binding name="search">
|
<binding name="search">
|
||||||
|
Loading…
Reference in New Issue
Block a user