Re: Multiple colors in vte

2016-01-12 Thread Marcus Karlsson
On Sun, Jan 10, 2016 at 08:19:48PM +0100, gil...@gmx.net wrote:
> Hi list,
> sorry if this question is redundant, I haven't found any answers after 
> searching yet.
> 
> Is there a way to set multiple colors in a vte programatically?
> I can see how you can set the color for the whole text and I understand that 
> there are color-codes for bash but since I want to use VTE for a very custom 
> terminal, I need to set multiple colors programatically. Right now I'm using 
> a TextView to achieve this but it seems to be too slow when successively 
> updating large parts of the screen.
> 
> Thanks in advance fpr any hint.

It's the program that outputs to the VTE that sets the color using
standardized escape sequences. Is that what you want to use?

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


Re: data type that preserve order

2015-10-31 Thread Marcus Karlsson
On Sat, Oct 31, 2015 at 07:10:20AM +, Andrea Zagli wrote:
> Il giorno ven 30 ott 2015 19:09:47 CET, Emmanuele Bassi ha scritto:
> >Hi;
> >
> >On 30 October 2015 at 16:43, Andrea Zagli  wrote:
> >>is there a data type, similar to array, that preserve the order on which
> >>elements are inserted?
> >
> >All the array and list types preserve the order of insertion. For
> >obvious reasons, GHashTable doesn't.
> >
> >>for example ghashtable and gptrarray doesn't preserve the order, so when
> >>they are traversed (for example with a "for" cicle, regarding gptrarray) the
> >>order may be not the same when elements are inserted
> >
> >GPtrArray preserves the order of insertion — it's an array, after all.
> >Why do you think it does not?
> >
> 
> it is written on the help
> 
> https://developer.gnome.org/glib/stable/glib-Pointer-Arrays.html
> 
> "If you remove elements from the array, elements at the end of the
> array are moved into the space previously occupied by the removed
> element. This means that you should not rely on the index of
> particular elements remaining the same."
> 
> 
> may be also other data type makes the same thing? i didn't find
> reference about that

It depends on how elements are removed from the array, there are two
ways to do it. If you use g_ptr_array_remove then the following elements
are moved down once place and the order is preserved. However if you
instead use g_ptr_array_remove_fast then the last element is moved to
fill the void. GArray offers the same two methods as well.

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

Re: glade 3.19.0 and header bars

2015-10-09 Thread Marcus Karlsson
On Fri, Oct 09, 2015 at 06:37:02PM +0200, rastersoft wrote:
> Hi all:
> 
> Yesterday I tried to open the Glade ui files from Gedit, but glade
> returned an error because they use header bars.
> 
> I cloned the GIT repository of Glade, compiled and installed it (devel
> version, 3.19.0), but it still shows an error instead the header bars.
> 
> What am I doing wrong?
> 
> Thanks.

What error does it show when you open up the file in glade?

I opened gedit-window.ui from gedit with glade 3.19 and all header bars
came up just fine for me at least. You might want to try building glade
with jhbuild just in case something went wrong during the build process.

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


Re: close button

2015-10-08 Thread Marcus Karlsson
On Thu, Oct 08, 2015 at 10:54:01PM +0200, rastersoft wrote:
> Hi all:
> 
> I want to fix the problem in GTK, that doesn't show the "close" button
> when it is put at the left side and the left panel is visible.

I'm affraid it's not clear what you mean here. What doesn't show what
button?

> But to do so in a consisten way I need a way of painting a standard
> "close" button, the one used in gtk_header_bar when "layout" specifies
> "close", with the appearance of a true "close" button. Is it possible
> to do it with a classic GTK button?

If what you want to do is create a button with a "close" symbol then you
can set its icon to either the "window-close" or "window-close-symbolic"
icon.

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


Re: GTK+_failed installation

2015-01-12 Thread Marcus Karlsson
On Mon, Jan 12, 2015 at 10:50:29AM +0100, Nabil Ferguen wrote:
 Hi Marcus,
 
 Thank you for your message.

You're welcome. Just remember to cc the mailing list when you reply,
that will increase your chances of getting answers. :-)

 I've changed the ubunto version and upgraded to 14.10 and I have
 successfully installed all libraries and dependencies for GTK + 3.14, but
 when I run the gtk3-demo I get the error messages (see bellow) for loading
 some modules. Another question, how I can launch OOF2D.

I'm not familiar with OOF2D. Can you explain what it is?

 ---Message from GTK+ 3.14 --
 Gtk-Message: Failed to load module overlay-scrollbar
 Gtk-Message: Failed to load module unity-gtk-module
 Gtk-Message: Failed to load module canberra-gtk-module
 Gtk-Message: Failed to load module canberra-gtk-module

These warnings are usually not a major problem, assuming that gtk3-demo
still comes up successfully.

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


Re: Ruler Class in GTK+ 3

2015-01-09 Thread Marcus Karlsson
On Fri, Jan 09, 2015 at 04:12:12PM +, Emmanuele Bassi wrote:
 my suggestion is to look at ruler widgets in GIMP and Inkscape.

Either that, or the GtkRuler widget itself from GTK 2 [1]. It doesn't
look like it's very complicated and can probably be ported to GTK 3
without too much effort, you just have to keep a copy of it in your app.

Marcus

[1] https://git.gnome.org/browse/gtk+/tree/gtk/gtkruler.c?h=gtk-2-24
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK+_failed installation

2015-01-07 Thread Marcus Karlsson
On Mon, Jan 05, 2015 at 11:28:04AM +0100, Nabil Ferguen wrote:
 Dear Team GTK,
 
 I would like to install gtk+ (for OOF2D) on ubunto 12.04, and I have
 successfully installed all packages (pango, glib, gdk-pixbuf, atk) but
 the compiler fails and sends an error message linked to the atspi-2
 package (requires version  = 2.11.2). I have looked on the web in
 order to find this package but it seems that it is obsolete. How I can
 fix
 this problem.

Are you trying to build a new version of GTK+ from source? Also, what is
the exact error message that you get and what are you doing when you're
getting it?

Ubuntu 12.04 includes an early version of GTK 3; version 3.4 I belive.
If that version is good enough then installing the libgtk-3-dev package
should be enough.

If you want to install a later version for test or development purposes
then using JHBuild [1] is often easiest. It will also be able to build
most of the dependencies for you.

Marcus

[1] https://wiki.gnome.org/Jhbuild
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Get dim-label color

2014-11-06 Thread Marcus Karlsson
On Thu, Nov 06, 2014 at 11:04:08AM +0100, Cedric Bellegarde wrote:
 Hello,

Hi.

 i'm looking for a way to get Gtk.STYLE_CLASS_DIM_LABEL color
 
 Tried to play with style context but failed.

Is it something like this that you want to do? In Python:

sc = widget.get_style_context ()
sc.add_class (Gtk.STYLE_CLASS_DIM_LABEL)

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


Re: How can I use CSS styling in my GTK# application?

2014-11-05 Thread Marcus Karlsson
On Thu, Oct 30, 2014 at 04:23:50AM -0700, don-prog wrote:
 How can I use CSS styling in my GTK# application? I heard before that it is
 impossible to use CSS themes in GTK#, but after that I found  this example
 of using css styling in GTK#
 https://github.com/mono/gtk-sharp/blob/master/sample/GtkDemo/DemoCssBasics.cs
  
 . Besides this I found also the  samples of using CSS styling in Banshee
 project
 https://github.com/GNOME/banshee/blob/715777b2e9d8a4c3ba9e816c54ae1a104f4653c0/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
   
 (which uses GTK#). So how is it possible? I already tried to do the same in
 GTK#, but I didn't find CssProvider class. So how I can find this class in
 GTK# or how I can using CSS styling in GTK#?

Which version of GTK# do you use? The GtkCssProvider class appeared in
GTK+ 3, so the reason why you can't find it might be that you're still
on GTK+ 2.

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


Re: Gtk+-2.0 leaks memory

2014-10-24 Thread Marcus Karlsson
On Fri, Oct 24, 2014 at 04:02:01PM +0200, Joël Krähemann wrote:
 Hi

Hi.

 Gtk+-2.0 leaks memory, please take a look at: http://ags.sourceforge.net
 
 Is Gtk+-2.0 still maintained?

Yes it is. The latest point release happened just two weeks ago.

 Or is migrating to Gtk+-3.0 the only choice? Or may someone could
 explain me what's wrong about:
 
 AgsAudioLoop *audio_loop;
 AgsGuiThread *gui_thread;
 
 auto void ags_gui_thread_do_gtk_iteration();
 
 void ags_gui_thread_do_gtk_iteration(){
   if(!g_main_context_acquire(main_context)){
 gboolean got_ownership = FALSE;
 
 while(!got_ownership){
   got_ownership = g_main_context_wait(main_context,
   (gui_thread-cond),
   (gui_thread-mutex));
 }
   }
 
   /*  */
   gdk_threads_enter();
   gdk_threads_leave();
 
   g_main_context_iteration(main_context, FALSE);
   g_main_context_release(main_context);
 }
 
 gui_thread = AGS_GUI_THREAD(thread);
 
 /*  */
 main_context = g_main_context_default();
 
 ags_gui_thread_do_gtk_iteration();

Can you explain what the problem is and why you think that GTK+ leaks
memory? It's not apparent from the code snippet alone what you're having
problem with.

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


Re: how to i get the arrow-buttons moving?

2014-09-03 Thread Marcus Karlsson
On Tue, Sep 02, 2014 at 04:39:00PM -0700, Gary Kline wrote:
 here are thee labels that show up when you use the gcc compile string.
 how do I get the up- and -down arrows to point at the label and echo the
 label strings?

You need to update the view when your signal handler is invoked. All you
need is somewhere to store which label is currently selected, update it
when the signal handler is called and update the view accordingly; for
example by updating the label attributes. You can then use
gtk_label_get_text () to fetch the text that a label displays.

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


Re: how to i get the arrow-buttons moving?

2014-09-03 Thread Marcus Karlsson
On Wed, Sep 03, 2014 at 01:13:06PM -0700, Gary Kline wrote:
   thanks for your input, marcus, but could you give me a few lines of
   code?  I tried using the gtk_label_set_text() for over an hour
   last night until it felt like my shoulder was going to drop off and
   fall on the floor! 

You should be able to set the text with something like:

gtk_label_set_text (GTK_LABEL (label), some text);

But this requires that you have a valid pointer to your label, eiter in
a global variable or passed to the signal handler as the user_data
pointer.

   other than usinng g_signal_connect() to bail out with a Quit,
   the only times I see anything to do with a signal are after going 
   GTK_ARROW_UP or _DOWN  I may have misplaced the 
   gtk_label_get_text() stuff.  
 
   iv'e got:
 
   gtk_label_get_text(GTK_LABEL(user_data), buf );
 
   which now looks aways off...  need more clues.

Gtk_label_get_text () returns the string in the return value, so you
need to to something like:

str = gtk_label_get_text (GTK_LABEL (user_data));

This of course also requires that the user_data pointer is pointing at a
label. In your code sample you passed 0 and 1 as the pointers, which
most likely will not be valid pointers to your labels.

It's often a good idea to group the elements that you need to access
into an object and pass it as the user_data pointer. A struct would be
sufficient. This could also include a field which says which label is
currently selected, for example using and int in the range of 1 to 3.

If you want to reuse the signal handler and still distinguish which
button caused the signal then you can use the currently unused first
argument which should point to the sender of the signal, or the button
which was pressed down.

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


Re: any ideas for a fix?

2014-08-21 Thread Marcus Karlsson
On Tue, Aug 19, 2014 at 06:43:22PM -0700, Gary Kline wrote:
 =
 Organization: Thought Unlimited.  Public service Unix since 1986.
 Of_Interest: With 28 years  of service  to the  Unix  community.
 
 guys,
 
 last time I encloused this leftJ* code,  it output a 700 by 900
 label with label1, label2, label3.  in labelWidgets.h I've got
 a *label[32], and use a global tt=0 that is inc in a for loop.
 the gcc line builds ./leftJ after you unshar or simply run sh against
 the sharball.
 
 it doesn't segv or anything; but it only printfs the last line.  WITH
 complaiints.  can any body help me here?
 
 tia,
 
 gary
 
 Attached: leftJustify.shar

Looks like your attachment didn't make it. Can you post the code sample
online, or include the problematic part inline?

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


Re: Segmentation fault in creating basic app using GTK+ (with C)

2014-07-14 Thread Marcus Karlsson
On Tue, Jul 01, 2014 at 01:39:03AM -0700, Anoop Neem wrote:
 This application is intended to convert value entered in Text entry
 field (in Celcius) to Farenheit in label. I was having hard time in
 altering the properties of two widgets (other than calling widget) in
 the same callback, hence created a structure 'struct mulptr' for passing
 two widgets. But when i click on the button application closes giving me
 some error:
 
 
 xxx@ubuntu:~/gtk$ gcc `pkg-config --cflags gtk+-3.0` -o 4 4.c
 `pkg-config --libs gtk+-3.0`
 xxx@ubuntu:~/gtk$ ./4
 
 (4:4221): Gtk-CRITICAL **: gtk_entry_get_text: assertion 'GTK_IS_ENTRY
 (entry)' failed
 Segmentation fault (core dumped)

This basically means that the pointer that you passed to
gtk_entry_get_text was not pointing to a GtkEntry.

 -
 #includegtk/gtk.h
 #includestring.h
 #includestdlib.h
 
 char a[15] = Result here;
 
 struct mulptr
 {
   GtkWidget *one;
   GtkWidget *two;
 };
 
 int tofarenheit(int c)
 {
   return (c*1.8 + 32);
 }
 
 void calculate(GtkWidget *widget, gpointer data)
 {
   GtkWidget *textEntry = ((struct mulptr *)data)-one;
   GtkWidget *label = ((struct mulptr *)data)-two;
   int res = 0, F;
 
   res = atoi(gtk_entry_get_text(GTK_ENTRY(textEntry)));
   if(res)
   {   
   F = tofarenheit(res);
   sprintf(a, %d, F);
   }
   else
   strcpy(a, Invalid Input!);
   gtk_label_set_text(GTK_LABEL(label), a);
 }
 
 int main(int argc, char *argv[])
 {
   //Decleration
   GtkWidget *window;
   GtkWidget *calButton;
   GtkWidget *textEntry;
   GtkWidget *label;
   GtkWidget *grid;
   struct mulptr *p = (struct mulptr *)malloc(sizeof(struct mulptr));  
   p-one = textEntry;

At this point textEntry is still not initialized, so all this did was
copy the uninitialized value from textEntry to p-one.

   p-two = label;
   
   //Initilization
   gtk_init(argc, argv);
 
   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   //gtk_window_set_default_size(GTK_WINDOW(window), 480, 320);
   gtk_window_set_title(GTK_WINDOW(window), Celcius to Ferenheit
 Converter);
   gtk_container_set_border_width(GTK_CONTAINER(window), 10);
   grid = gtk_grid_new();
   
   label = gtk_label_new(a);
   textEntry = gtk_entry_new();

And here you assign textEntry with the pointer to your new GtkEntry, but
p-one is not updated and sill contains the old value which is used in
calculate.

   calButton = gtk_button_new_with_label(Calculate);
 
   //Adding widget to frame
   gtk_container_add(GTK_CONTAINER(window), grid);
   gtk_grid_attach(GTK_GRID(grid), textEntry, 0, 0, 1, 1);
   gtk_grid_attach(GTK_GRID(grid), label, 1, 0, 1, 1);
   gtk_grid_attach(GTK_GRID(grid), calButton, 0, 1, 1, 1);
 
   
   //Signal Handlers
   g_signal_connect (window, delete-event, G_CALLBACK (gtk_main_quit),
 NULL);
   g_signal_connect (calButton, clicked, G_CALLBACK(calculate), p);  
   
 
   //Essentials
   gtk_widget_show_all(window);
   gtk_main();
   return 0;
 }
 -
 
 Please help me with this piece of code?? Is it all right to use this
 kind of struct??

In a large application sure, it makes sense to bundle related things
together as a struct and passit around; but that's not really necessary
in a small application like this. Since you're using Gtk you might just
as well want to check out GObject which formalizes a lot of this stuff.

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