summaryrefslogtreecommitdiff
path: root/font-viewer
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2017-01-08 18:47:42 +0100
committerraveit65 <[email protected]>2017-02-17 12:28:22 +0100
commitd77ff1f0f14f2b05367fa8101b5621ef5f615c66 (patch)
treeb0ef687ba9b52b0445035109f0a6e1ed47c65ea5 /font-viewer
parent25d089f8582ede5e59a446208eb442af1e1df8e5 (diff)
downloadmate-control-center-d77ff1f0f14f2b05367fa8101b5621ef5f615c66.tar.bz2
mate-control-center-d77ff1f0f14f2b05367fa8101b5621ef5f615c66.tar.xz
Fontviewer: match the font face when getting an iter to update the button
Instead of matching the file name, match the font face (i.e. its family/style names). Since we refresh the button appearance when installing a font over to ~/.fonts, the file path will not match at that point, since the preview will still be showing the old uninstalled file. taken from: https://git.gnome.org/browse/gnome-font-viewer/commit/?id=09a6285
Diffstat (limited to 'font-viewer')
-rw-r--r--font-viewer/font-view.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/font-viewer/font-view.c b/font-viewer/font-view.c
index 0b427a1d..f5914a74 100644
--- a/font-viewer/font-view.c
+++ b/font-viewer/font-view.c
@@ -250,23 +250,21 @@ static void
install_button_refresh_appearance (FontViewApplication *self,
GError *error)
{
- gchar *path;
+ FT_Face face;
if (error != NULL) {
gtk_button_set_label (GTK_BUTTON (self->install_button), _("Install Failed"));
gtk_widget_set_sensitive (self->install_button, FALSE);
} else {
- path = g_file_get_path (self->font_file);
+ face = sushi_font_widget_get_ft_face (SUSHI_FONT_WIDGET (self->font_widget));
- if (font_view_model_get_iter_for_file (FONT_VIEW_MODEL (self->model), path, NULL)) {
+ if (font_view_model_get_iter_for_face (FONT_VIEW_MODEL (self->model), face, NULL)) {
gtk_button_set_label (GTK_BUTTON (self->install_button), _("Installed"));
gtk_widget_set_sensitive (self->install_button, FALSE);
} else {
gtk_button_set_label (GTK_BUTTON (self->install_button), _("Install"));
gtk_widget_set_sensitive (self->install_button, TRUE);
}
-
- g_free (path);
}
}
@@ -279,9 +277,10 @@ font_install_finished_cb (GObject *source_object,
GError *err = NULL;
g_file_copy_finish (G_FILE (source_object), res, &err);
- install_button_refresh_appearance (self, err);
if (err != NULL) {
+ install_button_refresh_appearance (self, err);
+
g_debug ("Install failed: %s", err->message);
g_error_free (err);
}
@@ -358,6 +357,8 @@ font_widget_loaded_cb (SushiFontWidget *font_widget,
gd_main_toolbar_set_labels (GD_MAIN_TOOLBAR (self->toolbar),
face->family_name, face->style_name);
+
+ install_button_refresh_appearance (self, NULL);
}
static void
@@ -409,7 +410,6 @@ font_view_application_do_open (FontViewApplication *self)
self->install_button = gd_main_toolbar_add_button (GD_MAIN_TOOLBAR (self->toolbar),
NULL, _("Install"),
FALSE);
- install_button_refresh_appearance (self, NULL);
g_signal_connect (self->install_button, "clicked",
G_CALLBACK (install_button_clicked_cb), self);