Re: gtktextview with gdkpixbuf saving into file

2008-11-17 Thread Pavel A. da Mek

anyone know a way to save a gtktextview/gtktextbuffer with embedded
gdkpixbuf into a file. I am calling gtk_text_buffer_get_slice then
g_file_set_contents. Idealy it will be good if i can just call
g_file_get_contents to output the saved buffer onto the gtktextview.



void save_grt (GtkTextView *textView, const gchar *dstFileName) {
GtkTextBuffer *buffer;
GdkAtom grtSerializeFormat;
GtkTextIter startIter;
GtkTextIter endIter;
guint8* serializedData;
gsize length;

buffer = gtk_text_view_get_buffer (textView);

grtSerializeFormat = gtk_text_buffer_register_serialize_tagset (
 buffer, //GtkTextBuffer *buffer,
 NULL // const gchar *tagset_name
);
gtk_text_buffer_get_bounds  (buffer, &startIter, &endIter);

serializedData = gtk_text_buffer_serialize (
 buffer, // GtkTextBuffer *register_buffer,
 buffer, // GtkTextBuffer *content_buffer,
 grtSerializeFormat, // GdkAtom format,
 &startIter, // const GtkTextIter *start,
 &endIter, // const GtkTextIter *end,
 &length // gsize *length
);

// gboolean success =
g_file_set_contents (dstFileName,
 serializedData, // const gchar *contents,
 length, // gssize length,
 NULL // GError **error
);

g_free (serializedData);

gtk_text_buffer_unregister_serialize_format (buffer, 
grtSerializeFormat);

} // *** of void save_grt

void open_grt (GtkTextView *textView, const gchar *srcFileName) {
GtkTextBuffer *buffer;
GdkAtom grtDeserializeFormat;
GtkTextIter startIter;
GtkTextIter endIter;
guint8* serializedData;
gsize length;

// gboolean success =
g_file_get_contents (
 srcFileName,
 (gchar **)&serializedData, // gchar **contents,
 &length, // gsize *length,
 NULL // GError **error
);

buffer = gtk_text_view_get_buffer (textView);

grtDeserializeFormat = gtk_text_buffer_register_deserialize_tagset (
 buffer, //GtkTextBuffer *buffer,
 NULL // const gchar *tagset_name
);
gtk_text_buffer_deserialize_set_can_create_tags (
 buffer, grtDeserializeFormat, TRUE);

gtk_text_buffer_get_bounds (buffer, &startIter, &endIter);
gtk_text_buffer_delete (buffer, &startIter, &endIter);

// gboolean success =
gtk_text_buffer_deserialize (
 buffer, // GtkTextBuffer *register_buffer,
 buffer, // GtkTextBuffer *content_buffer,
 grtDeserializeFormat, // GdkAtom format,
 &startIter, // const GtkTextIter *iter,
 serializedData, // const guint8 *data,
 length, // gsize length
 NULL // GError **error
);

g_free (serializedData);
gtk_text_buffer_unregister_deserialize_format (buffer, 
grtDeserializeFormat);

} // *** of void open_grt


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Handler disconnect vs. block

2008-11-17 Thread Paul Pogonyshev
Jeffrey Barish wrote:
> Is there a reason to block/unblock a handler rather than disconnect/connect
> it? Is the overhead for block/unblock significantly lower?

Off the top of my head I can think of one: block/unblock will certainly not
change handler order, while disconnect/connect may.  Overhead must not be
significant unless you are doing it say 1 times a second.

> One thing I don't like about block/unblock is that GTK issues a warning when
> you try to unblock a handler that is not blocked, but there is no way to
> ask first whether the handler is currently blocked.  disconnect/connect
> offers the handler_is_connected query.

It seems g_signal_handler_find() could be misused for this, though in any
way this will be ugly.

Paul
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Tips on translating to other languages

2008-11-17 Thread Garth's KidStuff
Hi All,

I'm working on a very large Application that has already shipped in multiple
languages on Mac and Windows.  There's a whole scheme in place which already
works to extract strings from a special text file so I don't need to use any
of the gettext stuff as described in the gtkmm documentation here:

http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/chapter-internationalization.html

My question is, how do I tell gtk to load the Spanish version of system
dialogs (e.g. the File Open dialog).

TIA

-Garth

Garth Upshaw
Garth's KidStuff
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Handler disconnect vs. block

2008-11-17 Thread Jeffrey Barish
Is there a reason to block/unblock a handler rather than disconnect/connect
it? Is the overhead for block/unblock significantly lower?

One thing I don't like about block/unblock is that GTK issues a warning when
you try to unblock a handler that is not blocked, but there is no way to
ask first whether the handler is currently blocked.  disconnect/connect
offers the handler_is_connected query.
-- 
Jeffrey Barish

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkIconView and missed highlight of the row

2008-11-17 Thread Giuseppe Torelli
Hi,

I created a gtkcellrenderer this way:

pixbuf_cell = gtk_cell_renderer_pixbuf_new();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT
(img_struct->thumbnail_iconview), pixbuf_cell, FALSE);
g_object_set (pixbuf_cell, "width", 115, "xalign", 0.5, "yalign", 0.5, NULL);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT
(img_struct->thumbnail_iconview), pixbuf_cell, "pixbuf", 0, NULL);

And then I set some things on the iconview:
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW
(img_struct->thumbnail_iconview), GTK_SELECTION_MULTIPLE);
gtk_icon_view_set_orientation (GTK_ICON_VIEW
(img_struct->thumbnail_iconview), GTK_ORIENTATION_HORIZONTAL);
gtk_icon_view_set_column_spacing (GTK_ICON_VIEW
(img_struct->thumbnail_iconview),0);
gtk_icon_view_set_row_spacing (GTK_ICON_VIEW
(img_struct->thumbnail_iconview),0);
gtk_icon_view_set_columns (GTK_ICON_VIEW
(img_struct->thumbnail_iconview), G_MAXINT);
gtk_container_add (GTK_CONTAINER (thumb_scrolledwindow),
img_struct->thumbnail_iconview);

The problem is that when I click on the thumbnail in the iconview it's
not highlighted with the blue background color.

Can you explain me where I'm wrong?
-- 
Colossus
Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.xfce.org
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Basic GNOME applet developement

2008-11-17 Thread Andrew M.
On Mon, November 17, 2008 7:48 am, Michael Ott wrote:
> Hello Andrew!
>
>> >> I am attempting my first Gnome applet creation and I found a great
tutorial at http://projects.gnome.org/ORBit2/appletstutorial.html .
Unfortunately, I am stuck where the example goes to load an image. I
>> can
>> >> compile the applet and make it run but when I add it to the Gnome bar
>> it
>> >> doesn't show anything. I have some printf's in the code and those
>> work
>> >> on
>> >> the console.
>> > Do you have an .server file?
>> >
>> > Do you try it with panel-test-applets?
>> >
>> > With a server file and panel-test-applets it will work. Perhaps.
>> I do indeed have the .server file.
> Can you send me the file?



























>
>> From that same page I was able to make the first example work and do some
>> small modifications. But when I try to go on to the second step,
nothing happens. The applet runs from a command line and executes my
printf()'s but nothing shows up on the panel.
> I believe, that you cannot see anything on the panel. I tested it always
with panel-test-applets.

I'm afraid I have no idea what panel-test-applets is..

Andrew



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: combobox entries background color

2008-11-17 Thread Stefan Kost
hi,
Xavier Toth schrieb:
> I didn't get any responses so I'm trying again.
>   

Look at GtkCellRenderer and its "cell-background"  property.

Stefan
> On Mon, Nov 3, 2008 at 8:37 AM, Xavier Toth <[EMAIL PROTECTED]> wrote:
>   
>> I'd like to have different background colors on combobox entries.
>> Potentially each entry would have a different background color. Is
>> there a way to do this?
>>
>> Ted
>>
>> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>   

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list