Re: Close button in GtkNotebook

2017-05-28 Thread Eric Cashon via gtk-app-devel-list

 
Hi Augusto,

This doesn't use glade but it might help out. You can add a label and button to 
a box and add it to the notebook tab. In the button "clicked" callback you can 
us the notebook pointer if you need that variable. If you want to be able to 
really customize the look and size of the button you could replace it with a 
drawing area and draw your own button. 

Eric

/*
   gcc -Wall notebook1.c -o notebook1 `pkg-config --cflags --libs gtk+-3.0`
   Tested with GTK3.18 on Ubuntu16.04
*/

#include

static void button_clicked(GtkWidget *button, GtkWidget *notebook)
  {
g_print("Clicked\n");
  }
int main(int argc, char *argv[])
  {
gtk_init (, );

GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Notebook");
gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

GtkWidget *label1=gtk_label_new("page1");
GtkWidget *label2=gtk_label_new("page2");
GtkWidget *nb_label1=gtk_label_new("tab1");
GtkWidget *nb_label2=gtk_label_new("tab2");
 
GtkWidget *x_label=gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(x_label), "x");

GtkWidget *button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button), x_label); 

GtkWidget *box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_pack_start(GTK_BOX(box), nb_label2, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
gtk_widget_show_all(box);

GtkWidget *notebook=gtk_notebook_new();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), label1, nb_label1);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), label2, box);

g_signal_connect(button, "clicked", G_CALLBACK(button_clicked), notebook);
 
gtk_container_add(GTK_CONTAINER(window), notebook);

gtk_widget_show_all(window);

gtk_main();

return 0;
  }  


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


Thanks again ff

2017-05-28 Thread Hashem nolastname
Of course& I ffrg we g free 4r_r__ RE to get some g
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Close button in GtkNotebook

2017-05-28 Thread Augusto Fraga Giachero

Hi,

I've been playing with Glade and GtkNotebook for while, and I couldn't
figure a way to enable the close button on the tabs like this:


With I've read online it seems that I need to add a GtkBox to the tab
title area and add the label and a standard GtkButton to the right, but
the GtkButton is too large (even with no text inside it) and I couldn't
find out how to use the stock close icon for the GtkButton through
Glade.

Ideas?

Thanks,
Augusto Fraga Giachero.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Pre requisite for gtk3

2017-05-28 Thread sakthiperumal karuthasamy
Hi,
   I am running​ example application folder in gtk source but it's giving
error in the line of type declaration.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list