Re: GtkInfoBar - How do you set "button-spacing" style property.

2017-08-29 Thread David C. Rankin
On 08/29/2017 11:48 PM, David C. Rankin wrote:

> How do you package this snippet of any rcfile and have it read by your
> application -- in addition to the default theme in use? (Gtk+2)?
> 

Got it -- gtk_rc_parse (filename);

-- 
David C. Rankin, J.D.,P.E.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkInfoBar - How do you set "button-spacing" style property.

2017-08-29 Thread David C. Rankin
On 08/27/2017 04:53 AM, David C. Rankin wrote:
> 
>   The problem is the 6px spacing is way to big and the info bar takes up too
> much space. I want to set the "button-spacing" style property to 2 (or 1) to
> cut down the vertical height.
> 
>   How do I set the "button-spacing" style property?
> 
> (it's these little, seemingly simple things, that are the most frustrating)
> 
> 

Well,

  I can't find an easy way to do it. I stumbled around and created an rcfile
entry that will do it. Here is what I cam up with:

style "infobar-button-spacing"
{
   GtkInfoBar::button-spacing = 2
}
widget_class "*.GtkInfoBar" style "infobar-button-spacing"

  Is there a better way to do it? Is there a better way to limit application
and search time to only apply to infobars?

How do you package this snippet of any rcfile and have it read by your
application -- in addition to the default theme in use? (Gtk+2)?

-- 
David C. Rankin, J.D.,P.E.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: turn on italics in TextView

2017-08-29 Thread Doug McCasland
Indeed I tried your code from Aug 15 and if you insert a character at the
beginning of the 3rd or 5th line, the indent/margin disappears.  Then if
you backspace over that inserted character, the indent/margin re-appears.
I tried this in <3.20 and 3.22.  Would you consider this a bug?  I've never
reported a bug to GTK.  What is the basic procedure?

On Tue, Aug 15, 2017 at 2:38 PM, Doug McCasland  wrote:

> Indeed, gtk_text_buffer_insert_with_tags_by_name() does what it says.
> What I was talking about was (in some future Textview) applying the tag to
> an iter, then whenever the insert point was on that iter, it would inherit
> the tag properties set there.  So typing at that point gets the
> formatting.
>
> I don't have my code in front of me, but as I recall the jumpy-cursor
> thing happened with this:
>
>1. Insert some text in a line.
>2. Apply indent 50px to whole line.  The line will be indented on the
>screen.
>3. Start typing at the beginning of line, which will not inherit the
>indent tag.  The indent will disappear on the screen.
>4. Move the cursor to the region with the applied indent -- the indent
>comes back.
>
>
>
> On Tue, Aug 15, 2017 at 2:27 PM,  wrote:
>
>>
>> Have you tried gtk_text_buffer_insert_with_tags_by_name() to insert text
>> with a tag at an iter?
>>
>> What tag combo do you use to get the cursor to bounce around? If I test
>> having two indent tags on the same line, the first one applied wins out.
>> This is what I tested with.
>>
>> Eric
>>
>>
>> /*
>>   gcc -Wall move_cursor1.c -o move_cursor1 `pkg-config --cflags --libs
>> gtk+-3.0`
>>   Tested on GTK3.18 and Ubuntu16.04
>> */
>>
>> #include
>>
>> static void get_style(GtkTextView *tv, GtkMovementStep step, gint count,
>> gboolean extend, gpointer *user_data)
>>   {
>> static int i=1;
>> GtkTextIter start;
>> GtkTextMark *mark;
>> GtkTextBuffer *buf;
>>
>> buf=gtk_text_view_get_buffer(GTK_TEXT_VIEW(tv));
>>
>> mark=gtk_text_buffer_get_insert(buf);
>> gtk_text_buffer_get_iter_at_mark (buf, , mark);
>> g_print("Iter %i\n", gtk_text_iter_get_offset());
>>
>> GSList *tlist=NULL;
>> GSList *p=NULL;
>> tlist=gtk_text_iter_get_tags();
>> g_print("%i. List %p p %p\n", i, tlist, p);
>> i++;
>> for(p=tlist;p;p=p->next)
>>   {
>> gchar *string=NULL;
>> g_object_get(G_OBJECT(p->data), "name", , NULL);
>> g_print("p %p %s\n", p, string);
>> g_free(string);
>>   }
>>
>> g_print("List %p\n", tlist);
>> if(tlist!=NULL) g_slist_free(tlist);
>>   }
>> int main (int argc, char *argv[])
>>   {
>> gtk_init(, );
>>
>> GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
>> gtk_window_set_title(GTK_WINDOW(window), "Move Cursor");
>> gtk_window_set_default_size(GTK_WINDOW(window), 300, 200);
>> gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
>> g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
>>
>> GtkWidget *textview=gtk_text_view_new();
>> gtk_widget_set_vexpand(textview, TRUE);
>> gtk_widget_set_hexpand(textview, TRUE);
>> g_signal_connect(textview, "move-cursor", G_CALLBACK(get_style),
>> NULL);
>>
>> GtkTextBuffer *buffer=gtk_text_view_get_buff
>> er(GTK_TEXT_VIEW(textview));
>> gtk_text_buffer_create_tag(buffer, "ital", "style",
>> PANGO_STYLE_ITALIC, NULL);
>> gtk_text_buffer_create_tag(buffer, "bold", "weight",
>> PANGO_WEIGHT_BOLD, NULL);
>> gtk_text_buffer_create_tag(buffer, "uline", "underline",
>> PANGO_UNDERLINE_SINGLE, NULL);
>> gtk_text_buffer_create_tag(buffer, "indent", "indent", 20, NULL);
>> gtk_text_buffer_create_tag(buffer, "indent2", "indent", 40, NULL);
>> gtk_text_buffer_create_tag(buffer, "left-margin", "left-margin", 20,
>> NULL);
>> gtk_text_buffer_create_tag(buffer, "left-margin2", "left-margin",
>> 40, NULL);
>>
>> GtkTextIter iter;
>> gtk_text_buffer_get_start_iter(buffer, );
>> gtk_text_buffer_insert_with_tags_by_name(buffer, , "ital ", -1,
>> "ital", NULL);
>> gtk_text_buffer_get_end_iter(buffer, );
>> gtk_text_buffer_insert_with_tags_by_name(buffer, , "bold ", -1,
>> "bold", NULL);
>> gtk_text_buffer_get_end_iter(buffer, );
>> //Check a newline for a tag.
>> gtk_text_buffer_insert_with_tags_by_name(buffer, , "uline \n",
>> -1, "uline", NULL);
>> gtk_text_buffer_get_end_iter(buffer, );
>> gtk_text_buffer_insert_with_tags_by_name(buffer, , "all\n", -1,
>> "ital", "bold", "uline", NULL);
>> //Check indents in the same line.
>> gtk_text_buffer_get_end_iter(buffer, );
>> gtk_text_buffer_insert_with_tags_by_name(buffer, , "indent ",
>> -1, "indent", NULL);
>> gtk_text_buffer_get_end_iter(buffer, );
>> gtk_text_buffer_insert_with_tags_by_name(buffer, , "indent2\n",
>> -1, "indent2", NULL);
>> gtk_text_buffer_get_end_iter(buffer, );
>> 

GLib doesn't find the ui resource

2017-08-29 Thread Sascha Manns
Hello list,

i have written some ui files which are compiled through make [1]. I
installed the compiled file in /usr/share/gnome-publisher.

Also i used this lines to add stuff from the resource:
builder = Gtk.Builder()

builder.add_from_resource("/org/gnome/Publisher/ui/main_intro.ui") [2]

But if i'm running my app, i'm getting:

/home/sascha/PycharmProjects/gnome-publisher/.env/bin/python3
/home/sascha/PycharmProjects/gnome-publisher/bin/gnome-publisher
Traceback (most recent call last):
  File
"/home/sascha/PycharmProjects/gnome-publisher/src/gnome_publisher/__main__.py",
line 54, in do_startup
builder.add_from_resource('/org/gnome/Publisher/gtk/app_menu.ui')
GLib.Error: g-resource-error-quark: The resource at
“/org/gnome/Publisher/gtk/app_menu.ui” does not exist (0)
Traceback (most recent call last):
  File
"/home/sascha/PycharmProjects/gnome-publisher/src/gnome_publisher/__main__.py",
line 96, in do_activate
builder.add_from_resource("/org/gnome/Publisher/ui/main_intro.ui")
GLib.Error: g-resource-error-quark: The resource at
“/org/gnome/Publisher/ui/main_intro.ui” does not exist (0)

But where the GLib searches for the file?

[1]
https://github.com/saigkill/gnome-publisher/blob/master/data/org.gnome.Publisher.gresource.xml
[2]
https://github.com/saigkill/gnome-publisher/blob/master/src/gnome_publisher/__main__.py

-- 
Sascha Manns
Maifeldstraße 10
56727 Mayen

P: +49-2651-4014045
W: http://saigkill.tuxfamily.org

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