Exemple #1
0
static void fill_source_ctree (GtkWidget *ctree) {
	GSList *list;
	GSList *list2;
	GtkCTreeNode *node;
	GtkCTreeNode *parent;
	struct master *group;
	struct master *m;

	source_ctree_add_master (ctree, favorites);

	for (list = master_groups; list; list = list->next) {
		group = (struct master *) list->data;
		if (group->masters) {
			// If set to display only configured games, and game is not configured,
			// don't update the display with the master.
			if (games[group->type].cmd || !default_show_only_configured_games) {
				source_ctree_enable_master_group (ctree, group, FALSE);
				parent = gtk_ctree_find_by_row_data (GTK_CTREE (ctree), NULL, group);

				for (list2 = group->masters; list2; list2 = list2->next) {
					m = (struct master *) list2->data;
					node = gtk_ctree_insert_node (GTK_CTREE (ctree), parent, NULL, NULL, 4, NULL, NULL, NULL, NULL, TRUE, FALSE);
					gtk_ctree_node_set_row_data (GTK_CTREE (ctree), node, m);
					source_ctree_show_node_status (ctree, m);
				}
			}
		}
	}
}
Exemple #2
0
static GtkCTreeNode *mimeview_append_part(MimeView *mimeview,
					  MimeInfo *partinfo,
					  GtkCTreeNode *parent)
{
	GtkCTree *ctree = GTK_CTREE(mimeview->ctree);
	GtkCTreeNode *node;
	static gchar content_type[64];
	gchar *str[N_MIMEVIEW_COLS];

	if (partinfo->type != MIMETYPE_UNKNOWN && partinfo->subtype) {
		g_snprintf(content_type, 64, "%s/%s", procmime_get_media_type_str(partinfo->type), partinfo->subtype);
	} else {
		g_snprintf(content_type, 64, "UNKNOWN");
	}

	str[COL_MIMETYPE] = content_type;
	str[COL_SIZE] = to_human_readable(partinfo->length);
	if (prefs_common.attach_desc)
		str[COL_NAME] = (gchar *) get_part_description(partinfo);
	else
		str[COL_NAME] = (gchar *) get_part_name(partinfo);

	node = gtk_ctree_insert_node(ctree, parent, NULL, str, 0,
				     NULL, NULL, NULL, NULL,
				     FALSE, TRUE);
	gtk_ctree_node_set_row_data(ctree, node, partinfo);

	return node;
}
Exemple #3
0
void source_ctree_add_master (GtkWidget *ctree, struct master *m) {
	GtkCTreeNode *node;
	GtkCTreeNode *parent = NULL;
	struct master *group = NULL;

	if (m->isgroup)
		return;

	// If set to display only configured games, and game is not configured,
	// and it's not the 'Favorites' master, just return so the display
	// isn't updated with the game type and masters.
	if (!(games[m->type].cmd) && default_show_only_configured_games && m != favorites)
		return;

	if (m->type != UNKNOWN_SERVER) {
		group = (struct master *) g_slist_nth_data (master_groups, m->type);
		source_ctree_enable_master_group (ctree, group, TRUE);
	}

	node = gtk_ctree_find_by_row_data (GTK_CTREE (ctree), NULL, m);

	if (!node) {
		if (group) {
			parent = gtk_ctree_find_by_row_data (GTK_CTREE (ctree), NULL, group);
		}
		node = gtk_ctree_insert_node (GTK_CTREE (ctree), parent, NULL, NULL, 4, NULL, NULL, NULL, NULL, TRUE, FALSE);
		gtk_ctree_node_set_row_data (GTK_CTREE (ctree), node, m);
	}
	source_ctree_show_node_status (ctree, m);
}
Exemple #4
0
void
gftpui_add_file_to_transfer (gftp_transfer * tdata, GList * curfle)
{
  gftpui_common_curtrans_data * transdata;
  char *text[2];
  gftp_file * fle;

  fle = curfle->data;
  text[0] = gftpui_gtk_get_utf8_file_pos (fle);

  if (fle->transfer_action == GFTP_TRANS_ACTION_SKIP)
    text[1] = _("Skipped");
  else
    text[1] = _("Waiting...");

  fle->user_data = gtk_ctree_insert_node (GTK_CTREE (dlwdw),
                                          tdata->user_data, NULL, text, 5,
                                          NULL, NULL, NULL, NULL,
                                          FALSE, FALSE);
  transdata = g_malloc0 (sizeof (*transdata));
  transdata->transfer = tdata;
  transdata->curfle = curfle;

  gtk_ctree_node_set_row_data (GTK_CTREE (dlwdw), fle->user_data, transdata);
}
Exemple #5
0
void variable_ctree_add_var(GtkCTree *ctree, gchar *name, v5d_var_info *vinfo)
{
    GtkCTreeNode *node;
    gchar *nstr[1];
    nstr[0] = name;
    node = gtk_ctree_insert_node(ctree,NULL,NULL,nstr,0,NULL,NULL,NULL,NULL,1,0);
    gtk_ctree_node_set_row_data(ctree,node,(gpointer) vinfo);
}
Exemple #6
0
int add_a_site_to_the_tree(struct site *a_site, gint operation) 
{
    struct ctree_attachment *info_to_add;
    gchar *tmp, *node_label[1];
    
    tmp = getAppropriateTreeLabel(a_site);
    node_label[0] = tmp;
    
    site_item = gtk_ctree_insert_node(GTK_CTREE(the_tree), NULL, NULL, node_label,
				      0, NULL, NULL, NULL, NULL, FALSE, FALSE);
    g_free (tmp);
    
    info_to_add = malloc(sizeof(struct ctree_attachment));
    info_to_add->file_or_site = IS_A_SITE;
    info_to_add->info_struct = (void *) a_site;
    gtk_ctree_node_set_row_data(GTK_CTREE(the_tree), site_item,
				(gpointer) info_to_add);

    /* Read site info */
   if (site_readfiles(a_site) != SITE_OK)
     /* We effectively have no info file, so just read the stored state. */
     site_read_local_state(a_site);

    /* Catchup or init, if that's required */
    if (operation == 1)
      {
	  site_initialize(a_site);
	  printf("Initialised site\n");
      }
    else if (operation == 2)
      {
	  site_catchup(a_site);
	  printf("Caught-up new site.\n");
      }
/* As far as I can tell, this doesn't need to be done. 
 * Not sure why it's in here*/
    site_write_stored_state(a_site);
    
    
    if (operation != 3)
      {
	  gtk_clist_freeze(GTK_CLIST(the_tree));
	  populate_site_node(GTK_CTREE_NODE(site_item), a_site);
	  gtk_clist_thaw(GTK_CLIST(the_tree));
      }
    
    return 0;
}
Exemple #7
0
static void source_ctree_enable_master_group (GtkWidget *ctree, struct master *m, int expand) {
	GtkCTreeNode *node;
	GtkCTreeNode *sibling = NULL;
	char cfgkey[128];
	GSList *list;
	int expanded;

	if (!m->isgroup)
		return;

	node = gtk_ctree_find_by_row_data (GTK_CTREE (ctree), NULL, m);

	if (node != NULL) {
		if (expand)
			gtk_ctree_expand (GTK_CTREE (ctree), node);
		return;
	}

	g_snprintf (cfgkey, 128, "/" CONFIG_FILE "/Source Tree/%s node collapsed=false", m->name);

	if (expand)
		config_set_bool (cfgkey, expanded = TRUE);
	else
		expanded = TRUE - config_get_bool (cfgkey);

	/* Find the place to insert new master group */

	list = g_slist_nth (master_groups, m->type);
	if (list)
		list = list->next;

	while (!sibling && list) {
		sibling = gtk_ctree_find_by_row_data (GTK_CTREE (ctree), NULL, (struct master *) list->data);
		list = list->next;
	}

	node = gtk_ctree_insert_node (GTK_CTREE (ctree), NULL, sibling, NULL, 4, NULL, NULL, NULL, NULL, FALSE, expanded);
	gtk_ctree_node_set_row_data (GTK_CTREE (ctree), node, m);
	source_ctree_show_node_status (ctree, m);
}
Exemple #8
0
static GtkCTreeNode *maketree_nodes(GtkCTreeNode *subtree, struct tree *t2, GtkCTreeNode *sibling, int mode)
{
char *tmp, *tmp2, *tmp3;
gchar *text [1];
GdkDrawable *pxm, *msk;

if(t2->t_which >= 0)
	{
        if(GLOBALS->facs[t2->t_which]->vec_root)
        	{
                if(GLOBALS->autocoalesce)
                	{
                        if(GLOBALS->facs[t2->t_which]->vec_root!=GLOBALS->facs[t2->t_which])
                        	{
				return(NULL);
                                }

                        tmp2=makename_chain(GLOBALS->facs[t2->t_which]);
                        tmp3=leastsig_hiername(tmp2);
                        tmp=wave_alloca(strlen(tmp3)+4);
                        strcpy(tmp,   "[] ");
                        strcpy(tmp+3, tmp3);
                        free_2(tmp2);
                        }
                        else
                        {
                        tmp=wave_alloca(strlen(t2->name)+4);
                        strcpy(tmp,   "[] ");
                        strcpy(tmp+3, t2->name);
                        }
		}
                else
                {
                tmp=t2->name;
                }
	}
        else
        {
	if(t2->t_which == WAVE_T_WHICH_UNDEFINED_COMPNAME)
		{
        	tmp=t2->name;
		}
		else
		{
		int thidx = -t2->t_which + WAVE_T_WHICH_COMPNAME_START;
		if((thidx >= 0) && (thidx < GLOBALS->comp_name_serial))
			{
			char *sc = GLOBALS->comp_name_idx[thidx];
			int tlen = strlen(t2->name) + 2 + 1 + strlen(sc) + 1 + 1;
			tmp = wave_alloca(tlen);
			if(!GLOBALS->is_vhdl_component_format)
				{
				sprintf(tmp, "%s  (%s)", t2->name, sc);
				}
			else
				{
				sprintf(tmp, "%s  : %s", t2->name, sc);
				}
			}
			else
			{
	        	tmp=t2->name;	/* should never get a value out of range here! */
			}
		}
        }

text[0]=tmp;
switch(mode)
	{
	case MAKETREE_FLATTEN:
		if(t2->child)
			{
		        sibling = gtk_ctree_insert_node (GLOBALS->ctree_main, subtree, sibling, text, 3,
                	                       NULL, NULL, NULL, NULL,
                	                       FALSE, FALSE);
			gtk_ctree_node_set_row_data(GLOBALS->ctree_main, sibling, t2);
			maketree(sibling, t2->child);
			}
			else
			{
		        sibling = gtk_ctree_insert_node (GLOBALS->ctree_main, subtree, sibling, text, 3,
                	                       NULL, NULL, NULL, NULL,
                	                       TRUE, FALSE);
			gtk_ctree_node_set_row_data(GLOBALS->ctree_main, sibling, t2);
			}
		break;

	default:
		switch(t2->kind)
			{
   			case TREE_VCD_ST_MODULE:	pxm = GLOBALS->hiericon_module_pixmap; msk = GLOBALS->hiericon_module_mask; break;
   			case TREE_VCD_ST_TASK:		pxm = GLOBALS->hiericon_task_pixmap; msk = GLOBALS->hiericon_task_mask; break;
   			case TREE_VCD_ST_FUNCTION:	pxm = GLOBALS->hiericon_function_pixmap; msk = GLOBALS->hiericon_function_mask; break;
   			case TREE_VCD_ST_BEGIN:		pxm = GLOBALS->hiericon_begin_pixmap; msk = GLOBALS->hiericon_begin_mask; break;
   			case TREE_VCD_ST_FORK:		pxm = GLOBALS->hiericon_fork_pixmap; msk = GLOBALS->hiericon_fork_mask; break;
			case TREE_VCD_ST_GENERATE:	pxm = GLOBALS->hiericon_generatefor_pixmap; msk = GLOBALS->hiericon_generatefor_mask; break; /* same as TREE_VHDL_ST_GENFOR */
			case TREE_VCD_ST_STRUCT:	pxm = GLOBALS->hiericon_block_pixmap; msk = GLOBALS->hiericon_block_mask; break; /* same as TREE_VHDL_ST_BLOCK */
			case TREE_VCD_ST_UNION:		pxm = GLOBALS->hiericon_instance_pixmap; msk = GLOBALS->hiericon_instance_mask; break; /* same as TREE_VHDL_ST_INSTANCE */
			case TREE_VCD_ST_CLASS:		pxm = GLOBALS->hiericon_class_pixmap; msk = GLOBALS->hiericon_class_mask; break;
			case TREE_VCD_ST_INTERFACE:	pxm = GLOBALS->hiericon_interface_pixmap; msk = GLOBALS->hiericon_interface_mask; break;
			case TREE_VCD_ST_PACKAGE:	pxm = GLOBALS->hiericon_svpackage_pixmap; msk = GLOBALS->hiericon_svpackage_mask; break;
			case TREE_VCD_ST_PROGRAM:	pxm = GLOBALS->hiericon_program_pixmap; msk = GLOBALS->hiericon_program_mask; break;

			case TREE_VHDL_ST_DESIGN:	pxm = GLOBALS->hiericon_design_pixmap; msk = GLOBALS->hiericon_design_mask; break;
			case TREE_VHDL_ST_BLOCK:	pxm = GLOBALS->hiericon_block_pixmap; msk = GLOBALS->hiericon_block_mask; break;
			case TREE_VHDL_ST_GENIF:	pxm = GLOBALS->hiericon_generateif_pixmap; msk = GLOBALS->hiericon_generateif_mask; break;
			case TREE_VHDL_ST_GENFOR:	pxm = GLOBALS->hiericon_generatefor_pixmap; msk = GLOBALS->hiericon_generatefor_mask; break;
			case TREE_VHDL_ST_INSTANCE:	pxm = GLOBALS->hiericon_instance_pixmap; msk = GLOBALS->hiericon_instance_mask; break;
			case TREE_VHDL_ST_PACKAGE:	pxm = GLOBALS->hiericon_package_pixmap; msk = GLOBALS->hiericon_package_mask; break;

			case TREE_VHDL_ST_SIGNAL:	pxm = GLOBALS->hiericon_signal_pixmap; msk = GLOBALS->hiericon_signal_mask; break;
			case TREE_VHDL_ST_PORTIN:	pxm = GLOBALS->hiericon_portin_pixmap; msk = GLOBALS->hiericon_portin_mask; break;
			case TREE_VHDL_ST_PORTOUT:	pxm = GLOBALS->hiericon_portout_pixmap; msk = GLOBALS->hiericon_portout_mask; break;
			case TREE_VHDL_ST_PORTINOUT:	pxm = GLOBALS->hiericon_portinout_pixmap; msk = GLOBALS->hiericon_portinout_mask; break;
			case TREE_VHDL_ST_BUFFER:	pxm = GLOBALS->hiericon_buffer_pixmap; msk = GLOBALS->hiericon_buffer_mask; break;
			case TREE_VHDL_ST_LINKAGE:	pxm = GLOBALS->hiericon_linkage_pixmap; msk = GLOBALS->hiericon_linkage_mask; break;

   			case TREE_VHDL_ST_ARCHITECTURE:	pxm = GLOBALS->hiericon_module_pixmap; msk = GLOBALS->hiericon_module_mask; break; /* same as TREE_VCD_ST_MODULE */
   			case TREE_VHDL_ST_FUNCTION:	pxm = GLOBALS->hiericon_function_pixmap; msk = GLOBALS->hiericon_function_mask; break; /* same as TREE_VCD_ST_FUNCTION */
   			case TREE_VHDL_ST_PROCESS:	pxm = GLOBALS->hiericon_task_pixmap; msk = GLOBALS->hiericon_task_mask; break; /* same as TREE_VCD_ST_TASK */
			case TREE_VHDL_ST_PROCEDURE:	pxm = GLOBALS->hiericon_class_pixmap; msk = GLOBALS->hiericon_class_mask; break; /* same as TREE_VCD_ST_CLASS */
			case TREE_VHDL_ST_RECORD:	pxm = GLOBALS->hiericon_record_pixmap; msk = GLOBALS->hiericon_record_mask; break;
			case TREE_VHDL_ST_GENERATE:	pxm = GLOBALS->hiericon_generate_pixmap; msk = GLOBALS->hiericon_generate_mask; break;

			default:			pxm = msk = NULL; break;
			}

	        sibling = gtk_ctree_insert_node (GLOBALS->ctree_main, subtree, sibling, text, 3,
               	                       pxm, msk, pxm, msk,
               	                       (mode==MAKETREE_LEAF), FALSE);
		gtk_ctree_node_set_row_data(GLOBALS->ctree_main, sibling, t2);
		break;
	}

return(sibling);
}
Exemple #9
0
/*
 * Create a node that will contain all sampled symbol information.
 */
static void
gdisp_createSymbolNode(Kernel_T     *kernel,
		       GtkWidget    *parent,
		       GtkWidget    *tree,
		       GtkCTreeNode *sampledSymbolNode,
		       Symbol_T     *symbol)
{

  GtkCTreeNode *iNode                       = (GtkCTreeNode*)NULL;
  GList        *iExtInfoItem                = (GList*)NULL;
  Pixmap_T     *pPixmap                     = (Pixmap_T*)NULL;
  gchar        *iNames [GD_TREE_NB_COLUMNS] = { (gchar*)NULL,  (gchar*)NULL };
  gchar         iInfo  [128];
  gchar         iMin   [128];
  gchar         iMax   [128];

  /*
   * The name of the node is the name of the symbol.
   */
  iNames[0] = symbol->sInfo.name;
  iNames[1] = iInfo;
  if (symbol->sInfo.dimension == 1) {
    sprintf(iNames[1],
	    "Type %s",
	    gdisp_getTypeAsString(symbol));
  }
  else {
    sprintf(iNames[1],
	    "Type %s [%d]",
	    gdisp_getTypeAsString(symbol),
	    symbol->sInfo.dimension);
  }

  symbol->sNode = gtk_ctree_insert_node(GTK_CTREE(tree),
					sampledSymbolNode,
					(GtkCTreeNode*)NULL, /* no sibling */
					iNames,
					GD_TREE_SPACING,
					(GdkPixmap*)NULL,
					(GdkBitmap*)NULL,
					(GdkPixmap*)NULL,
					(GdkBitmap*)NULL,
					FALSE, /* is a leave  */
					FALSE); /* is expanded */

  gtk_ctree_node_set_row_data(GTK_CTREE(tree),
			      symbol->sNode,
			      (gpointer)symbol);

  /*
   * Insert information node : PERIOD.
   */
  iNames[0] = "Period";
  iNames[1] = iInfo;
  sprintf(iNames[1],"%d",symbol->sInfo.period);

  iNode = gtk_ctree_insert_node(GTK_CTREE(tree),
				symbol->sNode, /* symbol node is the parent */
				(GtkCTreeNode*)NULL, /* no sibling node */
				iNames,
				GD_TREE_SPACING,
				(GdkPixmap*)NULL,
				(GdkBitmap*)NULL,
				(GdkPixmap*)NULL,
				(GdkBitmap*)NULL,
				TRUE,   /* is a leave  */
				FALSE); /* is expanded */

  gtk_ctree_node_set_selectable(GTK_CTREE(tree),
				iNode,
				FALSE); /* not selectable */


  /*
   * Insert information node : PHASE.
   */
  iNames[0] = "Phase";
  iNames[1] = iInfo;
  sprintf(iNames[1],"%d",symbol->sInfo.phase);

  iNode = gtk_ctree_insert_node(GTK_CTREE(tree),
				symbol->sNode, /* symbol node is the parent */
				(GtkCTreeNode*)NULL, /* no sibling node */
				iNames,
				GD_TREE_SPACING,
				(GdkPixmap*)NULL,
				(GdkBitmap*)NULL,
				(GdkPixmap*)NULL,
				(GdkBitmap*)NULL,
				TRUE,   /* is a leave  */
				FALSE); /* is expanded */

  gtk_ctree_node_set_selectable(GTK_CTREE(tree),
				iNode,
				FALSE); /* not selectable */


  /*
   * Insert information node : RANGE.
   */
  iNames[0] = "Range";
  iNames[1] = iInfo;
  if (symbol->sMinimum > (- G_MAXDOUBLE)) {
    sprintf(iMin,"%f",symbol->sMinimum);
  }
  else {
    sprintf(iMin,"n/a");
  }
  if (symbol->sMaximum < (+ G_MAXDOUBLE)) {
    sprintf(iMax,"%f",symbol->sMaximum);
  }
  else {
    sprintf(iMax,"n/a");
  }
  sprintf(iNames[1],"[ %s .. %s ]",iMin,iMax);

  iNode = gtk_ctree_insert_node(GTK_CTREE(tree),
				symbol->sNode, /* symbol node is the parent */
				(GtkCTreeNode*)NULL, /* no sibling node */
				iNames,
				GD_TREE_SPACING,
				(GdkPixmap*)NULL,
				(GdkBitmap*)NULL,
				(GdkPixmap*)NULL,
				(GdkBitmap*)NULL,
				TRUE,   /* is a leave  */
				FALSE); /* is expanded */

  gtk_ctree_node_set_selectable(GTK_CTREE(tree),
				iNode,
				FALSE); /* not selectable */


  /*
   * Insert information node : REFERENCE.
   */
  iNames[0] = "Reference";
  iNames[1] = iInfo;
  sprintf(iNames[1],"%d",symbol->sReference);

  iNode = gtk_ctree_insert_node(GTK_CTREE(tree),
				symbol->sNode, /* symbol node is the parent */
				(GtkCTreeNode*)NULL, /* no sibling node */
				iNames,
				GD_TREE_SPACING,
				(GdkPixmap*)NULL,
				(GdkBitmap*)NULL,
				(GdkPixmap*)NULL,
				(GdkBitmap*)NULL,
				TRUE,   /* is a leave  */
				FALSE); /* is expanded */

  gtk_ctree_node_set_selectable(GTK_CTREE(tree),
				iNode,
				FALSE); /* not selectable */

  gtk_ctree_node_set_row_data(GTK_CTREE(tree),
			      iNode,
			      (gpointer)"sReference");


  /*
   * Insert extended information.
   */
  pPixmap = gdisp_getPixmapById(kernel,
				GD_PIX_info,
				parent);

  iExtInfoItem = g_list_first(symbol->sExtInfoList);
  while (iExtInfoItem != (GList*)NULL) {

    iNames[0] = ((gchar**)(iExtInfoItem->data))[0];
    iNames[1] = ((gchar**)(iExtInfoItem->data))[1];

    iNode = gtk_ctree_insert_node(GTK_CTREE(tree),
				  symbol->sNode, /* the parent */
				  (GtkCTreeNode*)NULL, /* no sibling node */
				  iNames,
				  GD_TREE_SPACING,
				  pPixmap->pixmap,
				  pPixmap->mask,
				  pPixmap->pixmap,
				  pPixmap->mask,
				  TRUE,   /* is a leave  */
				  FALSE); /* is expanded */

    gtk_ctree_node_set_selectable(GTK_CTREE(tree),
				  iNode,
				  FALSE); /* not selectable */

    iExtInfoItem = g_list_next(iExtInfoItem);

  }

}
Exemple #10
0
/*
 * Create a node that will contain all provider information.
 */
static void
gdisp_createProviderNode(Kernel_T      *kernel,
			 GtkWidget     *parent,
			 GtkWidget     *tree,
			 Provider_T    *provider,
			 GtkCTreeNode **providerNode,
			 GtkCTreeNode **sampledSymbolNode)
{

  gchar        *pNames [GD_TREE_NB_COLUMNS] = { (gchar*)NULL,  (gchar*)NULL };
  GtkCTreeNode *iNode                       = (GtkCTreeNode*)NULL;
  GtkCTreeNode *sNode                       = (GtkCTreeNode*)NULL;
  Pixmap_T     *pPixmap                     = (Pixmap_T*)NULL;

  /*
   * The name of the node is the URL of the provider.
   * Get back provider pixmap according to its identity.
   */
  pNames[0] = provider->pUrl->str;

  pPixmap = gdisp_getProviderIdPixmap(kernel,
				      parent,
				      provider->pIdentity);

  provider->pNode = gtk_ctree_insert_node(GTK_CTREE(tree),
					  (GtkCTreeNode*)NULL, /* parent  */
					  (GtkCTreeNode*)NULL, /* sibling */
					  pNames,
					  GD_TREE_SPACING,
					  pPixmap->pixmap,
					  pPixmap->mask,
					  pPixmap->pixmap,
					  pPixmap->mask,
					  FALSE, /* is a leave  */
					  TRUE); /* is expanded */

  gtk_ctree_node_set_row_data(GTK_CTREE(tree),
			      provider->pNode,
			      (gpointer)provider);

  gtk_ctree_node_set_selectable(GTK_CTREE(tree),
				provider->pNode,
				FALSE); /* not selectable */

  /*
   * Insert information node.
   */
  pNames[0] = "Information";

  pPixmap = gdisp_getPixmapById(kernel,
				GD_PIX_info,
				parent);

  iNode = gtk_ctree_insert_node(GTK_CTREE(tree),
				provider->pNode, /* provider is the parent */
				(GtkCTreeNode*)NULL, /* no sibling node */
				pNames,
				GD_TREE_SPACING,
				pPixmap->pixmap,
				pPixmap->mask,
				pPixmap->pixmap,
				pPixmap->mask,
  /* FIXME for the moment */    TRUE, /* is a leave  */
				FALSE); /* is expanded */

  gtk_ctree_node_set_selectable(GTK_CTREE(tree),
				iNode,
				FALSE); /* not selectable */

  /*
   * Insert sampled symbol node.
   */
  pNames[0] = "Sampled Symbols";
  sNode = gtk_ctree_insert_node(GTK_CTREE(tree),
				provider->pNode, /* provider is the parent */
				(GtkCTreeNode*)NULL, /* no sibling node */
				pNames,
				GD_TREE_SPACING,
				kernel->widgets.collapsedNodePixmap->pixmap,
				kernel->widgets.collapsedNodePixmap->mask,
				kernel->widgets.expandedNodePixmap->pixmap,
				kernel->widgets.expandedNodePixmap->mask,
				FALSE, /* is a leave  */
				FALSE); /* is expanded */

  gtk_ctree_node_set_row_data(GTK_CTREE(tree),
			      sNode,
			      (gpointer)"sAnchor");

  gtk_ctree_node_set_text(GTK_CTREE(tree),
			  sNode,
			  0, /* column */
			  pNames[0]);

  gtk_ctree_node_set_selectable(GTK_CTREE(tree),
				sNode,
				FALSE); /* not selectable */

  if (gdisp_getProviderNumber(kernel) == 1) {

    /*
     * Expand that node if there is only one provider.
     */
    gtk_ctree_expand(GTK_CTREE(tree),sNode);

  }

  /*
   * Return.
   */
  *providerNode      = provider->pNode;
  *sampledSymbolNode = sNode;

}
Exemple #11
0
static void
show_transfer (gftp_transfer * tdata)
{
  GdkPixmap * closedir_pixmap, * opendir_pixmap;
  GdkBitmap * closedir_bitmap, * opendir_bitmap;
  gftpui_common_curtrans_data * transdata;
  gftp_file * tempfle;
  GList * templist;
  char *text[2];

  gftp_get_pixmap (dlwdw, "open_dir.xpm", &opendir_pixmap, &opendir_bitmap);
  gftp_get_pixmap (dlwdw, "dir.xpm", &closedir_pixmap, &closedir_bitmap);

  text[0] = tdata->fromreq->hostname;
  text[1] = _("Waiting...");
  tdata->user_data = gtk_ctree_insert_node (GTK_CTREE (dlwdw), NULL, NULL, 
                                       text, 5,
                                       closedir_pixmap, closedir_bitmap, 
                                       opendir_pixmap, opendir_bitmap, 
                                       FALSE, 
                                       tdata->numdirs + tdata->numfiles < 50);
  transdata = g_malloc0 (sizeof (*transdata));
  transdata->transfer = tdata;
  transdata->curfle = NULL;
  gtk_ctree_node_set_row_data (GTK_CTREE (dlwdw), tdata->user_data, transdata);
  tdata->show = 0;
  tdata->curfle = tdata->updfle = tdata->files;

  tdata->total_bytes = 0;
  for (templist = tdata->files; templist != NULL; templist = templist->next)
    {
      tempfle = templist->data;

      text[0] = gftpui_gtk_get_utf8_file_pos (tempfle);
      if (tempfle->transfer_action == GFTP_TRANS_ACTION_SKIP)
        text[1] = _("Skipped");
      else
        {
          tdata->total_bytes += tempfle->size;
          text[1] = _("Waiting...");
        }

      tempfle->user_data = gtk_ctree_insert_node (GTK_CTREE (dlwdw), 
                                             tdata->user_data, 
                                             NULL, text, 5, NULL, NULL, NULL, 
                                             NULL, FALSE, FALSE);
      transdata = g_malloc0 (sizeof (*transdata));
      transdata->transfer = tdata;
      transdata->curfle = templist;
      gtk_ctree_node_set_row_data (GTK_CTREE (dlwdw), tempfle->user_data, 
                                   transdata);
    }

  if (!tdata->toreq->stopable && gftp_need_password (tdata->toreq))
    {
      tdata->toreq->stopable = 1;
      MakeEditDialog (_("Enter Password"),
		      _("Please enter your password for this site"), NULL, 0,
		      NULL, gftp_dialog_button_connect, 
                      get_trans_password, tdata->toreq,
		      cancel_get_trans_password, tdata);
    }

  if (!tdata->fromreq->stopable && gftp_need_password (tdata->fromreq))
    {
      tdata->fromreq->stopable = 1;
      MakeEditDialog (_("Enter Password"),
		      _("Please enter your password for this site"), NULL, 0,
		      NULL, gftp_dialog_button_connect, 
                      get_trans_password, tdata->fromreq,
		      cancel_get_trans_password, tdata);
    }
}
Exemple #12
0
GtkCTreeNode *add_file(char *name, struct site_file *a_file,
		       GtkCTreeNode * parent)
{
/* External icons */
/* dir is closed, dir2 is open */
    extern GdkPixmap *dir, *dir_new, *dir_changed, *dir_del;
    extern GdkPixmap *dir2, *dir2_new, *dir2_changed, *dir2_del;
    extern GdkPixmap *xsitecopy_file, *xsitecopy_file_new, *xsitecopy_file_changed, *xsitecopy_file_del, *xsitecopy_file_moved;
    extern GdkPixmap *symbolic_link, *symbolic_link_new, *symbolic_link_changed, *symbolic_link_del;

    /* Bitmaps */
    extern GdkBitmap *dir_map, *dir_new_map, *dir_changed_map, *dir_del_map;
    extern GdkBitmap *dir2_map, *dir2_new_map, *dir2_changed_map, *dir2_del_map;
    extern GdkBitmap *xsitecopy_file_map, *xsitecopy_file_new_map, *xsitecopy_file_changed_map, *xsitecopy_file_del_map, *xsitecopy_file_moved_map;
    extern GdkBitmap *symbolic_link_map, *symbolic_link_new_map, *symbolic_link_changed_map, *symbolic_link_del_map;

    
    GtkCTreeNode *file_im_adding;
    struct ctree_attachment *file_info_to_add;
    gchar *node_label[1];
    GdkPixmap *image, *image2 = NULL;
    GdkBitmap *mask, *mask2 = NULL;

    file_info_to_add = g_malloc0(sizeof(struct ctree_attachment));
    file_info_to_add->file_or_site = IS_A_FILE;
    /* Pointer to this file */
    file_info_to_add->info_struct = (gpointer) a_file;

    
    /* Check if this file is a symbolic_link or directory */
        
    if (a_file->type == file_link)
      {
	  if (a_file->diff != file_unchanged) 
	    {
		if (a_file->diff == file_changed)
		  {
		      image = symbolic_link_changed;
		      mask = symbolic_link_changed_map;
		  } 
		else if (a_file->diff == file_deleted)
		  {
		      image = symbolic_link_del;
		      mask = symbolic_link_del_map;
		  }
		else 
		  {
		      image = symbolic_link_new;
		      mask = symbolic_link_new_map;
		  }
	    }
	  else 
	    {
		image = symbolic_link; mask = symbolic_link_map;
	    }
      }
    
    /* Check if it's actually a directory */
    else if (a_file->type == file_dir) 
      {
	  if (a_file->diff != file_unchanged) 
	    {
		if (a_file->diff == file_changed)
		  {
		      image = dir_changed;
		      mask = dir_changed_map;
		      image2 = dir2_changed;
		      mask2 = dir2_changed_map;
		  } 
		else if (a_file->diff == file_deleted)
		  {
		      image = dir_del;
		      mask = dir_del_map;
		      image2 = dir2_del;
		      mask2 = dir2_del_map;
		  }
		else 
		  {
		      image = dir_new;
		      mask = dir_new_map;
		      image2 = dir2_new;
		      mask2 = dir2_new_map;
		  }
	    }
	  else 
	    {
		image = dir; mask = dir_map;
		image2 = dir2; mask2 = dir2_map;
	    }
      }

    else
      {
	  
	  /* Set the image of this new file depending upon file status */
	  if (a_file->diff != file_unchanged) 
	    {
		if (a_file->diff == file_changed)
		  {
		      image = xsitecopy_file_changed;
		      mask = xsitecopy_file_changed_map;
		  } 
		else if (a_file->diff == file_deleted)
		  {
		      image = xsitecopy_file_del;
		      mask = xsitecopy_file_del_map;
		  }
		else if (a_file->diff == file_moved)
		  {
		      image = xsitecopy_file_moved;
		      mask = xsitecopy_file_moved_map;
		  }
		else 
		  {
		      image = xsitecopy_file_new;
		      mask = xsitecopy_file_new_map;
		  }
	    }
	  else 
	    {
		image = xsitecopy_file;
		mask = xsitecopy_file_map;
	    }
      }
    
    /* Set the node's text label accordingly */
    node_label[0] = name;

    /* Add the node */
    file_im_adding = gtk_ctree_insert_node(GTK_CTREE(the_tree),
					   GTK_CTREE_NODE(parent),
					   NULL, node_label, 3,
					   image,
					   mask,
					   a_file->type == file_dir ? image2 : image,
					   a_file->type == file_dir ? mask2 : mask,
					   FALSE, FALSE);
    gtk_ctree_node_set_row_data(GTK_CTREE(the_tree), file_im_adding,
				(gpointer) file_info_to_add);
    return file_im_adding;
}
Exemple #13
0
/* a mailbox was clicked 
 * TODO: this is called twice on keypress... up and down?
 */
void
on_mailboxlist_tree_select_row (GtkCTree * ctree,
    GList * UNUSED(node), gint UNUSED(column), gpointer UNUSED(user_data))
{
    GtkWidget *mailbox, *stat;
    GtkCTreeNode *n;
    GtkCList *clist;
    GtkWidget *appbar;
    gchar *text[3];
    synopsis **syn;
    int x = 0, mboxcount;
    mboxview *m;

    n = gtk_ctree_node_nth (ctree, (&(ctree->clist))->focus_row);
    m = (mboxview *) gtk_ctree_node_get_row_data (ctree, n);

    if (m == NULL)
    {
	printf (_("Bad mbox (null)\n"));
	exit (-1);
    }
    stat = lookup_widget (gems, "appbar1");
    mailbox = lookup_widget (gems, "mailbox");
    appbar = lookup_widget (gems, "appbar1");

    /*** TODO *** clear the mail things */
    putmail (NULL);

    gnome_appbar_push (GNOME_APPBAR (stat), _("Reading synopsis"));
    while (gtk_events_pending ())
	gtk_main_iteration ();
    syn = (synopsis **) db_read_synopsis (m->mailbox->id, m->status);
    gnome_appbar_pop (GNOME_APPBAR (stat));
    gnome_appbar_push (GNOME_APPBAR (stat), _("Displaying mailbox"));
    while (gtk_events_pending ())
	gtk_main_iteration ();

    clist = &GTK_CTREE (mailbox)->clist;

    gtk_clist_clear (clist);
    while (gtk_events_pending ())
	gtk_main_iteration ();

    gtk_clist_freeze (clist);

    if(syn) {
	mboxcount = 0;
	while (syn[mboxcount] != NULL)
	    mboxcount++;

	while (syn[x] != NULL)
	{
	    GtkCTreeNode *n;

	    text[0] = syn[x]->sender;
	    text[1] = syn[x]->date;
	    text[2] = syn[x]->subject;

	    n = gtk_ctree_insert_node (GTK_CTREE (mailbox), NULL, NULL, text, 5,
		    NULL, NULL, NULL, NULL, TRUE, TRUE);
	    gtk_ctree_node_set_row_data (GTK_CTREE (mailbox), n, syn[x]);

	    gnome_appbar_set_progress (GNOME_APPBAR (appbar),
		    (float)x / (float)mboxcount);
	    /*
	     * pump the status bar 
	     */
	    if (gtk_events_pending ())
		gtk_main_iteration ();

	    x++;
	}
	free (syn);
    }
    gtk_clist_set_sort_column (clist, 1);
    gtk_clist_set_sort_type (clist, GTK_SORT_ASCENDING);
    gtk_clist_sort (clist);
    gtk_clist_thaw (clist);
    update_mboxlist (NULL);
    gnome_appbar_set_progress (GNOME_APPBAR (appbar), 0.0);
    gnome_appbar_pop (GNOME_APPBAR (stat));

    /*
     * gtk_signal_handler_unblock(GTK_OBJECT(ctree), select_row);
     */

}
Exemple #14
0
void
set_mboxlist ()
{
    int x;
    mboxs **mboxlist;
    GtkCTree *tree;
    char *read, *unread, *marked, *all;

    mboxlist = (mboxs **) db_read_mboxlist ();
    tree = GTK_CTREE (lookup_widget (gems, "mailboxlist"));
    all = strdup ("all");
    read = strdup ("read");
    unread = strdup ("unread");
    marked = strdup ("marked");

    gtk_clist_freeze (&GTK_CTREE (tree)->clist);
    gtk_clist_clear (&GTK_CTREE (tree)->clist);

    x = 0;
    if(mboxlist) {
	while (mboxlist[x] != NULL)
	{
	    GtkCTreeNode *node, *n;
	    char *text;

	    text = mboxlist[x]->name;
	    node =
		gtk_ctree_insert_node (tree, NULL, NULL, &text, 5, NULL,
			NULL, NULL, NULL, FALSE, FALSE);
	    gtk_ctree_node_set_row_data (tree, node,
		    new_mboxview (mboxlist[x],
			default_mboxlistbehavior));
	    n = gtk_ctree_insert_node (tree, node, NULL, &all, 5, NULL, NULL,
		    NULL, NULL, TRUE, TRUE);
	    gtk_ctree_node_set_row_data (tree, n,
		    new_mboxview (mboxlist[x], DB_ALL));
	    n = gtk_ctree_insert_node (tree, node, NULL, &unread, 5, NULL, NULL,
		    NULL, NULL, TRUE, TRUE);
	    gtk_ctree_node_set_row_data (tree, n,
		    new_mboxview (mboxlist[x], DB_UNREAD));
	    n = gtk_ctree_insert_node (tree, node, NULL, &read, 5, NULL, NULL,
		    NULL, NULL, TRUE, TRUE);
	    gtk_ctree_node_set_row_data (tree, n,
		    new_mboxview (mboxlist[x], DB_READ));
	    n = gtk_ctree_insert_node (tree, node, NULL, &marked, 5, NULL, NULL,
		    NULL, NULL, TRUE, TRUE);
	    gtk_ctree_node_set_row_data (tree, n,
		    new_mboxview (mboxlist[x], DB_MARKED));

	    x++;
	}
	free (mboxlist);
    }

    /*
     * gtk_ctree_select(GTK_CTREE (tree), select_node);
     */
    gtk_clist_thaw (&GTK_CTREE (tree)->clist);
    update_mboxlist (NULL);
    return;
}