Gcolor2 is a simple, standalone GTK+ 2.0 color selector.

PR:		ports/80062
Submitted by:	Piotr Smyrak <piotr.smyrak@heron.pl>
Approved by:	adamw (mentor)
This commit is contained in:
Jean-Yves Lefort 2005-04-19 13:14:10 +00:00
parent 5eb3cd1c06
commit 0ff8043321
8 changed files with 177 additions and 0 deletions

View file

@ -109,6 +109,7 @@
SUBDIR += g3dviewer
SUBDIR += gauche-gl
SUBDIR += gcolor
SUBDIR += gcolor2
SUBDIR += gd
SUBDIR += gdal
SUBDIR += gdchart

28
graphics/gcolor2/Makefile Normal file
View file

@ -0,0 +1,28 @@
# New ports collection makefile for: gcolor2
# Date created: 18 April 2005
# Whom: Piotr Smyrak, piotr.smyrak@heron.pl
#
# $FreeBSD$
#
PORTNAME= gcolor2
PORTVERSION= 0.3
CATEGORIES= graphics gnome
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
MAINTAINER= smyru@heron.pl
COMMENT= A simple GTK+ 2.0 color selector
USE_X_PREFIX= yes
USE_GNOME= gtk20 gnomeprefix
GNU_CONFIGURE= yes
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
SUB_FILES= gcolor2.desktop
post-install:
${INSTALL_DATA} ${WRKDIR}/gcolor2.desktop ${PREFIX}/share/gnome/applications
.include <bsd.port.mk>

View file

@ -0,0 +1,2 @@
MD5 (gcolor2-0.3.tar.gz) = c247333e134b1e93132ab7568b9c0986
SIZE (gcolor2-0.3.tar.gz) = 356892

View file

@ -0,0 +1,14 @@
[Desktop Entry]
Encoding=UTF-8
Name=Color Selector
Name[es]=Probador de colores
Name[pl]=Próbnik kolorów
Comment=Choose colors from palette or screen
Comment[es]=Elige y proba colores de la gama de colores o la pantalla
Comment[pl]=Wybiera kolory z palety lub ekranu
Exec=gcolor2
Icon=%%PREFIX%%/share/gnome/pixmaps/gcolor2/icon.png
Terminal=false
Type=Application
Categories=GNOME;Application;Graphics;
StartupNotify=true

View file

@ -0,0 +1,98 @@
--- src/callbacks.c.orig Tue Apr 19 00:37:37 2005
+++ src/callbacks.c Tue Apr 19 00:39:22 2005
@@ -126,8 +126,9 @@
if (gtk_tree_selection_get_selected (selection, &model, &selection_iter))
{
+ GtkColorSelection *colorsel;
gtk_tree_model_get (model, &selection_iter, COLOR_VALUE, &color, COLOR_TYPE, &type, -1);
- GtkColorSelection *colorsel = GTK_COLOR_SELECTION (lookup_widget (gcolor2, "colorselection1"));
+ colorsel = GTK_COLOR_SELECTION (lookup_widget (gcolor2, "colorselection1"));
gdk_color_parse (color, &new_color);
/* save the old color */
@@ -249,9 +250,10 @@
on_save_button_clicked (GtkButton *button,
gpointer user_data)
{
+ gint result;
savedialog = create_save_dialog ();
gtk_window_set_transient_for (GTK_WINDOW (savedialog), GTK_WINDOW (gcolor2));
- gint result = gtk_dialog_run (GTK_DIALOG (savedialog));
+ result = gtk_dialog_run (GTK_DIALOG (savedialog));
switch (result)
{
case GTK_RESPONSE_OK:
@@ -269,18 +271,19 @@
save_selected_color ()
{
GtkWidget *entry = lookup_widget (savedialog, "entry1");
+ GtkTreeView *list;
+ FILE *fp;
+ gint r, g, b;
+ gchar old[512] = "";
colorname = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
add_list_color (colorvalue, colorname, "user", TRUE);
- GtkTreeView *list = GTK_TREE_VIEW (lookup_widget (gcolor2, "treeview1"));
+ list = GTK_TREE_VIEW (lookup_widget (gcolor2, "treeview1"));
gtk_tree_view_scroll_to_cell (list, gtk_tree_path_new_first (), NULL, FALSE, 0, 0);
gtk_tree_selection_select_path (gtk_tree_view_get_selection (list), gtk_tree_path_new_first ());
/* save color in user file - write at top of the file */
- FILE *fp;
- gint r, g, b;
- gchar old[512] = "";
sscanf (colorvalue, "#%2x%2x%2x", &r, &g, &b);
fp = fopen (get_filename (), "r");
@@ -307,8 +310,9 @@
gpointer user_data)
{
GtkWidget *deletedialog = create_delete_dialog ();
+ gint result;
gtk_window_set_transient_for (GTK_WINDOW (deletedialog), GTK_WINDOW (gcolor2));
- gint result = gtk_dialog_run (GTK_DIALOG (deletedialog));
+ result = gtk_dialog_run (GTK_DIALOG (deletedialog));
switch (result)
{
case GTK_RESPONSE_OK:
@@ -330,15 +334,22 @@
gchar *selection_color_name;
gchar *selection_color_value;
- gtk_tree_model_get (model, &selection_iter, COLOR_VALUE, &selection_color_value, COLOR_NAME, &selection_color_name, -1);
-
-
- /* remove from file */
+
FILE *fp;
gchar *p;
gchar buffer[512] = "";
gchar newstuff[512] = "";
+ gint r, g, b;
+ gchar *file_color_name;
+ gchar file_color_value[8];
+ gboolean found = FALSE;
+
+ gtk_tree_model_get (model, &selection_iter, COLOR_VALUE, &selection_color_value, COLOR_NAME, &selection_color_name, -1);
+
+
+ /* remove from file */
+
fp = fopen (get_filename (), "r");
if (fp == NULL)
{
@@ -346,10 +357,6 @@
return;
}
- gint r, g, b;
- gchar *file_color_name;
- gchar file_color_value[8];
- gboolean found = FALSE;
while ((p = fgets (buffer, sizeof buffer, fp)) != NULL)
{
if (buffer[0] == '!')

View file

@ -0,0 +1,26 @@
--- src/main.c.orig Tue Oct 19 07:37:18 2004
+++ src/main.c Tue Apr 19 00:37:09 2005
@@ -17,8 +17,9 @@
get_filename()
{
gchar buf[50];
+ gchar* file;
g_sprintf (buf, "%s/.rgb.txt", getenv ("HOME"));
- gchar* file = g_strdup (buf);
+ file = g_strdup (buf);
return file;
}
@@ -48,10 +49,11 @@
"................"
};
gchar colorline[] = ". c #FFFFFF";
+ GdkPixbuf *buf;
g_sprintf (colorline, ". c %s", g_ascii_strup (spec, -1));
swatchxpm[1] = colorline;
- GdkPixbuf *buf = gdk_pixbuf_new_from_xpm_data ((gchar const **)swatchxpm);
+ buf = gdk_pixbuf_new_from_xpm_data ((gchar const **)swatchxpm);
if (is_top)
gtk_list_store_prepend (liststore, &iter);

View file

@ -0,0 +1,3 @@
Gcolor2 is a simple, standalone GTK+ 2.0 color selector.
WWW: http://gcolor2.sourceforge.net/

View file

@ -0,0 +1,5 @@
bin/gcolor2
share/gnome/applications/gcolor2.desktop
share/gnome/pixmaps/gcolor2/about_icon.png
share/gnome/pixmaps/gcolor2/icon.png
@dirrm share/gnome/pixmaps/gcolor2