Beispiel #1
0
int read_editor_help (void)
{
   FILE *fp;
   int i;
   char linea[128];

   strcpy (linea, text_path);
   strcat (linea, "FSHELP");

   if ((fp = get_system_file (linea)) == NULL) {
      strcpy (linea, config->glob_text_path);
      strcat (linea, "FSHELP");

      if ((fp = get_system_file (linea)) == NULL)
         return (0);
   }

   i = 6;

   while (fgets (linea, 120, fp) != NULL) {
      while (strlen (linea) > 0 && (linea[strlen (linea) - 1] == 0x0D || linea[strlen (linea) - 1] == 0x0A))
         linea[strlen (linea) -1] = '\0';

      cpos (i++, (usr.width ? (usr.width - 1) : 79) - strlen (linea));
      m_print ("\026\001\007%s", linea);
   }

   fclose (fp);
   input (linea, 0);

   return (-1);
}
void on_show_system_colors_activate (GtkMenuItem *menuitem, gpointer user_data)
{
	if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem)))
	{
		/* re-add the system colors */
		add_rgb_file (get_system_file (), SYSTEM_COLOR);
	}
	else
	{
		/* hide the system colors. unfortunately we have to remove them
		   since there's no way to simply hide them. */
		gchar *type;
		GtkTreeIter iterator;
		GtkTreeView *treeview = GTK_TREE_VIEW (lookup_widget (gcolor2, "treeview"));
		GtkTreeModel *model = gtk_tree_view_get_model (treeview);
		
		gtk_tree_model_get_iter_first (model, &iterator);
		while (gtk_list_store_iter_is_valid (GTK_LIST_STORE (model), &iterator))
		{
			gtk_tree_model_get (model, &iterator, COLOR_TYPE, &type, -1);
			if (!strcmp (type, SYSTEM_COLOR))
			{
				gtk_list_store_remove (GTK_LIST_STORE (model), &iterator);
			}
			else
			{
				gtk_tree_model_iter_next (model, &iterator);
			}
		}

	}
}