properties.
Fiddle with button positioning a bit to get a little more consistent
with Gnome HIG.
void (*clicked)(GtkButton *button, gpointer userdata);
const char *tip;
GtkWidget *widget;
void (*clicked)(GtkButton *button, gpointer userdata);
const char *tip;
GtkWidget *widget;
+ void (*pack)(GtkBox *box,
+ GtkWidget *child,
+ gboolean expand,
+ gboolean fill,
+ guint padding);
};
/* Variables --------------------------------------------------------------- */
};
/* Variables --------------------------------------------------------------- */
+void popup_help(const char *what);
#include <unistd.h>
/** @brief Display the manual page */
#include <unistd.h>
/** @brief Display the manual page */
+void popup_help(const char *what) {
char *path;
pid_t pid;
int w;
char *path;
pid_t pid;
int w;
- byte_xasprintf(&path, "%s/index.html", dochtmldir);
+ if(!what)
+ what = "index.html";
+ byte_xasprintf(&path, "%s/%s", dochtmldir, what);
if(!(pid = xfork())) {
exitfn = _exit;
if(!xfork()) {
if(!(pid = xfork())) {
exitfn = _exit;
if(!xfork()) {
"Login",
login_ok,
"(Re-)connect using these settings",
"Login",
login_ok,
"(Re-)connect using these settings",
},
{
GTK_STOCK_CLOSE,
login_cancel,
"Discard changes and close window",
},
{
GTK_STOCK_CLOSE,
login_cancel,
"Discard changes and close window",
GtkWidget attribute((unused)) *menu_item) {
D(("manual_popup"));
GtkWidget attribute((unused)) *menu_item) {
D(("manual_popup"));
}
/** @brief Called when version arrives, displays about... popup */
}
/** @brief Called when version arrives, displays about... popup */
gtk_widget_set_style(buttons[n].widget, tool_style);
g_signal_connect(G_OBJECT(buttons[n].widget), "clicked",
G_CALLBACK(buttons[n].clicked), 0);
gtk_widget_set_style(buttons[n].widget, tool_style);
g_signal_connect(G_OBJECT(buttons[n].widget), "clicked",
G_CALLBACK(buttons[n].clicked), 0);
- gtk_box_pack_start(GTK_BOX(box), buttons[n].widget, FALSE, FALSE, 1);
+ void (*pack)(GtkBox *box,
+ GtkWidget *child,
+ gboolean expand,
+ gboolean fill,
+ guint padding);
+ if(!(pack = buttons[n].pack))
+ pack = gtk_box_pack_start;
+ pack(GTK_BOX(box), buttons[n].widget, FALSE, FALSE, 1);
gtk_widget_set_tooltip_text(buttons[n].widget, buttons[n].tip);
}
return box;
gtk_widget_set_tooltip_text(buttons[n].widget, buttons[n].tip);
}
return box;
static gboolean playlist_editor_keypress(GtkWidget *widget,
GdkEventKey *event,
gpointer user_data);
static gboolean playlist_editor_keypress(GtkWidget *widget,
GdkEventKey *event,
gpointer user_data);
+static void playlist_editor_ok(GtkButton *button, gpointer userdata);
+static void playlist_editor_help(GtkButton *button, gpointer userdata);
/** @brief Playlist editing window */
static GtkWidget *playlist_window;
/** @brief Playlist editing window */
static GtkWidget *playlist_window;
GTK_STOCK_ADD,
playlist_picker_add,
"Create a new playlist",
GTK_STOCK_ADD,
playlist_picker_add,
"Create a new playlist",
},
{
GTK_STOCK_REMOVE,
playlist_picker_delete,
"Delete a playlist",
},
{
GTK_STOCK_REMOVE,
playlist_picker_delete,
"Delete a playlist",
},
};
#define NPLAYLIST_PICKER_BUTTONS (sizeof playlist_picker_buttons / sizeof *playlist_picker_buttons)
},
};
#define NPLAYLIST_PICKER_BUTTONS (sizeof playlist_picker_buttons / sizeof *playlist_picker_buttons)
static GtkWidget *playlist_editor_private;
static int playlist_editor_setting_buttons;
static GtkWidget *playlist_editor_private;
static int playlist_editor_setting_buttons;
+/** @brief Buttons for the playlist window */
+static struct button playlist_editor_buttons[] = {
+ {
+ GTK_STOCK_OK,
+ playlist_editor_ok,
+ "Close window",
+ 0,
+ gtk_box_pack_end,
+ },
+ {
+ GTK_STOCK_HELP,
+ playlist_editor_help,
+ "Go to manual",
+ 0,
+ gtk_box_pack_end,
+ },
+};
+
+#define NPLAYLIST_EDITOR_BUTTONS (int)(sizeof playlist_editor_buttons / sizeof *playlist_editor_buttons)
+
static GtkWidget *playlists_editor_create(void) {
assert(ql_playlist.view == NULL); /* better not be set up already */
static GtkWidget *playlists_editor_create(void) {
assert(ql_playlist.view == NULL); /* better not be set up already */
gtk_box_pack_start(GTK_BOX(hbox), playlist_editor_private,
FALSE/*expand*/, FALSE/*fill*/, 0);
playlist_editor_set_buttons(0,0,0);
gtk_box_pack_start(GTK_BOX(hbox), playlist_editor_private,
FALSE/*expand*/, FALSE/*fill*/, 0);
playlist_editor_set_buttons(0,0,0);
+ create_buttons_box(playlist_editor_buttons,
+ NPLAYLIST_EDITOR_BUTTONS,
+ hbox);
GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
GtkWidget *view = init_queuelike(&ql_playlist);
GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
GtkWidget *view = init_queuelike(&ql_playlist);
ql_new_queue(&ql_playlist, newq);
}
ql_new_queue(&ql_playlist, newq);
}
+static void playlist_editor_ok(GtkButton attribute((unused)) *button,
+ gpointer attribute((unused)) userdata) {
+ gtk_widget_destroy(playlist_window);
+}
+
+static void playlist_editor_help(GtkButton attribute((unused)) *button,
+ gpointer attribute((unused)) userdata) {
+ popup_help("playlists.html");
+}
+
/* Playlist mutation -------------------------------------------------------- */
/** @brief State structure for guarded playlist modification
/* Playlist mutation -------------------------------------------------------- */
/** @brief State structure for guarded playlist modification
static void properties_ok(GtkButton *button, gpointer userdata);
static void properties_apply(GtkButton *button, gpointer userdata);
static void properties_cancel(GtkButton *button, gpointer userdata);
static void properties_ok(GtkButton *button, gpointer userdata);
static void properties_apply(GtkButton *button, gpointer userdata);
static void properties_cancel(GtkButton *button, gpointer userdata);
+static void properties_help(GtkButton *button, gpointer userdata);
static void properties_logged_in(const char *event,
void *eventdata,
static void properties_logged_in(const char *event,
void *eventdata,
/* Buttons that appear at the bottom of the window */
static struct button buttons[] = {
/* Buttons that appear at the bottom of the window */
static struct button buttons[] = {
+ {
+ GTK_STOCK_HELP,
+ properties_help,
+ "Go to manual",
+ 0,
+ gtk_box_pack_start,
+ },
{
GTK_STOCK_OK,
properties_ok,
"Apply all changes and close window",
{
GTK_STOCK_OK,
properties_ok,
"Apply all changes and close window",
- 0
- },
- {
- GTK_STOCK_APPLY,
- properties_apply,
- "Apply all changes and keep window open",
- 0
},
{
GTK_STOCK_CANCEL,
properties_cancel,
"Discard all changes and close window",
},
{
GTK_STOCK_CANCEL,
properties_cancel,
"Discard all changes and close window",
+ 0,
+ gtk_box_pack_end
+ },
+ {
+ GTK_STOCK_APPLY,
+ properties_apply,
+ "Apply all changes and keep window open",
+ 0,
+ gtk_box_pack_end,
+static void properties_help(GtkButton attribute((unused)) *button,
+ gpointer attribute((unused)) userdata) {
+ popup_help("properties.html");
+}
+
/** @brief Called when we've just logged in
*
* Destroys the current properties window.
/** @brief Called when we've just logged in
*
* Destroys the current properties window.
GTK_STOCK_ADD,
users_add,
"Create a new user",
GTK_STOCK_ADD,
users_add,
"Create a new user",
},
{
GTK_STOCK_REMOVE,
users_delete,
"Delete a user",
},
{
GTK_STOCK_REMOVE,
users_delete,
"Delete a user",
},
};
#define NUSERS_BUTTONS (sizeof users_buttons / sizeof *users_buttons)
},
};
#define NUSERS_BUTTONS (sizeof users_buttons / sizeof *users_buttons)