Commit 0ca5b099 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

connect the preview on the context's font object with the font property of

2003-03-26  Sven Neumann  <sven@gimp.org>

	* app/tools/gimptextoptions.c: connect the preview on the
	context's font object with the font property of the text object
	associated to the text tool options.
parent 7c64198e
2003-03-26 Sven Neumann <sven@gimp.org>
* app/tools/gimptextoptions.c: connect the preview on the
context's font object with the font property of the text object
associated to the text tool options.
2003-03-26 Michael Natterer <mitch@gimp.org>
 
* app/widgets/gimpdnd.[ch]: added GimpFont DND.
......@@ -30,6 +30,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpcontainer.h"
#include "core/gimptoolinfo.h"
#include "text/gimptext.h"
......@@ -61,6 +62,13 @@ static void gimp_text_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gimp_text_options_notify_font (GimpContext *context,
GParamSpec *pspec,
GimpText *text);
static void gimp_text_notify_font (GimpText *text,
GParamSpec *pspec,
GimpContext *context);
static void gimp_text_options_font_clicked (GtkWidget *widget,
GimpContext *context);
......@@ -122,6 +130,13 @@ gimp_text_options_init (GimpTextOptions *options)
options->text = GIMP_TEXT (text);
options->buffer = gimp_prop_text_buffer_new (text, "text", -1);
g_signal_connect_object (options, "notify::font",
G_CALLBACK (gimp_text_options_notify_font),
text, 0);
g_signal_connect_object (text, "notify::font",
G_CALLBACK (gimp_text_notify_font),
options, 0);
}
static void
......@@ -145,6 +160,55 @@ gimp_text_options_get_property (GObject *object,
}
}
static void
gimp_text_options_notify_font (GimpContext *context,
GParamSpec *pspec,
GimpText *text)
{
GimpFont *font = gimp_context_get_font (context);
g_signal_handlers_block_by_func (text,
gimp_text_notify_font,
context);
g_object_set (text,
"font", gimp_object_get_name (GIMP_OBJECT (font)),
NULL);
g_signal_handlers_unblock_by_func (text,
gimp_text_notify_font,
context);
}
static void
gimp_text_notify_font (GimpText *text,
GParamSpec *pspec,
GimpContext *context)
{
GimpObject *font;
gchar *value;
g_object_get (text,
"font", &value,
NULL);
font = gimp_container_get_child_by_name (context->gimp->fonts, value);
g_free (value);
g_signal_handlers_block_by_func (context,
gimp_text_options_notify_font,
text);
g_object_set (context,
"font", font,
NULL);
g_signal_handlers_unblock_by_func (context,
gimp_text_options_notify_font,
text);
}
GtkWidget *
gimp_text_options_gui (GimpToolOptions *tool_options)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment