Пример #1
0
void handle_global_checkbox_toggled (GtkToggleButton *togglebutton,
				     gpointer data)
{
  if (get_game_state () != GAME_NOT_RUNNING)
    {
      GtkWidget *frame;

      frame = glade_xml_get_widget (pref_xml, "frame_mouse_props");

      gtk_widget_set_sensitive (GTK_WIDGET (frame), FALSE);

      g_signal_handlers_disconnect_by_func
                                 (togglebutton,
                                  G_CALLBACK (handle_global_checkbox_toggled),
                                  data);

      gtk_toggle_button_set_active (togglebutton,
				    !gtk_toggle_button_get_active
				    (togglebutton));
    }
  else
    {
      gnome_property_box_changed (GNOME_PROPERTY_BOX (data));
    }
}
Пример #2
0
void set_properties(ChartInstance *ci) {
	struct buysell_data *data=(struct buysell_data *)ci->instance_data;
	GnomePropertyBox *pbox;
	GladeXML *xxml;
	
	xxml=glade_xml_new(BUYSELLGLADE_FILE,"BuySellPropertyBox");
      	glade_xml_signal_autoconnect(xxml);

	pbox=(GnomePropertyBox *)glade_xml_get_widget(xxml,"BuySellPropertyBox");
	bs_cpick=(GnomeColorPicker *)glade_xml_get_widget(xxml,"BuySellColor");
	bs_pricespin=(GtkSpinButton *)glade_xml_get_widget(xxml,"BuySellPrice");
	bs_numstocks=(GtkSpinButton *)glade_xml_get_widget(xxml,"NumStocks");
	bs_date=(GnomeDateEdit *)glade_xml_get_widget(xxml,"Date");
	bs_buybotton=(GtkWidget *)glade_xml_get_widget(xxml,"BuyButton");
	bs_sellbutton=(GtkWidget *)glade_xml_get_widget(xxml,"SellButton");

	//Hack away the "apply"  button
	gtk_widget_hide(GNOME_PROPERTY_BOX(pbox)->apply_button);

	gnome_property_box_changed(pbox);	//Necessary, or the callback won't be called

	gnome_color_picker_set_i8(bs_cpick,data->r,data->g,data->b,data->a);
	gtk_spin_button_set_value(bs_pricespin,data->price);
	gtk_spin_button_set_value(bs_numstocks,data->amount);
	gnome_date_edit_set_time(bs_date,data->time);

	if (data->buy) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bs_buybotton),TRUE);
	else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bs_sellbutton),TRUE);

	bs_global_ci=ci;		
	gnome_dialog_run(GNOME_DIALOG(pbox));
}
Пример #3
0
void handle_mouse_ctrl_toggled (GtkToggleButton *togglebutton, gpointer data)
{
  GtkWidget *frame;

  /* get widgets */
  frame = glade_xml_get_widget (pref_xml, "frame_mouse_props");

  /* set status of property box */
  gnome_property_box_changed (GNOME_PROPERTY_BOX (data));

  /* enable/disable mouse control properties */
  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton)))
    {
      gtk_widget_set_sensitive (frame, TRUE);
    }
  else
    {
      gtk_widget_set_sensitive (frame, FALSE);
    }
}
Пример #4
0
static PropDlg *
prop_dialog_new (void)
{
	PropDlg *dlg;
	GladeXML *gtxml;

	dlg = g_new0(PropDlg, 1);

	gtxml = gtt_glade_xml_new ("glade/project_properties.glade", "Project Properties");
	dlg->gtxml = gtxml;

	dlg->dlg = GNOME_PROPERTY_BOX (glade_xml_get_widget (gtxml,  "Project Properties"));

	gtk_signal_connect(GTK_OBJECT(dlg->dlg), "help",
	                   GTK_SIGNAL_FUNC(help_cb),
			             "projects-editing");

	gtk_signal_connect(GTK_OBJECT(dlg->dlg), "apply",
			   GTK_SIGNAL_FUNC(prop_set), dlg);

	/* ------------------------------------------------------ */
	/* grab the various entry boxes and hook them up */

	dlg->title      = GTK_ENTRY(TAGGED("title box"));
	dlg->desc       = GTK_ENTRY(TAGGED("desc box"));
	dlg->notes      = GTK_TEXT_VIEW(TEXTED("notes box"));

	dlg->regular    = GTK_ENTRY(TAGGED("regular box"));
	dlg->overtime   = GTK_ENTRY(TAGGED("overtime box"));
	dlg->overover   = GTK_ENTRY(TAGGED("overover box"));
	dlg->flatfee    = GTK_ENTRY(TAGGED("flatfee box"));

	dlg->minimum    = GTK_ENTRY(TAGGED("minimum box"));
	dlg->interval   = GTK_ENTRY(TAGGED("interval box"));
	dlg->gap        = GTK_ENTRY(TAGGED("gap box"));

	dlg->urgency    = MUGGED("urgency menu");
	dlg->importance = MUGGED("importance menu");
	dlg->status     = MUGGED("status menu");

	dlg->start      = DATED("start date");
	dlg->end        = DATED("end date");
	dlg->due        = DATED("due date");

	dlg->sizing     = GTK_ENTRY(TAGGED("sizing box"));
	dlg->percent    = GTK_ENTRY(TAGGED("percent box"));

	/* ------------------------------------------------------ */
	/* initialize menu values */

	MENTRY (dlg->urgency, "urgency", 0, GTT_UNDEFINED);
	MENTRY (dlg->urgency, "urgency", 1, GTT_LOW);
	MENTRY (dlg->urgency, "urgency", 2, GTT_MEDIUM);
	MENTRY (dlg->urgency, "urgency", 3, GTT_HIGH);

	MENTRY (dlg->importance, "importance", 0, GTT_UNDEFINED);
	MENTRY (dlg->importance, "importance", 1, GTT_LOW);
	MENTRY (dlg->importance, "importance", 2, GTT_MEDIUM);
	MENTRY (dlg->importance, "importance", 3, GTT_HIGH);

	MENTRY (dlg->status, "status", 0, GTT_NO_STATUS);
	MENTRY (dlg->status, "status", 1, GTT_NOT_STARTED);
	MENTRY (dlg->status, "status", 2, GTT_IN_PROGRESS);
	MENTRY (dlg->status, "status", 3, GTT_ON_HOLD);
	MENTRY (dlg->status, "status", 4, GTT_CANCELLED);
	MENTRY (dlg->status, "status", 5, GTT_COMPLETED);

	gnome_dialog_close_hides(GNOME_DIALOG(dlg->dlg), TRUE);

	return dlg;
}
Пример #5
0
static void wrapper (void * gobj, void * data) {
	gnome_property_box_changed (GNOME_PROPERTY_BOX(data));
}
Пример #6
0
static void
do_set_project(GttProject *proj, PropDlg *dlg)
{
	GttProjectStatus status;
	GttRank rank;
	time_t tval;
	char buff[132];
	time_t now = time(NULL);

	if (!dlg) return;

	if (!proj)
	{
		/* We null these out, because old values may be left
		 * over from an earlier project */
		dlg->proj = NULL;
		gtk_entry_set_text(dlg->title, "");
		gtk_entry_set_text(dlg->desc, "");
		xxxgtk_textview_set_text(dlg->notes, "");
		gtk_entry_set_text(dlg->regular, "0.0");
		gtk_entry_set_text(dlg->overtime, "0.0");
		gtk_entry_set_text(dlg->overover, "0.0");
		gtk_entry_set_text(dlg->flatfee, "0.0");
		gtk_entry_set_text(dlg->minimum, "0");
		gtk_entry_set_text(dlg->interval, "0");
		gtk_entry_set_text(dlg->gap, "0");

		gnome_date_edit_set_time(dlg->start, now);
		gnome_date_edit_set_time(dlg->end, now);
		gnome_date_edit_set_time(dlg->due, now+86400);
		gtk_entry_set_text(dlg->sizing, "0.0");
		gtk_entry_set_text(dlg->percent, "0");
		return;
	}


	/* set all the values. Do this even is new project is same as old
	 * project, since widget may be holding rejected changes. */
	dlg->proj = proj;

	gtk_entry_set_text(dlg->title, gtt_project_get_title(proj));
	gtk_entry_set_text(dlg->desc, gtt_project_get_desc(proj));
	xxxgtk_textview_set_text(dlg->notes, gtt_project_get_notes (proj));

	/* hack alert should use local currencies for this */
	g_snprintf (buff, 132, "%.2f", gtt_project_get_billrate(proj));
	gtk_entry_set_text(dlg->regular, buff);
	g_snprintf (buff, 132, "%.2f", gtt_project_get_overtime_rate(proj));
	gtk_entry_set_text(dlg->overtime, buff);
	g_snprintf (buff, 132, "%.2f", gtt_project_get_overover_rate(proj));
	gtk_entry_set_text(dlg->overover, buff);
	g_snprintf (buff, 132, "%.2f", gtt_project_get_flat_fee(proj));
	gtk_entry_set_text(dlg->flatfee, buff);

	g_snprintf (buff, 132, "%d", gtt_project_get_min_interval(proj));
	gtk_entry_set_text(dlg->minimum, buff);
	g_snprintf (buff, 132, "%d", gtt_project_get_auto_merge_interval(proj));
	gtk_entry_set_text(dlg->interval, buff);
	g_snprintf (buff, 132, "%d", gtt_project_get_auto_merge_gap(proj));
	gtk_entry_set_text(dlg->gap, buff);

	rank = gtt_project_get_urgency (proj);
	if (GTT_UNDEFINED   == rank) gtk_option_menu_set_history (dlg->urgency, 0);
	else if (GTT_LOW    == rank) gtk_option_menu_set_history (dlg->urgency, 1);
	else if (GTT_MEDIUM == rank) gtk_option_menu_set_history (dlg->urgency, 2);
	else if (GTT_HIGH   == rank) gtk_option_menu_set_history (dlg->urgency, 3);

	rank = gtt_project_get_importance (proj);
	if (GTT_UNDEFINED   == rank) gtk_option_menu_set_history (dlg->importance, 0);
	else if (GTT_LOW    == rank) gtk_option_menu_set_history (dlg->importance, 1);
	else if (GTT_MEDIUM == rank) gtk_option_menu_set_history (dlg->importance, 2);
	else if (GTT_HIGH   == rank) gtk_option_menu_set_history (dlg->importance, 3);

	status = gtt_project_get_status (proj);
	if (GTT_NO_STATUS	 == status) gtk_option_menu_set_history (dlg->status, 0);
	else if (GTT_NOT_STARTED == status) gtk_option_menu_set_history (dlg->status, 1);
	else if (GTT_IN_PROGRESS == status) gtk_option_menu_set_history (dlg->status, 2);
	else if (GTT_ON_HOLD     == status) gtk_option_menu_set_history (dlg->status, 3);
	else if (GTT_CANCELLED   == status) gtk_option_menu_set_history (dlg->status, 4);
	else if (GTT_COMPLETED   == status) gtk_option_menu_set_history (dlg->status, 5);

	tval = gtt_project_get_estimated_start (proj);
	if (-1 == tval) tval = now;
	gnome_date_edit_set_time (dlg->start, tval);
	tval = gtt_project_get_estimated_end (proj);
	if (-1 == tval) tval = now+3600;
	gnome_date_edit_set_time (dlg->end, tval);
	tval = gtt_project_get_due_date (proj);
	if (-1 == tval) tval = now+86400;
	gnome_date_edit_set_time (dlg->due, tval);

	g_snprintf (buff, 132, "%.2f", ((double) gtt_project_get_sizing(proj))/3600.0);
	gtk_entry_set_text(dlg->sizing, buff);
	g_snprintf (buff, 132, "%d", gtt_project_get_percent_complete(proj));
	gtk_entry_set_text(dlg->percent, buff);

	/* set to unmodified as it reflects the current state of the project */
	gnome_property_box_set_modified(GNOME_PROPERTY_BOX(dlg->dlg),
					FALSE);
}
Пример #7
0
void handle_widget_changed (GtkWidget *widget, gpointer data)
{
  gnome_property_box_changed (GNOME_PROPERTY_BOX (data));
}