diff options
author | Adam Weinberger <adamw@FreeBSD.org> | 2003-02-05 02:02:55 +0000 |
---|---|---|
committer | Adam Weinberger <adamw@FreeBSD.org> | 2003-02-05 02:02:55 +0000 |
commit | 42f65709ca108f1890a505429e1d4635a74a4546 (patch) | |
tree | f93b28c123b85a1d4256c55323d4372b91db6e6e /sysutils/thefish | |
parent | New Port: p5-DBIx-Browse v2.09 (diff) |
Bug fix ("remember geometry" patch). PORTREVISION bump for silkier shine
and bounce that lasts.
PR: 47912
Submitted by: Miguel Mendez <flynn@energyhq.homeip.net> (maintainer)
Notes
Notes:
svn path=/head/; revision=74728
Diffstat (limited to 'sysutils/thefish')
-rw-r--r-- | sysutils/thefish/Makefile | 1 | ||||
-rw-r--r-- | sysutils/thefish/files/patch-gui_ui.c | 138 |
2 files changed, 139 insertions, 0 deletions
diff --git a/sysutils/thefish/Makefile b/sysutils/thefish/Makefile index e3e8318e33ab..105fc5f28be4 100644 --- a/sysutils/thefish/Makefile +++ b/sysutils/thefish/Makefile @@ -7,6 +7,7 @@ PORTNAME= thefish PORTVERSION= 0.3 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= http://energyhq.homeip.net/files/ diff --git a/sysutils/thefish/files/patch-gui_ui.c b/sysutils/thefish/files/patch-gui_ui.c new file mode 100644 index 000000000000..b696e535cf97 --- /dev/null +++ b/sysutils/thefish/files/patch-gui_ui.c @@ -0,0 +1,138 @@ +--- gtk_ui.c.orig Tue Feb 4 17:51:19 2003 ++++ gtk_ui.c Tue Feb 4 17:51:37 2003 +@@ -24,7 +24,7 @@ + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-$Id: //depot/fish/gtk_ui.c#28 $ ++$Id: //depot/fish/gtk_ui.c#29 $ + + */ + +@@ -33,6 +33,10 @@ + #include <string.h> + #include <fcntl.h> + ++#include <sys/types.h> ++#include <sys/uio.h> ++#include <unistd.h> ++ + #include <time.h> + extern char *tzname[2]; + +@@ -66,6 +70,8 @@ + void add_yes_pressed(GtkWidget *, gpointer); + void add_no_pressed(GtkWidget *, gpointer); + ++void save_geometry(void); ++ + /* Some defines here */ + #define IS_DIRTY 1 + #define NOT_DIRTY 0 +@@ -139,7 +145,10 @@ + GtkWidget *window; + GtkWidget *myviewport1; + GtkWidget *myviewport2; +- ++ ++ /* Window geometry */ ++ int oldsize[2]; ++ + /* I know this code looks chaotic at first sight, but it seems to work :-) */ + int + create_gtk_ui(RC_NODE *rc_knobs,int num_knobs,RC_NODE *rc_strings,int num_str) +@@ -202,6 +211,10 @@ + + int i; + ++ char *homedir; ++ char temp[255]; ++ int fd; ++ + commit_win_up=FALSE; + add_win_up=FALSE; + about_win_up=FALSE; +@@ -218,6 +231,27 @@ + gtk_window_set_title(GTK_WINDOW(window),"The Fish"); + + ++ /* Set the size */ ++ ++ homedir=getenv("HOME"); ++ if(homedir!=NULL) { ++ ++ snprintf(temp,255,"%s/%s",homedir,".thefishrc"); ++ fd=open(temp,O_RDONLY,0); ++ if(fd!=-1) { ++ read(fd,&oldsize[0],sizeof(oldsize)); ++ close(fd); ++ } else { ++ ++ oldsize[0]=400; ++ oldsize[1]=480; ++ ++ } ++ ++ } ++ ++ gtk_window_set_default_size(GTK_WINDOW(window),oldsize[0],oldsize[1]); ++ + /* Set the icon */ + icon16_pixbuf=gdk_pixbuf_new_from_xpm_data((const char **)icon16); + icon32_pixbuf=gdk_pixbuf_new_from_xpm_data((const char **)icon32); +@@ -561,6 +595,7 @@ + void + destroy( GtkWidget *widget, gpointer data) + { ++ save_geometry(); + gtk_main_quit(); + } + +@@ -583,10 +618,15 @@ + result=gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + +- if(result==GTK_RESPONSE_YES) gtk_main_quit(); ++ if(result==GTK_RESPONSE_YES) { ++ ++ save_geometry(); ++ gtk_main_quit(); ++ } + +- } else { ++ } else { + ++ save_geometry(); + gtk_main_quit(); + + } +@@ -1167,4 +1207,29 @@ + gtk_widget_destroy(add_window); + + add_win_up=FALSE; ++} ++ ++void ++save_geometry(void) ++{ ++ ++ int newsize[2]; ++ char *homedir; ++ char temp[255]; ++ int fd; ++ ++ gtk_window_get_size(GTK_WINDOW(window),&newsize[0],&newsize[1]); ++ ++ if(oldsize[0]!=newsize[0] || oldsize[1]!=newsize[1]) { ++ ++ homedir=getenv("HOME"); ++ if(homedir==NULL) return; ++ snprintf(temp,255,"%s/%s",homedir,".thefishrc"); ++ fd=open(temp,O_WRONLY|O_CREAT|O_TRUNC,0666); ++ if(fd==-1) return; ++ write(fd,&newsize[0],sizeof(newsize)); ++ close(fd); ++ return; ++ ++ } + } |