Re: API for putting close buttons on tabs (proposal)



Christian Dywan wrote:
What do you think about this?

I think this is mostly going too far.

It is attractive to let the notebook provide close buttons,
which leads to consistency. And of course also less dublicated code.
That's why I particularly like an api that merely toggles such buttons
on tabs.


Nevertheless much users need an API to show/hide such close buttons individually but not only globally. Take into account my example with firefox. Also, I can imagine an application where some tabs are closeable (temporary) while others are persistent.

/* Globally show|hide action areas on tabs */
void     gtk_notebook_set_show_action_areas (GtkNotebook *notebook,
gboolean show);
gboolean gtk_notebook_get_show_action_areas (GtkNotebook *notebook);

/* Show|hide action area for a tab */
void     gtk_notebook_set_show_action_area (GtkNotebook *notebook,
gboolean show, gint at_position);
gboolean gtk_notebook_get_show_action_area (GtkNotebook *notebook,
gint at_position);

These are redundant. If we decide for embedding arbitrary widgets in
tabs, it's totally sufficient that whatever widget was provided by the
application can be hidden or shown. The notebook wouldn't do anything
else.


I agree.

/* Predefined action area types */
typedef enum
{
      GTK_NOTEBOOK_ACTION_AREA_CLOSE
      /* other types */
} GtkNotebookActionAreaType;

/* Set|get action area content for a tab by type */
void gtk_notebook_set_action_area_type (GtkNotebook *notebook,
GtkNotebookActionAreaType type, gint at_position);

However regarding ActionAreaType, I'm not sure what other types you
have in mind but I don't think that's very helpful. That makes only the
API rather complex for a rather limited use case.
If you have particular ideas in mind that are particularly suffering
from the problems you have with custom close buttons, go ahead. But
generalizing this doesn't seem worth the effort.


Perhaps, you're right. I cannot imagine another usage of the action area right now.

ciao,
     Christian
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


To summarize:

/* Toggle show tabs close buttons globally */
void     gtk_notebook_set_show_close_buttons (GtkNotebook *notebook, gboolean show);
gboolean gtk_notebook_get_show_close_buttons (GtkNotebook *notebook);

/* Toggle show tab close button individually for page */
void     gtk_notebook_set_show_close_button (GtkNotebook *notebook, gboolean show, gint position);
gboolean gtk_notebook_get_show_close_button (GtkNotebook *notebook, gint position);

Are you agreed with this API (considering my comments)?


------------------------------------------------------------------------

Alexander Semenov<bohtvaroh gmail com>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]