コード例 #1
0
ファイル: poll-questions.c プロジェクト: andy-shev/LogJam
static void
pollscaledlg_init(PollScaleDlg *psdlg, GtkWindow *parent) {
	GtkWidget *mainbox, *vbox;
	GtkWidget *label;
	GtkSizeGroup *sizegroup;

	GtkAdjustment *adj1 = (GtkAdjustment*)gtk_adjustment_new(
			1.0,  -32000.0, 32000.0, 1.0, 5.0, 0);
	GtkAdjustment *adj2 = (GtkAdjustment*)gtk_adjustment_new(
			10.0, -32000.0, 32000.0, 1.0, 5.0, 0);
	GtkAdjustment *adj3 = (GtkAdjustment*)gtk_adjustment_new(
			1.0,  -32000.0, 32000.0, 1.0, 5.0, 0);

	psdlg->dlg = gtk_dialog_new_with_buttons(_("Scale Poll Question"),
			parent, GTK_DIALOG_MODAL,
			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
			GTK_STOCK_OK, GTK_RESPONSE_OK,
			NULL);
	jam_win_set_size(GTK_WINDOW(psdlg->dlg), 400, -1);

	mainbox = gtk_hbox_new(FALSE, 12);

	vbox = gtk_vbox_new(FALSE, 6);
	label = gtk_label_new_with_mnemonic(_("_Question:"));
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);

	psdlg->question = gtk_text_view_new();
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(psdlg->question), GTK_WRAP_WORD);
	gtk_label_set_mnemonic_widget(GTK_LABEL(label), psdlg->question);
	gtk_box_pack_start(GTK_BOX(vbox),
			scroll_wrap(psdlg->question),
			TRUE, TRUE, 0);

	gtk_box_pack_start(GTK_BOX(mainbox), vbox, TRUE, TRUE, 0);

	vbox = gtk_vbox_new(FALSE, 6);
	sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);

	psdlg->from = gtk_spin_button_new(adj1, 1.0, 0);
	gtk_box_pack_start(GTK_BOX(vbox),
			labelled_box_new_sg(_("_From:"), psdlg->from, sizegroup),
			FALSE, FALSE, 0);
	psdlg->to = gtk_spin_button_new(adj2, 1.0, 0);
	gtk_box_pack_start(GTK_BOX(vbox),
			labelled_box_new_sg(_("_To:"), psdlg->to, sizegroup),
			FALSE, FALSE, 0);
	psdlg->by = gtk_spin_button_new(adj3, 1.0, 0);
	gtk_box_pack_start(GTK_BOX(vbox),
			labelled_box_new_sg(_("_By:"), psdlg->by, sizegroup),
			FALSE, FALSE, 0);

	gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);

	jam_dialog_set_contents(GTK_DIALOG(psdlg->dlg), mainbox);
}
コード例 #2
0
ファイル: jamview.c プロジェクト: nightmorph/LogJam
static void
location_add(JamView *view) {
	view->location = gtk_entry_new();
	view->locationbar = labelled_box_new_sg(_("_Location:"), view->location, view->sizegroup);
	gtk_box_pack_start(GTK_BOX(view), view->locationbar, FALSE, FALSE, 0);
	gtk_box_reorder_child(GTK_BOX(view), view->locationbar, view->moodpicbar ? 2 : 1);
	gtk_widget_show_all(view->locationbar);
}
コード例 #3
0
ファイル: settings.c プロジェクト: nightmorph/LogJam
static GtkWidget*
command_make(SettingsWidget *sw) {
    CommandList *cmds = sw->data;
    GtkWidget *vbox, *menu;
    GtkSizeGroup *sg;
    char *cmd = *((char**)sw->conf);
    int cur = -1;
    int i;

    menu = gtk_menu_new();
    for (i = 0; cmds[i].label; i++) {
        char *curcmd = cmds[i].command;
        gtk_menu_shell_append(GTK_MENU_SHELL(menu),
                              gtk_menu_item_new_with_label(_(cmds[i].label)));
        if (cur == -1 &&
                ((cmd == curcmd) ||
                 (cmd && curcmd && (strcmp(cmd, curcmd) == 0))))
            cur = i;
    }
    gtk_menu_shell_append(GTK_MENU_SHELL(menu),
                          gtk_menu_item_new_with_label(_("Custom Command")));
    if (cur == -1) cur = i;

    sw->widget = gtk_option_menu_new();
    gtk_option_menu_set_menu(GTK_OPTION_MENU(sw->widget), menu);
    gtk_option_menu_set_history(GTK_OPTION_MENU(sw->widget), cur);

    sw->subwidget = gtk_entry_new();
    tie_text(GTK_ENTRY(sw->subwidget), (char**)sw->conf);

    g_signal_connect(G_OBJECT(sw->widget), "changed",
                     G_CALLBACK(command_changed_cb), sw);
    jam_widget_set_visible(sw->subwidget, cur == i);

    sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
    vbox = gtk_vbox_new(FALSE, 3);
    gtk_box_pack_start(GTK_BOX(vbox),
                       labelled_box_new_sg(_(sw->caption), sw->widget, sg),
                       FALSE, FALSE, 0);
    sw->data2 = labelled_box_new_sg(NULL, sw->subwidget, sg);  /* ugh. */
    gtk_box_pack_start(GTK_BOX(vbox),
                       sw->data2,
                       FALSE, FALSE, 0);
    return vbox;
}
コード例 #4
0
ファイル: jamview.c プロジェクト: nightmorph/LogJam
static void
picture_add(JamView *view) {
	moodpic_add(view);
	view->pic = gtk_option_menu_new();
	picture_populate(view);
	view->picbox = labelled_box_new_sg(_("_Picture:"), view->pic, view->sizegroup);
	gtk_box_pack_start(GTK_BOX(view->moodpicbar), view->picbox, FALSE, FALSE, 0);
	gtk_widget_show_all(view->picbox);
}
コード例 #5
0
ファイル: jamview.c プロジェクト: nightmorph/LogJam
static void
subject_add(JamView *view) {
	/* subject is always visible. */
	view->subjectbar = gtk_hbox_new(FALSE, 12);

	view->subject = gtk_entry_new();
	gtk_box_pack_start(GTK_BOX(view->subjectbar),
			labelled_box_new_sg(_("_Subject:"), view->subject, view->sizegroup),
			TRUE, TRUE, 0);

	gtk_box_pack_start(GTK_BOX(view), view->subjectbar, FALSE, FALSE, 0);
}
コード例 #6
0
ファイル: jamview.c プロジェクト: nightmorph/LogJam
static void
tags_add(JamView *view) {
	GtkWidget *tagbutton;
	view->tags = gtk_entry_new();
	view->tagsbar = labelled_box_new_sg(_("_Tags:"), view->tags, view->sizegroup);
	gtk_box_pack_start(GTK_BOX(view), view->tagsbar, FALSE, FALSE, 0);
	tagbutton = gtk_button_new_with_label("...");
	g_signal_connect_swapped(G_OBJECT(tagbutton), "clicked",
				 G_CALLBACK(tags_select_cb), view);
	gtk_box_pack_start(GTK_BOX(view->tagsbar),
			   tagbutton, FALSE, FALSE, 0);
	gtk_box_reorder_child(GTK_BOX(view), view->tagsbar, view->musicbar ? 2 : 1);
	gtk_widget_show_all(view->tagsbar);
}
コード例 #7
0
ファイル: jamview.c プロジェクト: nightmorph/LogJam
static void
music_add(JamView *view) {
	view->music = gtk_entry_new();
	view->musicbar = labelled_box_new_sg(_("_Music:"), view->music, view->sizegroup);
	if (conf.music_mpris || music_can_detect(NULL)) {
		GtkWidget *refresh = gtk_button_new_from_stock(GTK_STOCK_REFRESH);
		g_signal_connect_swapped(G_OBJECT(refresh), "clicked",
				G_CALLBACK(music_refresh_cb), view);
		gtk_box_pack_start(GTK_BOX(view->musicbar),
				refresh, FALSE, FALSE, 0);
	}
	gtk_box_pack_start(GTK_BOX(view), view->musicbar, FALSE, FALSE, 0);
	gtk_box_reorder_child(GTK_BOX(view), view->musicbar, view->moodpicbar ? 2 : 1);
	gtk_widget_show_all(view->musicbar);
}
コード例 #8
0
ファイル: settings.c プロジェクト: nightmorph/LogJam
static GtkWidget*
sw_make_sg(char *name, GtkSizeGroup *sg) {
    SettingsWidget *sw = sw_lookup(name);
    switch (sw->type) {
    case SW_TOGGLE:
        sw->widget = gtk_check_button_new_with_mnemonic(_(sw->caption));
        toggle_tie(sw);
        return sw->widget;
    case SW_RADIO:
        sw->widget = gtk_radio_button_new_with_mnemonic(NULL,
                     _(sw->caption));
        radio_tie(sw);
        return sw->widget;
    case SW_TEXT:
        sw->widget = gtk_entry_new();
        text_tie(sw);
        return labelled_box_new_sg(_(sw->caption), sw->widget, sg);
    case SW_INTEGER:
        sw->widget = gtk_entry_new();
        gtk_entry_set_width_chars(GTK_ENTRY(sw->widget), 4);
        integer_tie(sw);
        return labelled_box_new(_(sw->caption), sw->widget);
    case SW_SPIN_INTEGER:
    {
        gdouble default_value = *(gint*)sw->conf;
        GtkObject *adj = gtk_adjustment_new(default_value,
                                            /* client code should override these */
                                            G_MINDOUBLE, G_MAXDOUBLE, 1.0, 1.0, 0);
        sw->widget = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 1);
    }
    spin_integer_tie(sw);
    return labelled_box_new_expand(_(sw->caption), sw->widget, FALSE);
    case SW_COMBO:
        sw->widget = gtk_combo_new();
        combo_tie(sw);
        return labelled_box_new(_(sw->caption), sw->widget);
    case SW_COMMAND:
        return command_make(sw);
    case SW_CUSTOM:
        if (sw->caption && sw->widget)
            return labelled_box_new(_(sw->caption), sw->widget);
        break;
    default:
        break;
    }
    return NULL;
}
コード例 #9
0
ファイル: jamview.c プロジェクト: nightmorph/LogJam
static void
mood_add(JamView *view) {
	moodpic_add(view);

	/*view->moodbutton = gtk_button_new_with_label(_("Mood"));
	gtk_size_group_add_widget(view->sizegroup, view->moodbutton);*/

	view->moodcombo = gtk_combo_new();
	gtk_widget_set_usize(GTK_COMBO(view->moodcombo)->entry, 100, -1);
	mood_populate(view);
	
	/*view->moodbox = gtk_hbox_new(FALSE, 12);
	gtk_box_pack_start(GTK_BOX(view->moodbox), view->moodbutton, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(view->moodbox), view->moodcombo, TRUE, TRUE, 0);*/
	view->moodbox = labelled_box_new_sg(_("_Mood:"), view->moodcombo, view->sizegroup),
	gtk_widget_show_all(view->moodbox);

	gtk_box_pack_start(GTK_BOX(view->moodpicbar), view->moodbox, TRUE, TRUE, 0);
	if (view->pic)
		gtk_box_reorder_child(GTK_BOX(view->moodpicbar), view->moodbox, 0);
}
コード例 #10
0
ファイル: login.c プロジェクト: nightmorph/LogJam
static GtkWidget*
make_login_table(login_dlg *ldlg) {
	GtkWidget *vbox, *hbox, *cvbox, *img;
	GtkSizeGroup *sg;

	sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);

	vbox = gtk_vbox_new(FALSE, 6);

	ldlg->mhost = gtk_option_menu_new();
	gtk_widget_set_size_request(ldlg->mhost, 50, -1);
	populate_host_list(ldlg);
	g_signal_connect(G_OBJECT(ldlg->mhost), "changed",
			G_CALLBACK(host_changed_cb), ldlg);
	gtk_box_pack_start(GTK_BOX(vbox),
			labelled_box_new_sg(_("_Server:"), ldlg->mhost, sg),
			FALSE, FALSE, 0);

	ldlg->cusername = gtk_combo_new();
	gtk_widget_set_size_request(ldlg->cusername, 50, -1);
	ldlg->eusername = GTK_COMBO(ldlg->cusername)->entry;
	gtk_combo_disable_activate(GTK_COMBO(ldlg->cusername)); 
	gtk_entry_set_activates_default(GTK_ENTRY(ldlg->eusername), TRUE);
	gtk_box_pack_start(GTK_BOX(vbox),
			labelled_box_new_all(_("_User Name:"), ldlg->cusername, TRUE,
				sg, ldlg->eusername),
			FALSE, FALSE, 0);

	ldlg->epassword = gtk_entry_new(); 
	gtk_entry_set_activates_default(GTK_ENTRY(ldlg->epassword), TRUE);
	gtk_widget_set_size_request(ldlg->epassword, 100, -1);
	gtk_entry_set_visibility(GTK_ENTRY(ldlg->epassword), FALSE);
	gtk_box_pack_start(GTK_BOX(vbox),
			labelled_box_new_sg(_("_Password:"******"R_emember user"));
	ldlg->crpassword = gtk_check_button_new_with_mnemonic(_("Re_member password"));
	ldlg->bupdate = gtk_button_new_with_mnemonic(_("Update _Information"));
	g_signal_connect(G_OBJECT(ldlg->bupdate), "clicked",
			G_CALLBACK(update_cb), ldlg);

	cvbox = gtk_vbox_new(FALSE, 6);
	gtk_box_pack_start(GTK_BOX(cvbox), ldlg->cruser, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(cvbox), ldlg->crpassword, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(cvbox), ldlg->bupdate, FALSE, FALSE, 0);

	img = gtk_image_new_from_stock("logjam-goat", GTK_ICON_SIZE_DIALOG),
	gtk_size_group_add_widget(sg, img);

	hbox = gtk_hbox_new(FALSE, 12);
	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox), cvbox, TRUE, TRUE, 0);

	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

	populate_user_list(ldlg);

	g_signal_connect(G_OBJECT(ldlg->eusername), "changed",
			G_CALLBACK(username_changed), ldlg);

	return vbox;
}