示例#1
0
文件: gnomeloop.c 项目: eswartz/emul
/*
 *	Change font used to display log text, NULL means reset to default
 */
void
GTK_change_log_font(gchar *fontname)
{
#if 0 // old GTK
	GtkRcStyle *rcstyle = gtk_rc_style_new();
#else
	GtkStyle *rcstyle = gtk_style_new(); 
#endif	

//	if (GTK_OBJECT(v9t9_command_log)->flags & GTK_DESTROYED) {//2.0
	if (!v9t9_command_log) {
		g_free(rcstyle);
		return;
	}

	if (fontname && *fontname) {
#if 0 // old GTK
		rcstyle->font_name = fontname;
		gtk_widget_modify_style(v9t9_command_log, rcstyle);
#else
		gtk_style_set_font(rcstyle, gdk_font_load(fontname));
		gtk_widget_set_style(v9t9_command_log, rcstyle);
#endif		
	} else {
		// this is probably too harsh for a cancel
		gtk_widget_restore_default_style(v9t9_command_log);
	}
//	g_free(rcstyle);
}
示例#2
0
文件: fileview.c 项目: dimkr/emelfm
/* This function is called whenever we need to exchange curr_view and
 * other_view.
 */
static void
switch_views()
{
  gint i;
  gint num_cols;
  GtkStyle *style;
  FileView *temp;
  GList *tmp;

  temp = other_view;
  other_view = curr_view;
  curr_view = temp;

  gtk_signal_emit_by_name(GTK_OBJECT(other_view->clist), "end-selection");
  if (other_view->old_selection)
    g_list_free(other_view->old_selection);
  other_view->old_selection = g_list_copy(
                                GTK_CLIST(other_view->clist)->selection);
  for (tmp = other_view->old_selection; tmp != NULL; tmp = tmp->next)
    gtk_clist_set_background(GTK_CLIST(other_view->clist), (gint)tmp->data,
                             &SELECT_COLOR);
  for (tmp = curr_view->old_selection; tmp != NULL; tmp = tmp->next)
    gtk_clist_set_background(GTK_CLIST(curr_view->clist), (gint)tmp->data,
                             &CLIST_COLOR);

  gtk_clist_unselect_all(GTK_CLIST(other_view->clist));
  style = gtk_style_copy(gtk_widget_get_style(
                         GTK_CLIST(other_view->clist)->column[0].button));
  style->bg[GTK_STATE_NORMAL] = COL_COLOR;
  num_cols = GTK_CLIST(curr_view->clist)->columns;
  for (i = 0; i < num_cols; i++)
  {
    gtk_widget_set_style(GTK_CLIST(curr_view->clist)->column[i].button,
                         style);
    gtk_widget_set_style(curr_view->sort_arrows[i], style);
  }
  for (i = 0; i < num_cols; i++)
  {
    gtk_widget_restore_default_style(
          GTK_CLIST(other_view->clist)->column[i].button);
    gtk_widget_restore_default_style(other_view->sort_arrows[i]);
  }

  chdir(curr_view->dir);
}
示例#3
0
文件: widget.c 项目: amery/clip-itk
/* Restores default style for a widget */
int
clip_GTK_WIDGETRESTOREDEFAULTSTYLE(ClipMachine * cm)
{
	C_widget *cwid = _fetch_cw_arg(cm);
	CHECKCWID(cwid,GTK_IS_WIDGET);
	gtk_widget_restore_default_style(cwid->widget);
	return 0;
err:
	return 1;
}